ZFS adventures
For some time now I'm running MacOS X 10.6.2 with a 64-bit kernel and MacFUSE installed. However, after one of the last updates this setup stopped working - well, it shouldn't have worked anyway. Which is a pity, because now the TrueCrypt layer on top of MacFUSE doesn't work, which means ZFS cannot access its volume.
So, what now? Hacking MacFUSE would be the Right Thing to do, something I won't be able to deliver. So I went on to set up a much more fancy installation:
- install VirtualBox and attach the disk as a raw blockdevice
- within VirtualBox, install TrueCrypt and zfs-fuse
- once the VM has access to data, export it via Samba, so that the host machine can access it
We start by registering our MacOS data partition to VirtualBox. We're setting the disk immutable for now as we don't want to let our guest VM to make any changes to it. And we're also
chmod'ing
the disk to 0644
, so that we're able to read it (and thus use it in Virtualbox). Mode 0640
and a dedicated group would be more elegant, yes.
$ sudo VBoxManage internalcommands createrawvmdk -filename disk02-raw.vmdk \ -rawdisk /dev/disk0s5 -register $ VBoxManage modifyhd -type immutable disk02-raw.vmdk $ sudo chmod 0644 /dev/disk0s5We're using a Debian/testing (amd64) as a guest VM and we'll compile TrueCrypt (with wxWidgets as a dependency):
$ apt-get install libfuse-dev fuse-utils dmsetup pkg-config samba git-core scons\ libaio-dev libattr1-dev libacl1-dev libz-dev libz-dev libfuse-dev libssl-dev bzip2 $ wget http://prdownloads.sourceforge.net/wxwindows/wxWidgets-2.8.10.tar.bz2 \ -O - | tar -C /usr/local/src -xjf - $ cd /usr/local/src/wxWidgets-2.8.10 $ ./configure --prefix=/opt/wxWidgets && make && make install $ mkdir /usr/local/include/pkcs11 $ cd /usr/local/include/pkcs11 $ for i in pkcs11 pkcs11f.h pkcs11t.h; do wget ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-11/v2-20/$i; done $ cd /usr/local/src/truecrypt-6.3a-source $ make NOGUI=1 WX_ROOT=/usr/local/src/wxWidgets-2.8.10 wxbuild $ PKCS11_INC=/usr/local/include/pkcs11 make NOGUI=1 WXSTATIC=1 $ mv Main/truecrypt /usr/local/sbin/Now we should be able to access our Truecryt volume:
$ truecrypt --text --filesystem=none /dev/hdc $ file -s /dev/mapper/truecrypt1 /dev/mapper/truecrypt1: Macintosh HFS Extended version [...]We can set up ZFS now:
$ git clone http://rainemu.swishparty.co.uk/git/zfs $ cd zfs/src && scons && scons install install_dir=/opt/zfs-fuse-rainemu $ export PATH=$PATH:/opt/zfs-fuse-rainemu $ zfs-fuse --pidfile /var/run/zfs-fuse.pid $ zpool import -d /dev/mapper -a -f $ zfs list NAME USED AVAIL REFER MOUNTPOINT tank0 135G 16.4G 135G /tank0Now we will be able to export
/tank0
via Samba (or NFS, if needed) and can access it from our host machine as well. While surely not as speedy as local HFS+ (although I haven't actually measured yet), it's enough for watching movies or storing pictures. And apparently ZFS on Linux is much more stable and tested than on MacOS X.
Well, to be honest, with this setup I could now even replace Truecrypt with dm-crypt and zfs with a stable filesystem, but that wouldn't be so much fun, eh? :-)