Sean Hammond
2005-Dec-29 03:37 UTC
-b and --backup-dir options, should backup-dir be INSIDE the sync''d folder?
I''m using rsync to keep 3 copies of a folder named ''sync'' synchronised. There is one remote copy, and two machines that I work on that have local copies. I try to always upload work from one machine to the remote copy before doing some work on another machine, otherwise I just merge things manually. Here is my entire rsync command for backing up from either of the work machines to the remote host: rsync -r -b --backup-dir=backup --delete -z -i --progress sync/ user@host :sync/ In particular I am passing rsync these two options: -b --backup-dir=backup This caused rsync to create, on the remote machine, a folder named backup inside the folder sync. I was a little worried about the backup folder being inside the sync folder. But indeed rsync seemed to copy into this backup folder any files from the remote end that got changed or deleted during a synchronisation. So far, as expected. Then (after successive synchronisations over time) rsync started creating backup folders insider the backup folder (recursively). It looked like on each synchronisation rsync moved the current remote backup folder to remote:sync/backup/backup (and did this recursively so that an existing /backup/backup folder becomes /backup/backup/backup/, and so on) and then it puts any new backup files into sync/backup/. Okaaay... so it''s maintaining multiple backups, good, but I said to myself that I would have to go into the remote host every now and then and delete some of the older backups so I don''t go over my quota. In further runs of rsync I noticed however that it was deleting things from the backup folders. It seems as if it''s maintaining a set number of backups, three of four deep or something (I just checked and it goes five deep on my remote host right now, to backup/backup/backup/backup/backup/), and automatically deleting backups older than that. Am I right? Or have I done something wrong with my command? Also I noticed that when I ''checked out'' a copy of the remote folder onto a new machine and then used rsync to backup back to the remote host, it copied every single file. I think this may be because I should have ''checked out'' the copy in the first place using rsync with the --times option? i.e. when rysnc''ing from a remote host to the local machine, you should pass -t so that the times are preserved in the new files on the local host? And that option should be used every time you rsync either to or from the remote host? Finally when running backups from this new machine, rsync keeps feezing. At different points in the backup it just freezes for a long time and I eventually have to kill it. I have verbose output on but that shows nothing, the output just stops coming. It seems to be perfectly safe to kill rsync in mid-run and then re-run the command and hope it works. Is this safe? Thanks -- Sean''s mailing list bin -- To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Wayne Davison
2005-Dec-30 06:15 UTC
-b and --backup-dir options, should backup-dir be INSIDE the sync''d folder?
On Thu, Dec 29, 2005 at 03:37:01AM +0000, Sean Hammond wrote:> I''m using rsync to keep 3 copies of a folder named ''sync'' synchronised.You might want to check into using unison for that (or even using a version control program, such as cvs).> rsync -r -b --backup-dir=backup --delete -z -i --progress sync/ user@host:sync/You''d be better off putting the backup dir outside the transfer by using something like --backup-dir=../backup . If that is not possible, you should exclude the backup dir from the deletion pass (and also from the files being copied) by using: --exclude=/backup> Also I noticed that when I ''checked out'' a copy of the remote folder onto a > new machine and then used rsync to backup back to the remote host, it copied > every single file. I think this may be because I should have ''checked out'' > the copy in the first place using rsync with the --times option?Yes, that would do it. You need to either always use -t (to make the quick-check always work) or use -c (which is a better but slower check to find the files that have actually changed).> Finally when running backups from this new machine, rsync keeps feezing.I wonder if that might be caused by rsync deleting a file in the backup dir over and over again. You can use a command such as strace on the program to know for sure. ..wayne..
Sean Hammond
2005-Dec-31 18:55 UTC
-b and --backup-dir options, should backup-dir be INSIDE the sync''d folder?
On 12/30/05, Wayne Davison <wayned@samba.org> wrote:> > On Thu, Dec 29, 2005 at 03:37:01AM +0000, Sean Hammond wrote: > > I''m using rsync to keep 3 copies of a folder named ''sync'' synchronised. > > You might want to check into using unison for that (or even using a > version control program, such as cvs).Meh. rsync does the job well enough, I just wrote scripts for it.> rsync -r -b --backup-dir=backup --delete -z -i --progress sync/ user@host > :sync/ > > You''d be better off putting the backup dir outside the transfer by using > something like --backup-dir=../backup . If that is not possible, you > should exclude the backup dir from the deletion pass (and also from the > files being copied) by using: > > --exclude=/backupThanks.> Also I noticed that when I ''checked out'' a copy of the remote folder onto > a > > new machine and then used rsync to backup back to the remote host, it > copied > > every single file. I think this may be because I should have ''checked > out'' > > the copy in the first place using rsync with the --times option? > > Yes, that would do it. You need to either always use -t (to make the > quick-check always work) or use -c (which is a better but slower check > to find the files that have actually changed).Yeah, that seems to work.> > Finally when running backups from this new machine, rsync keeps feezing. > > I wonder if that might be caused by rsync deleting a file in the backup > dir over and over again. You can use a command such as strace on the > program to know for sure. >Maybe, I guess. But it didn''t look like it. I had verbose mode on, and it appeared to keep freezing part way through uploading a file. But it was a different file every time I ran it. If it happens again I''ll investigate further. Anyway, I basically started again, downloaded a new copy of the folder using the --times option, and now it seems to be working fine. I''d just like to thank everyone involved for the rsync program. It''s a very useful little tool, it''s helping me keep my work safely backed up with barely any effort and I expect I''ll be using it throughout my three years of study. -- Sean''s mailing list bin -------------- next part -------------- HTML attachment scrubbed and removed