With the new ACL+xattr support and fake super (I'm glad this made it in!), it seems like my dream of being able to use rsync --link-dest to backup my mac is almost within reach! If you take a look at http://blog.plasticsfuture.org/2006/03/05/the-state-of-backup-and- cloning-tools-under-mac-os-x/ you can get an overview of the meta-data which needs to be saved for faithful backups on a mac. rsync 3pre2 now handles all but three items: 1. bsd flags 2. "locked flag" (supposedly finder meta-data) 3. creation date There is a (broken) patch in the pre2 directory for backing up bsd flags. I gather these don't exist on linux? On a mac (and I assume BSD in general) you can get them from st_flags in struct stat and set them with chflags(2). If linux doesn't support them, it might be possible to copy the flags into an xattr. The "locked flag" is actually just the bsd immutable flag; the author of that article is wrong. So solving the bsd flag issue solves this. The creation date is AFAIK a mac os specific piece of meta-data and can be accessed via the set/getattrlist + ATTR_CMN_CRTIME system call on a mac. Again, this meta-data might be reasonably converted into an extended attribute. I've noticed the ACLs on a mac are only saved in an xattr on a linux machine when the fake-super option is used. I'm not sure if this is the right thing to do, and I'm not sure whether the bsd flags / creation date should behave similarly. Would people be interested in a solution like this? What sort of toggle should be used to determine if the meta-data should be transported into an extended attribute? I'd be happy to whip up a quick patch for this if there's a consensus on how this meta-data should be converted.
Wesley W. Terpstra
2007-Oct-14 18:15 UTC
PATCH: preserve osx creation-date (was: Using pre2 for backing up a mac)
On Oct 13, 2007, at 4:07 PM, Wesley W. Terpstra wrote:> rsync 3pre2 now handles all but three items: > 1. bsd flags > 2. "locked flag" (supposedly finder meta-data) > 3. creation date > > The creation date is AFAIK a mac os specific piece of meta-data and > can be accessed via the set/getattrlist + ATTR_CMN_CRTIME system > call on a mac. Again, this meta-data might be reasonably converted > into an extended attribute.I've attached a patch which does this. Currently resource forks and finder info get placed into an extended attribute transparently by osx (com.apple.{ResourceFork/FinderInfo}). This patch makes another "extended attribute" called com.apple.CreationDate. The only issue I've found so far is that it gives warning when copying a symlink to linux as one can't set extended attributes there. It even works when copying from hfs to fat32 on the same mac. I don't understand where osx saves the creation date in a fat filesystem, but somehow it works!? I admit it's a bit hack-ish to put this in the extended attribute get/ set methods, but this mimics the behaviour of the other osx-specific meta-data. Also, it seems reasonable to me that it should be copied when '-X' is specified. There is no fgetattrlist method, but it seems that sys_fgetxattr is actually never used b/c x_fstat is not used. -------------- next part -------------- A non-text attachment was scrubbed... Name: creation-date.patch Type: application/octet-stream Size: 4153 bytes Desc: not available Url : http://lists.samba.org/archive/rsync/attachments/20071014/392c26dc/creation-date.obj