Wednesday, July 14, 2010

How to enable ZFS on Debian GNU/kFreeBSD

IMPORTANT: things are much simpler now, see my newer post about ZFS

I've been recently playing a bit with this system that is currently in development (Debian GNU/kFreeBSD). My main interest in it is ZFS support, but by default it turns out ZFS isn't supported at all :-(

ZFS has two parts, a kernel module and two utilities (zpool and zfs). It seems Debian GNU/kFreeBSD has kernel support, so I tried to make it work by copying the missing utilities over from FreeBSD. The utilities have a lot of library dependencies, so I copied those too. Then I would have a working zpool, but unexpectedly the kernel panics when using it:

$ zpool create mypool da1
panic: stack overflow detected; backtrace may be corrupted
cpuid = 0
Uptime: 1m10s
Cannot dump. Device not defined or unavailable.
Automatic reboot in 15 seconds - press a key on the console to abort

Very disappointing!

I'm no kernel developer and have no idea how to fix this, but I don't give up. I figured that since ZFS works on FreeBSD, it may be a problem with the kernel in Debian. So I copied the ZFS module (zfs.ko) from FreeBSD and tried again. This time it works! I used Debian GNU/kFreeBSD to create a pool, filled it up with files, adjusted settings, etc.

I'm looking forward to using ZFS as a replacement for RAID in webhosting environment. My next goal is to put the root filesystem in ZFS so that the system can boot from it (separate partition is too much maintenance).

Finally, I wrote a small script to make these steps reproducible. You can use it if you want to setup ZFS on Debian GNU/kFreeBSD yourself.

No comments:

Post a Comment