Mounting *BSD partitions/slices on Linux

Some times it’s necessary to work with UFS (the default filesystem on FreeBSD, OpenBSD, NetBSD, etc.) from your linux box. Here I’ll explain how to do so by configuring your kernel in order to enable UFS read/write support. We’ll focus on FreeBSD.
Also, as you should know, FreeBSD uses its own hard disk partition scheme on your PC. It requires only one entry in the primary partition table of your disk and manages it similarly to DOS extended partitions, putting in its first sector a new partition table in BSD disklabel format. So we’ll enable support for reading these disklabels; otherwise we just will be able to mount the root ’slice’ of FreeBSD but not the partitions ‘inside’.
0. Preparing your kernel
You may already have support for UFS and BSD disklabel format, but I’ll assume that you have built your kernel by your self and/or don’t have those options enabled.
So, let’s get into the menu configuration of your kernel (I’m using Linux kernel 2.6.32):
make menuconfig
Now, we are going to activate these options:
-> Miscellaneous filesystems
<*> UFS file system support (read only)
[*] UFS file system write support
It’ll look like this:
Now, we’ll enable the FreeBSD disklabel support:
-> Partition Types
[*] Advanced partition selection
[*] PC BIOS (MSDOS partition tables) support
[*] BSD disklabel (FreeBSD partition tables)
It’ll look like this:
OK… with these options enabled we just need to compile our kernel and install it:
1. Looking for partitions names
When working with FreeBSD, the disks device names are like this: /dev/ad0s3a. But, as we are working with Linux, we’ll have the traditional /dev/sda* or /dev/hda* names. So, thanks to the FreeBSD Disklabel support that we’ve just added, we can do this in order to know the devices names:
You’ll get something like this:
8 0 244198584 sda
8 1 41624383 sda1
8 2 158497290 sda2
8 3 39076695 sda3
8 4 5000184 sda4
8 5 524288 sda5
8 6 4194304 sda6
8 7 5223424 sda7
8 8 524288 sda8
8 9 28610391 sda9
2. Mounting UFS
In order to mount a UFS partition you’ll need to type this (suppose /dev/sda7 is one of the *BSD partitions):
Of course, you can add an entry to your /etc/fstab file so the partition get mounted each time you boot your system:
That’s it. Let me know if you have any problem. And sorry for my English, I’m just learning
3 Comentarios | deja el tuyo


