How to copy Time Machine volume to another disk using rsync while preserving ACLs?

9

2

Recently I had to change my Mac's filesystem from case-preserving to being fully case-sensitive. I did that by using CCC and copying data to another disk, then returning back to newly formatted main disk.

Now, I wanted to do the Time Machine backup on my old Time Machine disk, that is hosted on my FreeBSD based NAS, exported through AFP. However, I'm getting an error that filesystems do not match, as Time Machine still has non-case-sensitive fs. This time, I can't use CCC, as it doesn't support file level copy for Time Machine volumes.

Naturally, I went straight for rsync, but that raises a problem - if I run it with:

/usr/local/bin/rsync --super -aEHAXNvx --fileflags --delete /Volumes/Time\ Machine\ Backups/ /Volumes/NewDisk/

it starts complaining as soon as it hits Backups.backupdb/<machinename> folder, with failed to set permissions, operation not permitted. The problem here is copying ACLs, that are quite restrictive:

 ll -dle /Volumes/Time\ Machine\ Backups/Backups.backupdb/<machinename>/
 drwxr-xr-x@ 19 root  staff  646 Dec 23 09:38 /Volumes/Time Machine Backups/Backups.backupdb/<machinename>/
 0: group:everyone deny add_file,delete,add_subdirectory,delete_child,writeattr,writeextattr,chown

So, I removed -A from the above command, and rsync is now happily moving GBs of data.

Alas, I would like to preserve ACLs as well. Is that possible somehow? OS X doesn't have getfacl/setfacl, and I would like to avoid parsing output of ls -le. What I see as a solution here is to somehow tell rsync to apply ACLs "backwards", that is, from leaf files down to directories, but there's no option for it.

Nikola Knezevic

Posted 2013-02-19T22:42:19.250

Reputation: 191

Is rsync on the destination end running as a user with permission to chmod those files? – harrymc – 2013-06-19T14:37:42.257

This may be an obvious question, but are you sure ACL support is turned on in the destination volume? You imply that you're copying to a mac, which should, but in that case it should simply be working unless the user on that end is not the same user id # as the original files, in which case you will probably need to set that up, or switch to using root (obviously not a good thing, but takes care of the permission problem of setting ownership to someone else). – Tom Scogland – 2013-06-20T10:49:52.783

In addition, this said user account should be defined for the target, or else the owner cannot be set. – harrymc – 2013-06-21T09:18:02.160

Answers

3

Download rsync version 3 using Homebrew. Then you can try the "--acls" option. The rsync on Mac seems to have a slightly different command line syntax from other operating systems. You probably want to take a look at this link: http://nicolasgallagher.com/mac-osx-bootable-backup-drive-with-rsync/. It describes how to get rsync 3 and the command line arguments he uses.

I'm not an OSX user, but I back up my wife's Mac to a Linux server with rsync.

Lencho Reyes

Posted 2013-02-19T22:42:19.250

Reputation: 151

2

rsync, at least in OS X 10.4 and following, will transfer ACL attributes if the -E option is used. See the man page.

neoplop

Posted 2013-02-19T22:42:19.250

Reputation: 21