Tim Edwards
2009-Jul-14 11:01 UTC
--delete-before doesn't seem to actually be deleting before transfer
I have a script transferring some backup files onto a USB stick, which has limited space. I use rsync 3.0.5 with the following command: rsync -av --delete-before /local/backups/dir/backup1_todaysdate /local/backups/dir/backup2_todaysdate /local/backups/dir/backup3_todaysdate /USBstick/backups/dir The USB stick runs out of space if more than 1 backup set is put on it, so I'd assumed that by using the --delete-before option would first scrub /USBstick/backups/dir of any files that I hadn't listed to be transfered - is this how it works? Because it doesn't seem to work that way - I have to manually delete the old backups from the USB stick before transferring the new. Thanks for any help Tim Edwards
David Brown
2009-Jul-14 11:17 UTC
--delete-before doesn't seem to actually be deleting before transfer
You need to use --delete instead of just the --delete-before. You do not actually need the "before" bit as this is the default for --delete. -david On 14 Jul 2009, at 12:01, Tim Edwards wrote:> I have a script transferring some backup files onto a USB stick, which > has limited space. I use rsync 3.0.5 with the following command: > rsync -av --delete-before /local/backups/dir/backup1_todaysdate > /local/backups/dir/backup2_todaysdate > /local/backups/dir/backup3_todaysdate /USBstick/backups/dir > > The USB stick runs out of space if more than 1 backup set is put on > it, > so I'd assumed that by using the --delete-before option would first > scrub /USBstick/backups/dir of any files that I hadn't listed to be > transfered - is this how it works? Because it doesn't seem to work > that > way - I have to manually delete the old backups from the USB stick > before transferring the new. > > Thanks for any help > > Tim Edwards > -- > Please use reply-all for most replies to avoid omitting the mailing > list. > To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync > Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html >------------------- Redpaw Ltd. ? Mac OS X Server Installation & System Administration ? Network & Internet Connectivity F0/1, 8 Lawrence Street, Glasgow, G11 5HQ ? P: 0141-3348827 M: 0779-5212034 W: www.redpaw.co.uk Ltd company registered in Scotland No. 259134. Director: David Brown Lessons from life: My brothers and I had a secret friend we called Uncle Hairy Caveman. He lived in a cave and occasionally ate one of us. It was only afterwords we discovered he was a bear.
Matthias Schniedermeyer
2009-Jul-14 11:41 UTC
--delete-before doesn't seem to actually be deleting before transfer
On 14.07.2009 13:01, Tim Edwards wrote:> I have a script transferring some backup files onto a USB stick, which > has limited space. I use rsync 3.0.5 with the following command: > rsync -av --delete-before /local/backups/dir/backup1_todaysdate > /local/backups/dir/backup2_todaysdate > /local/backups/dir/backup3_todaysdate /USBstick/backups/dir > > The USB stick runs out of space if more than 1 backup set is put on it, > so I'd assumed that by using the --delete-before option would first > scrub /USBstick/backups/dir of any files that I hadn't listed to be > transfered - is this how it works? Because it doesn't seem to work that > way - I have to manually delete the old backups from the USB stick > before transferring the new.I think you have more of a problem with how rsync updates a changed file than with --delete-before. See --inplace in the man-page. Without --inplace, you temporarily need as much additional free space as the biggest (changed) file. Bis denn -- Real Programmers consider "what you see is what you get" to be just as bad a concept in Text Editors as it is in women. No, the Real Programmer wants a "you asked for it, you got it" text editor -- complicated, cryptic, powerful, unforgiving, dangerous.
Matt McCutchen
2009-Jul-15 03:50 UTC
--delete-before doesn't seem to actually be deleting before transfer
On Tue, 2009-07-14 at 13:01 +0200, Tim Edwards wrote:> I have a script transferring some backup files onto a USB stick, which > has limited space. I use rsync 3.0.5 with the following command: > rsync -av --delete-before /local/backups/dir/backup1_todaysdate > /local/backups/dir/backup2_todaysdate > /local/backups/dir/backup3_todaysdate /USBstick/backups/dir > > The USB stick runs out of space if more than 1 backup set is put on it, > so I'd assumed that by using the --delete-before option would first > scrub /USBstick/backups/dir of any files that I hadn't listed to be > transfered - is this how it works?No, rsync will only do that if if you have it "synchronize" /USBstick/backups/dir , i.e., specify a source directory that maps to it. Just copying several dirs _into_ /USBstick/backups/dir does not do the trick. See the description of --delete in the man page. Something like the following, copying the entire /local/backups/dir but excluding all the backups except those you want, would work: rsync -av --delete-before --include=/backup1_todaysdate --include=/backup2_todaysdate --include=/backup3_todaysdate --exclude='/*' /local/backups/dir/ /USBstick/backups/dir -- Matt