If you've never heard of ZFS before, check out this good 5min screencast of some of the important features.
A brief google search revealed that there are several people using and developing ZFS for Mac. There is a Mac ZFS porting project at http://zfs.macosforge.org and I found a lot of good info at AlBlue's blog.
Some noteworthy info:
- The current ZFS port (build 119) is based on ZFS code that shipped with Solaris build 72
- It's currently not possible to boot Mac OS X from a ZFS filesystem
- Finder integration is not perfect yet - Finder lists a ZFS pool as an unmountable drive under devices
- There are several reports of kernel panics, most of which appeared in connection to the use of cheap external USB disks (I haven't experienced any)
- There are a bunch of minor issues, which I'm sure will eventually go away.
Install ZFSEven though MacOS X 10.5 comes with ZFS support, it's only a read-only support. In order to be able to really use ZFS, full ZFS implementation must be installed.
The installation is very simple and can be done by following these instructions: http://zfs.macosforge.org/trac/wiki/downloads. Alternatively, AlBlue created a fancy installer for the lazy ones out there.
Repartition DiskOnce ZFS is installed and the OS was rebooted, I could repartition the internal disk. If you are using an external hard drive, you'll most likely need to use
First let's check what the disk looks like:
$ diskutil list /dev/disk0 #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *298.1 Gi disk0 1: EFI 200.0 Mi disk0s1 2: Apple_HFS boot 297.8 Gi disk0s2Good, the internal disk was identified as
/dev/disk0and it currently contains an EFI (boot) slice and ~300G data slice/partition. Let's repartition the disk so that it contains two data partitions.
$ sudo diskutil resizeVolume disk0s2 40G ZFS tank 257G Password: Started resizing on disk disk0s2 boot Verifying Resizing Volume Adjusting Partitions Formatting new partitions Formatting disk0s3 as ZFS File System with name tank [ + 0%..10%..20%..30%..40%..50%..60%..70%..80%..90%..100% ] Finished resizing on disk disk0 /dev/disk0 #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *298.1 Gi disk0 1: EFI 200.0 Mi disk0s1 2: Apple_HFS boot 39.9 Gi disk0s2 3: ZFS tank 252.0 Gi disk0s3
Great, the disk was repartitioned and the existing data partition, which I call
boot, was resized into a smaller 40GB partition and the extra space was used to create a ZFS pool called
tank. Btw all the data on the
bootpartition was preserved.
Let's check my new pool:
$ zpool list NAME SIZE USED AVAIL CAP HEALTH ALTROOT tank 256G 360K 256G 0% ONLINE -
$ zpool status pool: tank state: ONLINE status: The pool is formatted using an older on-disk format. The pool can still be used, but some features are unavailable. action: Upgrade the pool using 'zpool upgrade'. Once this is done, the pool will no longer be accessible on older software versions. scrub: none requested config: NAME STATE READ WRITE CKSUM tank ONLINE 0 0 0 disk0s3 ONLINE 0 0 0 errors: No known data errorsThe warning above just means that a new ZFS storage format is available but is not used by the current pool. As far as I could find there are no benefits for upgrading to the new format on Mac, but if I did, I would lose compatibility with Macs that have only the read-only ZFS support.
Create FilesystemsSo now that the new pool exists, I can create a shiny new filesystem using a single command:
$ sudo zfs create tank/me3x $ zfs list NAME USED AVAIL REFER MOUNTPOINT tank 388K 252G 270K /Volumes/tank tank/me3x 19K 252G 19K /Volumes/tank/me3xTo configure this new filesystem as my home directory, I created a temporary admin account, logged in under this account and mounted the ZFS fs as /Users/me3x:
$ sudo mv /Users/me3x /Users/me3x.hfs $ sudo zfs set mountpoint=/Users/me3x tank/me3x $ sudo cp -rp /Users/me3x.hfs /Users/me3xThat's it. My Mac account now resides on a ZFS file system. Now I can finally enjoy all the benefits of using ZFS on my OpenSolaris box in my office as well as on my Mac. Bye bye HFS, I won't miss you!