Mounting UFS partitions in Linux

My desktop machine at work is now running RHEL 4, but before that it ran FreeBSD 4.10 for a number of years and had three hard drives with UFS filesystems. When my box was converted over to Linux, I backed up the critical files on the main hard drive and then reformatted the drive with ext3. The other two hard drives with UFS filesystems sat there collecting dust, which was unfortunate, because I could use the disk space. Today, I decided to mount the UFS partitions and look through the files and see if there’s anything worth keeping, before formatting these drives for Linux and getting myself a whole lot more disk space. Here’s how I did it.

The first task was to build the UFS kernel module, as my kernel did not have UFS support built-in, nor did my install have the UFS kernel module available. Already, having installed the proper kernel-devel RPM a while back, I did the following:

$ uname -r
2.6.9-34.0.2.ELsmp
$ rpm -qa | grep kernel-devel
kernel-devel-2.6.9-34.0.2.EL
$ cd ~/rpm/BUILD/kernel-2.6.9/linux-2.6.9
$ make menuconfig
$ make modules
$ make modules_install
$ depmod
$ sudo modprobe ufs

At this point, I had built the UFS kernel module and loaded it. Now it was time to mount the filesystems.

$ sudo mkdir /mnt/hdc1 /mnt/hdd1
$ sudo mount -t ufs -o ufstype=44bsd,ro /dev/hdc1 /mnt/hdc1
$ sudo mount -t ufs -o ufstype=44bsd,ro /dev/hdd1 /mnt/hdd1

That’s it! I now had read-only access to my two UFS partitions. Now I have to look through these files and see what’s worth keeping.

2 thoughts on “Mounting UFS partitions in Linux

  1. Hi, Marc!

    I found your post while searching net for solution to my problem and I hope you will be able to help me. I’m quite new to Linux, now working with Ubuntu 7.04, I installed it as file/print server. The problem is that I had previously FreeBSD server and I want to copy data from ufs harddrive that was in that server. I tried to mount that hdd in Ubuntu and without luck therefore I think that might be there is no support for ufs in my kernel. How to find out what modules are compiled in kernel and if there is no ufs support then how to add it?

    I would apreciate your help very much!
    Thank you in advance!
    Rauls

  2. Hi Marc,

    I’m trying to compile the UFS module for RHEL 4, running 2.6.9-42.0.3.ELsmp, but it isn’t working. When I run ‘make modules’, I get the following output:
    CHK include/linux/version.h
    CHK include/asm-x86_64/offset.h
    make[1]: *** No rule to make target `arch/x86_64/kernel/../../i386/kernel/microcode.s’, needed by `arch/x86_64/kernel/../../i386/kernel/microcode.o’. Stop.
    make: *** [arch/x86_64/kernel] Error 2

    Do you have any tips on how to get this working? I’m running from /usr/src/kernels/2.6.9-42.0.3.EL-smp-x86_64.

    Thanks,
    S. Chen

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>