How can I prevent vanishing error when using rsync with an nfs mount?
As far as I know, the "file-has-vanished" condition is not a fatal error condition for rsync
, and the process should continue just fine. Are you saying that rsync
is halting upon reporting the "vanished file" messages?
If you are backing up a live filesystem, it is always possible to get the "vanished" message from rsync
. Between the time that rsync
adds a file to its transfer list and the time that rsync
actually gets around to reading it, a file can "vanish" for any number of legitimate reasons (e.g. a temporary lock file was removed, or a file was renamed). Note that some applications work around limitations in NFS file locking by creating and removing hidden lock files, and it's possible that rsync
may be seeing some of those.
I would suggest to keep your source filesystem as quiescent as possible while it is being backed up. Ideally, no one other than the backup process should be accessing it, but I realize that that may not be feasible. If your source filesystem is on an LVM logical volume, then you could consider creating a read-only snapshot to use as your backup source.
This is a problem with special characters in the file names, as discussed here: https://superuser.com/questions/91967/rsync-character-set-problems
What I do in my daily backup script, this script is a rsync
wrapper :
#!/bin/bash
rsync "$@" 2> >(grep -v vanished)
ret=$?
((ret==24)) && exit 0 || exit $ret