Orbi WiFi 7 RBE973
Reply

Sync Backups <60 days old

networkn
Aspirant

Sync Backups <60 days old

Hi There!

We backup 3 notebooks to a Ultra 2 Plus ReadyNAS, into 3 folders.

We have 2 USB Hard Disks Rotated weekly offsite.

I want to mirror the data on the NAS to the USB Hard Disks to a Maximum age of 60 Days. This is because there is considerably less space on the USB External Drive than the NAS and we want the most current backups on the External HDD's.

How could I do this?
Message 1 of 7
StephenB
Guru

Re: Sync Backups <60 days old

If you can connect the USB drives to a PC (backing up over the network) you can use robocopy /maxage:60

If you need to connect the USB drive to the ultra, then I think you'd need a custom script to do what you want (requiring ssh access). For instance, use find to build a file list, and then feed that list into rsync.
Message 2 of 7
kossboss
Guide

Re: Sync Backups <60 days old

I recommend using a direct copy from nas to usb using an ssh script as StephenB has stated. The robocopy would have to copy through the means of another PC and that might cause a bottleneck.
Message 3 of 7
networkn
Aspirant

Re: Sync Backups <60 days old

Hi Thanks. Is there some documentation or example scripts I could look at please?
Message 4 of 7
StephenB
Guru

Re: Sync Backups <60 days old

If you have gigabit ethernet, then copying through a PC is likely faster then local USB. Though you do need to make sure the PC is on, etc.

With ssh
find . -mtime -90
should give you a list of all files in the current directory that were modified in the past 90 days.

You can use that command to create an input file list for rsync (using --include-from=FILE).

Alternatively you could use find to move all files older than 90 days into an archival folder, and then use frontview's rsync backup job to copy the main folder. For instance,
find . -mtime +90 -type f -exec mv -v {} $directory \;
would move all older files into the $directory folder.

Warning: I didn't test either command.
Message 5 of 7
networkn
Aspirant

Re: Sync Backups <60 days old

Hi I think I'll opt to use Robocopy but I need to find a combination that works since maxage:60 and /mir (Which is what I require if I want files older than 60 days to be removed from the USB) don't appear to work together.

I want to make sure I just copy the minimum number of files but ensure that all files <60 days are on the USB (But 120 days are kept on the nas by default)

I guess I could purge files older than 60 days from the USB Drive first then do the mirror, any better ideas?
Message 6 of 7
StephenB
Guru

Re: Sync Backups <60 days old

I think the two options do work together, but robocopy will not delete files on the target if they are present in the source (even if the source file doesn't meet the criteria)

What I would do is create a batch file which first deletes files older than 60 days in the target directory, and then runs robocopy. You wouldn't need /mir in that case, though I think it does no harm. There's a batch file here that does shows you how to do the deletion step: http://stackoverflow.com/questions/9746 ... 65#9747065

I haven't tested it, but it looks correct.

Is that enough to get you started? I could probably put something together and post it, though it might take a day or two.
Message 7 of 7
Top Contributors
Discussion stats
  • 6 replies
  • 3463 views
  • 0 kudos
  • 3 in conversation
Announcements