Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'How to use 'cp' as a simple but reliable backup tool' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
How to use 'cp' as a simple but reliable backup tool
Authored by: pepi on Feb 17, '10 10:09:01AM

For the Mac OS X bundled rsync 2.6.9 you can use the following line to achieve the same, but with the extra speed of delta copy. I've included the long options to make the commands easier to comprehend.

/usr/bin/rsync --recursive --perms --executability --owner --group --times --progress --extended-attributes "source" "target"

If you have rsync 3 from mlbackup installed you can use a slight variation which is required for the much superior version of rsync included there.

/usr/local/maclemon/bin/rsync --recursive --perms --executability --acls --xattrs --owner --group --times --progress "source" "target"
This will also preserve ACLs and all extended attributes, forks etc.

You can also use mlbackup to achieve the same by creating a simple 7 line (max.) config file and have delta copies, backup rotation, growl and email notifications.

mlbackup was also featured in another hint and is available for free, licensed under GPL.

Full and fair disclosure: I am the author of mlbackup and I did write it for a very similar need, namely to backup files from one disk to another.



[ Reply to This | # ]
How to use 'cp' as a simple but reliable backup tool
Authored by: timcrawf on Feb 17, '10 03:03:27PM

First, thank you for mlbackup.
Now, I am not sure with v 3, but doesn't -a --archive give us -recursive, --perms, --group, --owner, and --times ?
Then we only need to add -E in (for --extended-attributes) in 2.6 and I suppose --acls in 3.0?
I am leaving off --progess, since I usually automate the backup process and don't watch it.



[ Reply to This | # ]
How to use 'cp' as a simple but reliable backup tool
Authored by: pepi on Feb 18, '10 02:23:56PM

According to man rsync:
-a, --archive archive mode; same as -rlptgoD (no -H)

I've just used the long options to make it easier to read and to better give context with the given options for cp.


A correctly patched rsync3 is able to successfully pass all the backup bouncer tests which include ACLs, POSIX permisions, forks, extended-attributes, etc which is not possible with cp or the Apple provided rsync. See the README that comes with mlbackup for a more elaborate explanation on the matter.

rsync 3 also gives you much better speed when counting and evaluating files. This is mostly experienced on data sets with large numbers of files, not necessarily huge amounts of data. rsync 3 is the only way to get an exact copy of your source files without having to unmount the source volume or resort to block copy methods which lack some granularity. :-)



[ Reply to This | # ]