OS X 10.6 (Snow Leopard) HFS+ File Compression

Matt McCutchen matt at mattmccutchen.net
Tue Oct 27 22:08:06 MDT 2009


On Tue, 2009-10-27 at 23:38 -0400, Tony wrote:
> When rsync 3.0.6 copies files with HFS+ File Compression, the new  
> extended attribute decmpfs is not preserved, and the UF_COMPRESSED  
> flag is not set on the destination and the destination file is not  
> compressed.
> 
> I examined the destination file as described in ars technica  (with ls  
> and xattr from a 10.5 Leopard boot), and the compressed data is moved  
> from the resource fork to the data fork, and the extended attributes  
> '@' are removed from the file.
> 
> As far as I know, only ditto in 10.6 can handle HFS+ File  
> Compression.  (I even tested a 'clone' with disk utility (file copy,  
> not block), and it also failed (block copy, of course works).

Rsync is just reading and writing files via the filesystem API; it has
no access to any of the flags or xattrs used to implement the
compression.

I guess the filesystem doesn't compress new files by default.  If it had
an API to request compression, rsync could use that API when writing the
destination files.  Unfortunately, the API ditto is using appears to be
private to Apple.  See the post from brkirch beginning "The first thing
that I tried to do" on this page:

http://www.macosxhints.com/article.php?story=20090902223042255

So anyone interested in making rsync compress the destination files
would probably have to copy the relevant code from afsctool.  This could
be shared as a patch; I feel quite sure it would not be adopted in the
main version of rsync.

-- 
Matt



More information about the rsync mailing list