Mounting UFS2 read/write on Linux

I recently had the need to mount an UFS2 (NetBSD) partition under GNU/Linux, and while this is surprising, a standard Linux distro, Debian in my case, is not able to mount it in read/write mode.

I came across this project https://github.com/DanielO/fuse-ufs2 which has basic UFS2 read/write support. It is not very stable, I made it crash a couple of times while using vim on the mounted partition, but it does support simple operations like cp, rm and such.

Here’s how to build and use it under Debian Wheezy:

Comment out the __st_ino. Do the same operation for fuse-ufs/op_readdir.c

Replace xvda3 with the actual partition you need to mount.

You can now access your UFS2 partition :)