How can I mount the FreeBSD UFS boot partition under Ubuntu in this setup:

  • a single HDD which contains
  • an MBR partition table which contains
  • some primary Linux partitions and an extended partition which contains
  • a Linux logical partition and a FreeBSD logical partition which contains
  • the FreeBSD disklabel (so the logical partition is the "slice") which contains
  • the FreeBSD boot (UFS) and swap partitions

Here is the MBR partitioning:

ubuntu$ sudo fdisk -l /dev/sda

Disk /dev/sda: 42.9 GB, 42949672960 bytes

255 heads, 63 sectors/track, 5221 cylinders, total 83886080 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0005d5af

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1953791      975872   83  Linux
/dev/sda2         1953792    11718655     4882432   83  Linux
/dev/sda3        11718656    13672447      976896   82  Linux swap /     Solaris
/dev/sda4        13674494    83884031    35104769    5  Extended
/dev/sda5        13674496    33204223     9764864   83  Linux
/dev/sda6        33206272    83884031    25338880   a5  FreeBSD

And here is the disklabel:

freebsd$ disklabel /dev/ada0s6
# /dev/ada0s6:
8 partitions:
#          size     offset    fstype   [fsize bsize bps/cpg]
  a:   48580592         16    4.2BSD        0     0     0
  b:    2097152   48580608      swap                    
  c:   50677760          0    unused        0     0     # "raw" part, don't edit

I can boot FreeBSD using the following /etc/grub.d/40_custom:

exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

menuentry "FreeBSD" {
    insmod part_bsd
    insmod ufs2
    set root="(hd0,msdos6,bsd1)"
    kfreebsd /boot/kernel/kernel
    set kFreeBSD.acpi_load=YES
    set kFreeBSD.hint.acpi.0.disabled=0
    set kFreeBSD.vfs.root.mountfrom=ufs:/dev/ada0s6a
    kfreebsd_loadenv /boot/device.hints

That way I can access the FreeBSD partition from grub2 with no problems. But Linux does not detect any BSD partitions:

ubuntu$ ls /dev/sda*
/dev/sda  /dev/sda1  /dev/sda2  /dev/sda3  /dev/sda4  /dev/sda5  /dev/sda6

Versions: Ubuntu 14.04 with kernel 4.2.0-27-generic on x86_64, FreeBSD 10.3 RELEASE amd64, both fresh installs.


A workaround is to calculate the offset of the BSD partition within the logical partition and use a loop device with offset:

mount -t ufs -o loop,offset=8192,ro,ufstype=ufs2 /dev/sda6 /mnt

Probably you have been confused by different harddisk naming convention in Linux and FreeBSD. From your output one can clearly see that Linux has detected your ufs partition and it is /dev/sda6. So, you just need to do the following

sudo modprobe ufs
sudo mount -t ufs -o ufstype=ufs2 /dev/sda6 /mnt
  • 2
    /dev/sda6 is the logical partition that serves as a FreeBSD slice and that contains the two FreeBSD partitions (which I hope Linux can detect and make available as /dev/sda7 and /dev/sda8). So your mount command does not work. – not-a-user Apr 12 '16 at 12:05
  • 2
    Linux /dev/sda6 is FreeBSD /dev/ada0s6 but I want to mount FreeBSD /dev/ada0s6a in Linux. – not-a-user Apr 12 '16 at 14:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.