MacBook Pro with ZFS User Directories

Requirements

• Two Macs
• The ZFS “target” one being an Intel Mac (might work on PPC, but performance tends to suck in my tests)
• The second being any Mac
• Both must have firewire (you can get around this requirement with external SATA/IDE docks, but that is an option left to the reader)
• Nothing to lose… cause you will likely be erasing the destination machines hard drive

Partition the drive

If you only have one hard drive in your laptop or desktop, you will need to partition it into at least two partitions.
On my MacBook Pro, I have made the internal 320GB into four.
• Mac OS X System & Boot
• ZFS
• Vista
• 9GB for the Mac OS X Install DVD in case of emergency

Once the first stage of installation is complete don’t let it restart and finish the setup process just yet. Instead let the machine restart, but go into target mode by holding down the “T” key until the FireWire logo is displayed.

Prepare the target machine

Copy over the current version of the ZFS files to the new machines HD.

cd /Volumes/{BOOT DRIVE OF MBP}
mkdir ZFS-119
cd ZFS-119/
tar xfvz ~/Downloads/zfs-119bin.tgz

As I hate to modify commands that I already know to work, let us chroot into the folder that “is” the new computer.

sudo chroot /Volumes/{BOOT DRIVE OF MBP}
cd ZFS-119/

Now install the read/write ZFS build. These should always be the same commands as you should find on the wiki. (I’ll try and keep these updated)

sudo cp build/Leopard_Release/zfs /usr/sbin/zfs
sudo cp build/Leopard_Release/zpool /usr/sbin/zpool
sudo cp build/Leopard_Release/libzfs.dylib /usr/lib/libzfs.dylib
sudo /bin/rm -rf /System/Library/Filesystems/zfs.fs /System/Library/Extensions/zfs.kext
sudo cp -R build/Leopard_Release/zfs.fs /System/Library/Filesystems/zfs.fs
sudo cp -R build/Leopard_Release/zfs.kext /System/Library/Extensions/zfs.kext
sudo chown -R root:wheel /System/Library/Extensions/zfs.kext
sudo chown -R root:wheel /System/Library/Filesystems/zfs.fs
sudo chown -R root:wheel /usr/sbin/zpool
sudo chown -R root:wheel /usr/sbin/zfs
sudo chown -R root:wheel /usr/lib/libzfs.dylib

Setting up the zpool and filesystems

Run the diskutil command below and make note of what drive and partition you are wanting to make the ZFS zpool with.

diskutil list

Replace the {NN} and {N} with the correct numbers.

sudo diskutil eraseVolume ZFS %noformat% /dev/disk{NN}s{N}

Create the zpool. I don’t want this new filesystem to mount anywhere just yet, so the mount point will be none for now. I think we do this to prevent the “automount on create”, but we shall set the true mount point in the next step.

zpool create -m none Dawson /dev/disk{NN}s{N}

Set the compression, mount point, and optionally then create your home directory. You don’t have to create a new home filesystem, I just do for greater flexibility.

sudo zfs set compression=on Dawson
sudo zfs set mountpoint=/Users Dawson
zfs create Dawson/jason

Finally, export the pool.

sudo zpool export -f Dawson

Issues & Notes

• There seems to be some oddness when you then continue the install process where some directories aren’t created automatically? I don’t know. Once I created them I haven’t had any issues.
• I don’t know yet what happens if you try and start from the Leopard install DVD which only has read only drivers for the older versions of zfs and zpools. I upgraded mine to the latest versions, but didn’t include those steps above just in case it causes issues down the road.
• So far so good, but there are issues I think. Mostly with emptying the trash, as well as the “all filesystems are named after the root filesystem” strangeness.