FreeBSD has a FUSE kernel module (Filesystems in User Space, I think), which allows it to use other filesystems – in user space – than it would normally do. Today it saved my bacon.

I do a lot of development work on a FreeBSD machine, with Linux as the target platform: that’s what you get (punishment?) for writing Linux installers, I guess. I have a handful of development and test VMs, all in VirtualBox, all with a ZFS volume (a reserved chunk of disk) as virtual disk. This normally gives me a lot of freedom in what I do with my VM’s HDDs: I can manipulate them easily from the host system. For testing purposes, that’s usually either zeroing them out or putting some partition table on them beforehand.

For whatever reason, today VirtualBox was giving me no end of trouble: as I boot each Linux VM, it gets a ton of I/O errors reading the disk, then ends up wedged somewhere in what looks like Plymouth in the guest, and then VBox tells me there was an error and gives up on the VM. It’s not physical I/O errors, since I can read all the data from the ZFS volume with dd, but how can I reach the data?

Enter FUSE, along with the port fusefs-ext2. Getting the software up-and-running (for an ad-hoc need-data-now session) took two steps. For good measure, I also installed e2fsprogs, which allows me to debug ext2 (and three, and four) filesystems from the host system as well.

# pkg install fusefs-ext2 e2fsprogs
# kldload fusefs

Voila!

My ZFS volumes are regular “disk” devices for all intents and purposes: GEOM (the disk subsystem) recognizes that they are GPT or MBR partitioned and puts per-partition (“slice” in BSD jargon) files under /dev/zvol as needed. So from the FreeBSD host I can do:

# fdisk /dev/zvol/zippy/scratch-2-medium
# fsck.ext4 /dev/zvol/zippy/scratch-2-mediump1
# fuse-ext2 /dev/zvol/zippy/scratch-2-mediump1 /mnt/tmp

To (respectively) double-check that the disk contains what I expect (fdisk tells me it’s a GPT disk, which I should have guessed from the p1 partition naming), fsck the filesystem (now that VirtualBox has flipped out over it), and mount it read-only (to get at the data I need).

To give this a teensy bit of a KDE spin, there’s also a port fusefs-smbnetfs which exposes Samba to FUSE, and which can then be used from Dolphin to FUSE-mount network shares – if I were a more avid Dolphin user, and less of a now-satisfied-I-can-get-my-data-from-the-command-line user, I might go looking if FUSE-mounting zvols in general can be done from Dolphin.