As you may already know, in order to reduce the size of Snow Leopard many of the system files are stored compressed. There are some technical details about this new compression in Ars Technica's Snow Leopard review but no details about how to use it for your own files. So I looked through the Snow Leopard command line tools and found this option for ditto:
After testing it out on some files I found that it does indeed apply HFS+ compression, although it seems that only files that meet certain conditions can have HFS+ compression applied to them. Regardless it can still create HUGE space savings. And there shouldn't be any issues as long as you don't mount a disk with HFS+ compressed files directly using a pre-10.6 system, because the files are decompressed when copied (so to use a compressed file on another computer without Snow Leopard, you simply need to make a copy of the file).
After freeing up several GBs from my Applications folder I was curious exactly how much space I had saved, but I ran across a problem: the Finder still reported exactly the same sizes. The Finder definitely reported more available space on the disk, but there wasn't anything I could find that would tell me the new size of my Applications folder; everything still reported the sizes that the files were before compression.
Anyway, to make a long story short I wrote my own command line utility (afsctool) for identifying HFS+ compressed files and getting the sizes of them. Its output looks something like this:
And here's what I get when I run it on my System folder:
Edit: I've updated afsctool and added in place HFS+ compression for files and folders, just be warned that you should make a backup before attempting to use it as I haven't had a chance to extensively test it yet.
Edit 2: The in place compression seems not to have any significant issues, but if you are compressing anything important then always include the -k flag just to be safe.
Download afsctool (source included) here:
http://web.me.com/brkirch/brkirchs_Software/afsctool/afsctool.html
Let me know what you think; for me this HFS+ compression feature has been quite useful, giving back 10+ GB of space (not including the space saved in the Snow Leopard install)!
Code:
--hfsCompression
When copying files or extracting content from an archive,
if the destination is an HFS+ volume that supports compres-
sion, all the content will be compressed if appropriate.
This is only supported on Mac OS X 10.6 or later, and is
only intended to be used in installation and backup scenar-
ios that involve system files. Since files using HFS+ com-
pression are not readable on versions of Mac OS X earlier
than 10.6, this flag should not be used when dealing with
non-system files or other user-generated content.
After testing it out on some files I found that it does indeed apply HFS+ compression, although it seems that only files that meet certain conditions can have HFS+ compression applied to them. Regardless it can still create HUGE space savings. And there shouldn't be any issues as long as you don't mount a disk with HFS+ compressed files directly using a pre-10.6 system, because the files are decompressed when copied (so to use a compressed file on another computer without Snow Leopard, you simply need to make a copy of the file).
After freeing up several GBs from my Applications folder I was curious exactly how much space I had saved, but I ran across a problem: the Finder still reported exactly the same sizes. The Finder definitely reported more available space on the disk, but there wasn't anything I could find that would tell me the new size of my Applications folder; everything still reported the sizes that the files were before compression.
Anyway, to make a long story short I wrote my own command line utility (afsctool) for identifying HFS+ compressed files and getting the sizes of them. Its output looks something like this:
Code:
$ afsctool -v /usr/local/bin/afsctool
/usr/local/bin/afsctool:
File is HFS+ compressed.
File size (uncompressed data fork; reported size by Mac OS 10.6+ Finder): 85372 bytes / 85 KB (kilobytes) / 83 KiB (kibibytes)
File size (compressed data fork - decmpfs xattr; reported size by Mac OS 10.0-10.5 Finder): 24417 bytes / 25 KB (kilobytes) / 24 KiB (kibibytes)
File size (compressed data fork): 24433 bytes / 25 KB (kilobytes) / 24 KiB (kibibytes)
Compression savings: 71.4%
Number of extended attributes: 0
Total size of extended attribute data: 0 bytes
Appoximate overhead of extended attributes: 536 bytes
Appoximate total file size (compressed data fork + EA + EA overhead + file overhead): 25376 bytes / 25 KB (kilobytes) / 25 KiB (kibibytes)
Code:
$ afsctool -v /System
/System:
Number of HFS+ compressed files: 118930
Total number of files: 141558
Total number of folders: 57257
Total number of items (number of files + number of folders): 198815
Folder size (uncompressed; reported size by Mac OS 10.6+ Finder): 4207439143 bytes / 4.59 GB (gigabytes) / 4.28 GiB (gibibytes)
Folder size (compressed - decmpfs xattr; reported size by Mac OS 10.0-10.5 Finder): 2443700774 bytes / 2.55 GB (gigabytes) / 2.38 GiB (gibibytes)
Folder size (compressed): 2523293328 bytes / 2.63 GB (gigabytes) / 2.45 GiB (gibibytes)
Compression savings: 40.0%
Appoximate total folder size (files + file overhead + folder overhead): 2708108395 bytes / 2.71 GB (gigabytes) / 2.52 GiB (gibibytes)
Edit: I've updated afsctool and added in place HFS+ compression for files and folders, just be warned that you should make a backup before attempting to use it as I haven't had a chance to extensively test it yet.
Edit 2: The in place compression seems not to have any significant issues, but if you are compressing anything important then always include the -k flag just to be safe.
Download afsctool (source included) here:
http://web.me.com/brkirch/brkirchs_Software/afsctool/afsctool.html
Let me know what you think; for me this HFS+ compression feature has been quite useful, giving back 10+ GB of space (not including the space saved in the Snow Leopard install)!