Backup issue.

Forum rules
Before you post please read how to get help
Moggertron
Level 1
Level 1
Posts: 30
Joined: Sat Aug 13, 2011 9:19 pm
Location: Mandurah WA

Backup issue.

Postby Moggertron » Fri Feb 10, 2012 12:16 am

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 ?

Marios Zindilis
Level 1
Level 1
Posts: 5
Joined: Mon Jan 30, 2012 5:52 am
Location: Limassol, Cyprus
Contact:

Re: Backup issue.

Postby Marios Zindilis » Fri Feb 10, 2012 1:24 pm

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.

Moggertron
Level 1
Level 1
Posts: 30
Joined: Sat Aug 13, 2011 9:19 pm
Location: Mandurah WA

Re: Backup issue.

Postby Moggertron » Fri Feb 10, 2012 6:34 pm

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.

mph426
Level 1
Level 1
Posts: 22
Joined: Fri Dec 16, 2011 3:03 pm
Location: State of confusion

Re: Backup issue.

Postby mph426 » Sat Feb 11, 2012 1:25 am

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.
I'd rather have a bottle in front of me than a frontal lobotomy.


Return to “Scripts & Bash”

Who is online

Users browsing this forum: No registered users and 3 guests