New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
rsync: --delete not working
Hi,
I have the following command to backup my entire HDD on my laptop to an external USB HDD.
sudo rsync -va --exclude '/media' --exclude '/proc/kcore' --delete --progress / '/media/TOSHIBA HDD/rsync-backup/'
My laptop HDD is 750GB whilst the external HDD is 1TB. Despite the external HDD only holding the backing, it is currently running at 31GB available. I have taken a look through the files and it appears that files deleted from the laptop are remaining on the backup drive.
Can anyone shed anylight on why deleted files aren't being deleted from the backup copy?
Jack
Comments
sudo?
Sorry, I do run under sudo already. I type sudo manually and copy the rest of the command from a text file.
I think it won't do deletions if it had any error during copy, which it very well might have had, considering you don't exclude things such as /dev and various weird files in /proc and /sys. Just exclude all of these 3 entirely, no need for the "/proc/kcore" b/s.
It always definitely will have errors. I will try using
.
Why would that be?
Also forgot to note, for backups like this, check out rdiff-backup, not just rsync.
http://manual.aptosid.com/en/sys-admin-rdiff-en.htm
It maybe the order of the flags:
rsync -va --delete --progress --exclude '/media' --exclude '/proc/kcore' / '/media/TOSHIBA HDD/rsync-backup/'
I tried using --delete-before and changing the order of the flags, no luck.
Try adding a trailing slash to the directories.
I'd try some of the other --delete options from the manpage.
Might work, but I don't know.
I pulled the rsync command I've been using:
Here's one I have with the exclude switch.
I always just use something simple, like:
rsync -ravP /src /dst --delete-after
EDIT: And add -e when required.
rsync -ravP -e "ssh -l root" /src remote:/dst --delete-after