12
4
I'm trying to copy a directory tree recursively preserving hardlinks to the file. Using gnu cp, this would work with the -l flag. cp would then recreate the directory structure, but wouldn't need to copy the contents of each file.
This is preliminary to a backup, first I want to make a cheap (hardlinked) copy of the previous backup and then rsync the source directory over this copy. Roughly:
cp -r -l yesterdays_backup todays_backup
rsync -a source_dir todays_backup
Unfortunately, OSX's cp doesn't support the -l flag, as far as I can tell, cpio doesn't support recursive copying. The other alternative is pax, but that leads to the entire directory structure being copied:
pax -rw backups/yesterdays_backup backups/todays_backup
transforms:
yesterdays_backup
|
\source_dir (...)
to:
todays_backup
|
\backups
\yesterdays_backup
\source_dir(...)
There should be an easy/obvious way to do this, but I'm currently stumped... Any alternatives to cpio and pax? I'd like to avoid having to install gnu cp.
I'm aware of Timemachine, but that won't properly back up encrypted directories incrementally.
using find along with cpio get around the lack of recursive cpio as described here: (http://www.mikerubel.org/computers/rsync_snapshots/#Incremental) but doesn't seem very elegant...
– None – 2009-08-30T18:48:10.417