Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Still learning and always looking for a source of new answers when I can't find one myself, so I thought I would try here.
I've got a script using rsync 2.6.4 to backup a large RAID array to a separate NAS box I have. All seemed to be working fine, however I've just checked the logs to find it isn't working... It seems that the --delete option isn't deleting and the NAS is now full.
the NAS being mounted through samba (it doesn't support rsync natively, well, the current firmware it has doesn't anyway).
When I run the command with the --dry-run option, all looks fine - I can see the many files that it intends to delete. I remove the dry-run option, and rather than delete first it starts copying immediately. Of course it runs out of space with a "No space left on device (28)" error soon after.
I just can't think of a reason it is doing it like this...
Would anyone be able to shed some light on the situation? Thanks!
You're copying a large amount of data from /usr/local/graphicsraid/storage to /mnt/mirror, asking rsync to delete files from /usr/local/graphicsraid/storage when it has finished, and /mnt/mirror is becoming full?
Sounds pretty normal to me. Are you sure /mnt/mirror has enough space for the files you're copying there? Compare 'du -ks /usr/local/graphicsraid/storage' against 'df -k /mnt/mirror' and confirm there is enough space on your NAS for all the data from your RAID.
Or maybe I misunderstand your question, or rsync, or both
--delete
This tells rsync to delete any files on the receiving side that
aren’t on the sending side.
So it should remove files from /mnt/mirror/ that don't (any longer) exist on /usr/local/graphicsraid/storage/. I'd say that's what Cooks44 intended, and verified in a dry run. And, as there's no --delete-after option, we get the default behavior:
Quote:
By default rsync does file deletions on the receiving side
before transferring files to try to ensure that there is suffi-
cient space on the receiving filesystem.
So maybe an I/O error prevents the deletion (which you could ignore with --ignore-errors). Or there may be a bug in rsync?
BTW, accessing a mounted (remote?) file system undoes the benefits of the ingenious rsync protocol, which can bring a file that is already at the recipient in sync by only transferring block changes, sometimes significantly reducing network bandwidth usage. But that may not be an issue for Cooks44.
Sorry, I don't have a clear route to troubleshooting. Maybe (A) try a small subtree, (B) use --ignore-errors there, (C) find a rsync dedicated mailing list, (D) look at the source code, (E) strace, (F) pull out your hair?
See the original post --
LnxAdm: Nope, it doesn't die. It skips deleting, and starts copying (which should happen after).
kav: Cooks44 did use --delete. I just had to quote the rsync man page to Neek, who suspected he misunderstood.
Indeed I mis-read my version of the man page, which is possibly the Debian version on my Fedora Core 6 box and reads "--delete delete extraneous files from dest dirs", for some reason I confused this with the --remove-sent-files option on the version of rsync we use on Solaris :P Sorry. My man page does state "--delete-before receiver deletes before transfer (default)" and so with --delete it should be deleting before transfer, as the OP said --dry-run indicated.
Quote:
Originally Posted by Quigi
BTW, accessing a mounted (remote?) file system undoes the benefits of the ingenious rsync protocol, which can bring a file that is already at the recipient in sync by only transferring block changes, sometimes significantly reducing network bandwidth usage. But that may not be an issue for Cooks44.
He used -W, which my man page says "-W, --whole-file copy files whole (without rsync algorithm)" so good point, but Cook44 may already have taken it into account.
I like the strace suggestion; try to figure out when the unlink operation is attempted and what the return value is from the system call. I've tested rsync on a tmp source/dest dir, with something simple like "strace <original rsync command line>" but cannot see unlink being performed though the removed source file is removed from the destination dir, but I probably need the strace man page quoted at me :P Maybe someone can suggest a fix to this, probably obviously mistaken, strace usage.
Yes, the --delete option was set, has always been. I've tried "--delete-before", and a few other combinations to ensure it's using default behaviour.
I'm mirroring a 1TB RAID on my main graphics server to a 1TB JBOD on a NAS I have. It's all running locally on gigabit, so saving bandwidth through rsync algorithms isn't necessary - saving time on the job is. From using rsync in the past it is the perfect tool, so I'll stick with it and figure it out.
I have thrown an --ignore-errors into the scripts too, hoping that might show up an I/O error to no avail.
As listed in my OP, it's so strange that the behaviour I expect is happening in the dry run, but not when it's actually performed.
Either way, you have given me a few avenues to try - I'm leaning towards Samba not liking me (it never does...) so I'll see if I can trace it out and figure out why.
I like the strace suggestion; try to figure out when the unlink operation is attempted and what the return value is from the system call. I've tested rsync on a tmp source/dest dir, with something simple like "strace <original rsync command line>" but cannot see unlink being performed though the removed source file is removed from the destination dir, but I probably need the strace man page quoted at me :P Maybe someone can suggest a fix to this, probably obviously mistaken, strace usage.
It needs the -f option to follow children. (Apparently rsync doesn't call fork but clone, which seems similar). Here is a tiny example rsync use.
Code:
$ mkdir orig mirror
$ touch orig/{a,b,c,d}
$ rsync -vrutW --delete orig/ mirror/
building file list ... done
./
a
b
c
d
sent 242 bytes received 114 bytes 712.00 bytes/sec
total size is 0 speedup is 0.00
$ rm orig/{a,c}
$ strace -f -o rsync.strace rsync -vrutW --delete orig/ mirror/
building file list ... done
deleting c
deleting a
./
sent 64 bytes received 26 bytes 180.00 bytes/sec
total size is 0 speedup is 0.00
$
The deleting worked. Both orig and mirror are on a local file system, Samba is NOT involved. The resulting file rsync.strace has 392 lines. It shows that the process 26540 had a child 26541, which did the unlinking, and a grandchild 26542. Here's an excerpt:
Second, a different approach, avoiding rather than solving the problem:
Cooks44, you mentioned Samba, and that it might not like you. This makes me guess that the destination (JBOD on NAS) lives on a Windows machine. Is this correct? If yes, you could try rsync-ing to that directly, and avoid using the Samba mount. I routinely do that here at home. I initiate the rsync from the Linux side (by cron), so the Windows machines must be running sshd. Rync also works the other way.
NAS is a Thecus NS5200, my understanding is it runs a "proprietory" version of linux on it. Unfortunately it doesn't run the rsync protocol, and being designed for windows use it only provides for samba connections (or so I recall - haven't checked what else is available in a while).
Haven't had a chance to revisit it as yet - our ISDN PRI has decided it wants to join the fun and is giving me an immense amount of grief. That takes priority so I'll be back to this issue soon.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.