Page 1 of 1

Backup issue.

Posted: Fri Feb 10, 2012 12:16 am
by Moggertron
Hi

I currently have Simple backup doing my backups for me. It backs up to a folder say sdb1/backups . I have made a basic alias that I can type at the command line which copies the sdb1/backups contents to an external hard drive /500gb/backups. The alias copies across all the new backups and updates existing copies if they have changed.

Simple backup is doing the logarithmic backup where it keeps 1 backup from today, 1 from yesterday, 1 from last week and so on. Simple backup does it's own deleting to keep things tidy which is my issue. While my alias copies all the new stuff across to the second backup area it doesn't delete the files that the originating backups folder no longer has. I'm not really sure how to get the second backup folder to dispose of these files. I'm going to change from the alias to a basic script that will run from cron.

I am wondering how to compare the source folder of backups to the secondary backups and keep them in line. I think I need to pipe a list from the source folder into grep -v or something and then remove the difference.

Any ideas ?

Re: Backup issue.

Posted: Fri Feb 10, 2012 1:24 pm
by Marios Zindilis
I don't remember the specific option off the top of my head, but rsync can synchronize two folders and delete the excessive files in the destination folder (i.e. the ones that don't exist in the source folder any more).

Check out the man page and/or Google for "rsync examples", if you cannot find what you need I can doublecheck for you.

Re: Backup issue.

Posted: Fri Feb 10, 2012 6:34 pm
by Moggertron
Thanks Marios. I will have a look and ask a bit more if I get stuck. Between google and man
pages I normally figure most things out.

Re: Backup issue.

Posted: Sat Feb 11, 2012 1:25 am
by mph426
I think what you want is

Code: Select all

 rsync -av --delete
the -av is the most popular option, --delete keeps them identical.

If you want to do a dry run and see what it will do without making any changes use

Code: Select all

rsync -avn --delete
the -n is the dry run switch.

Code: Select all

man rsync
will give you much more info.