NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.

Forum Discussion

networkn's avatar
networkn
Aspirant
Apr 11, 2013

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?

6 Replies

Replies have been turned off for this discussion
  • StephenB's avatar
    StephenB
    Guru - Experienced User
    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.
  • 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.
  • Hi Thanks. Is there some documentation or example scripts I could look at please?
  • StephenB's avatar
    StephenB
    Guru - Experienced User
    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.
  • 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?
  • StephenB's avatar
    StephenB
    Guru - Experienced User
    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.

NETGEAR Academy

Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology! 

Join Us!

ProSupport for Business

Comprehensive support plans for maximum network uptime and business peace of mind.

 

Learn More