The last time I tried Linux's UFS support was around the first 2.4 releases, and IIRC, it trashed my file-systems even in read only mode (sounds strange, I know, but this is what I remember). Today I decided try again to verify if the situation is better now.

The first step has been to install NetBSD on another disk, using UFSv2, to have a test partition with a bunch of files. Then, I've installed Linux. Which one? I went for Debian because this was my distribution of choice back to the days when I used Linux ;-) But, in fact, there is another reason behind this choice. It has been ages since I compiled a Linux kernel, and I didn't want to loose too much time relearning the process (yet). Debian makes compilations very easy (providing you a ready-to-install package with your custom kernel), and it comes with a default configuration that is suitable for most uses (extremely modularized). Note that I installed unstable with a 2.4.26 kernel.

Anyway, after all these installations, it was time for the test. Issued mount -t ufs -o ro,ufstype=44bsd /dev/hda7 /mnt and the command failed. Oh... what a pity. Of course it didn't work, because the 44bsd type is addressed to UFSv1 file-systems.

So "let's try with a kernel from the 2.6 series", I thought. All I needed was: apt-get install kernel-image-2.6.9-1-k7; isn't this easy? After rebooting, I wondered how could I check if UFSv2 was supported (and which could be the string to pass to the ufstype parameter). man mount didn't give me any clue (outdated manual pages, you know), so I used a more rudimentary method: strings ufs.ko and searched through all lines until I found one with the list of supported types. What a surprise! ufs2 is there! Attempted to mount... list directories... view files... all correct! I can safely read my files from Linux!

Hmm... but I would like to write to the file-system too. So I removed the ro option and got a warning saying that the kernel was built without UFS write support (because it's still marked as experimental). Ew, time to rebuild the kernel. Started by reading the README.gz file included in the kernel-package package, configured the kernel with only three custom changes changes and built it. Not very difficult :)

Unfortunately, after rebooting, I couldn't get read-write support. Simply put, the UFSv2 support is still read-only, and there is no write functionality (even with the experimental code compiled in). I hope that the ufs-linux project keeps up the good work and add this feature.

But still not happy, I repeated the same process, this time creating a UFSv1 file-system. To my surprise, Linux can read it without problems (using the 44bsd subtype), but write support is very frustrating. One of the tests just made the kernel enter an infinite loop. In another one, I was able to create directories, but they always appeared empty, no matter what I put in them.

Given the results, I'll keep UFSv2. I expect that write support will be added "soon" (I can wait), and I guess that 44bsd won't be fixed (it hasn't been for years). (And no, no time nor enough knowledge to "fix-it-myself".)

Oh, and in case you are wondering why I don't keep my home tree in a Ext2 partition (as I used to when I was a BSD newbie), which can be perfectly read from the *BSDs... well, there are basically two reasons. On the first hand, Ext2 performance under NetBSD is very poor. On the other hand, I don't trust Ext2 very much; I used to loose big amounts of data after power outages, a thing that has never happened to me with UFS.

Go to posts index

Comments from the original Blogger-hosted post: