I have a new NAS box and after looking through numerous backup solutions I've found doing it manually through PuTTy to work the best.
After logging in to the box through PuTTy as root, I first need to copy the entire disk onto a USB HDD (well once every week). I have been using:
cp -Rp /data/Backup /media/USB_HDD_3/Backup
I have tried with rysnc -a
instead and I get the similar results in that the files themselves keep the mtime but directories do not.
Then everyday I will be doing an incremental backup. For which I have been building:
find . -mtime -2 -exec cp -Rp {} /media/USB_FLASH_1/ \;
Again, I've tried substituting cp - Rp
with rsync -a
to no avail. I just end up getting the whole of the backup transferred, like it hasn't even looked at the mtime.
I'm rather new to Linux and Unix so most of this I have adapted from things I have found on the net and then tried to slot them together which is probably the reason it doesn't work.
Best Answer
rsync -a
should work if you simply do:If it isn't preserving directory timestamps, this is probably a bug in the
rsync
version. As an alternative, you could try GNUcpio
:Or more portably (won't handle filenames with newlines):
Note that
BusyBox
builds often contain stripped down versions of the various tools. Even when built fully it is not completely POSIX compliant, alsocpio
isn't actually in thePOSIX
standard anymore. It is likely that your version ofBusyBox
is built without support for the-p
option. You would need to use acpio
with these options enabled.I tested the above with GNU
cpio
. I can't find a link to what the old standard for it was, but most likely anything compliant with it will support all these options except-0
.