Saturday, March 10, 2007

Mounting freeBSD partition under Linux

This is a note on how I accessing freeBSD ( exactly version 5.4 ) partition which use UFS filesystem's type under slackware 11.0 ( using linux kernel 2.6.18). First, I try to mount it with this command:
mount -t ufs /dev/hda3 /mnt

but I get a message:
mount: wrong fs type, bad option, bad superblock on /dev/hda3,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so

when I check dmesg | tail it show:
ufs was compiled with read-only support, can't be mounted as read-write

then I try to mount it using option ro (read only) :
mount -t ufs -o ro /dev/hda3 /mnt

but it still has a problem and a message like this appear:
You didn't specify the type of your ufs filesystem
mount -t ufs -o ufstype=sun|sunx86|44bsd|ufs2|5xbsd|old|hp|nextstep|nextstep-cd|openstep ...
WARNING Wrong ufstype may corrupt your filesystem, default is ufstype=old
ufs_read_super: bad magic number

next, try to pass an option ufstype=44bsd as it defined in manual mount:
mount -t ufs -o ro,ufstype=44bsd /dev/hda3 /mnt


not yet work, last chance using ufs2 as an entry of ufstype option:

mount -t ufs -o ro,ufstype=ufs2 /dev/hda3 /mnt

it works well but still in read only mode. Fine for me now, because I just trying to access a filesystem without modified it.


there is a message before, that ufs filesystem was compiled as read-only mode. I wonder if there is read-write mode. Then I check on kernel source tree using make menuconfig as if we try to compiling kernel. In UFS filesystem part (exactly in miscellaneous filesystem), there is an option that UFS can support write access but still flagged as DANGEROUS. maybe I can try it next time.

hope this helpful.