View previous topic :: View next topic |
Author |
Message |
daff Apprentice
Joined: 02 Jul 2003 Posts: 232 Location: Vienna, Austria
|
Posted: Wed Aug 11, 2004 3:21 pm Post subject: Mini-Mini-Howto: Mount FreeBSD Filesystems (UFS1 and UFS2) |
|
|
A very short Howto on mounting UFS partitions. FreeBSD, OpenBSD and NetBSD use the UFS file system and lay out the disk differently from Linux. I've seen a lot of posts that all ask more or less the same things and describe the same problems.
These problems were
- When trying to mount a UFS partition mount would bail with an error message like the following:
Code: |
mount: wrong fs type, bad option, bad superblock on /dev/hdb1,
or too many mounted file systems
|
Linux would only see the first partition on the BSD disk, i.e. only the BSD / partition, no other partitions would be available (i.e. no BSD /usr, no BSD /var, etc.)
Here's how I solved it with/for FreeBSD. This was done on a gentoo-dev-sources 2.6.7-r12 machine.
Description of FreeBSD disk layout
What is known as a partition under Linux is called a slice under FreeBSD. Such a slice holds a set of (FreeBSD) partitions (which are created by applying a BSD disklabel). These partitions are formatted with the UFS file system and get mounted under /, /usr, /var, and so on.
When FreeBSD occupies the whole disk then there's only one slice (almost as big as the disk itself). Using Linux's fdisk on that disk shows only the slice, not the partitions within the slice.
FreeBSD names the devices thus (for IDE drives):
/dev/ad0 -- The whole disk
/dev/ad0s1 -- The first slice on the first disk
/dev/ad0s1a -- The first partition on the first slice on the first disk
/dev/ad0s1b -- The second partition on the first slice on the first disk
...
/dev/ad4s2f -- The sixth partition on the second slice on the fourth disk
FreeBSD also follows some tradition on which partition gets which name. Suppose we work on the first disk and the first slice. Typically the / partition is /dev/ad0s1a, /var gets /dev/ad0s1e and /usr gets /dev/ad0s1f.
There are two types of UFS for BSD. UFS1 is used in FreeBSD 4-STABLE as the default, UFS2 became default as of FreeBSD 5.1. Both seem to be supported in recent 2.6 kernels.
See here (FreeBSD handbook: pre-install tasks), here (FreeBSD handbook: allocating disk space), here and here for further information.
BSD/UFS disks on Linux
Linux doesn't know about slices. The BSD partitions are represented just like any other partition types. So /dev/ad0s1a under FreeBSD becomes /dev/hda1 under Linux, /dev/ad0s1f is /dev/hda8 and so on. Linux only sees partitions other than /dev/ad0s1a if the kernel supports BSD disklabels (next section).
Preparing the kernel for UFS and BSD disklabels
Activate UFS support:
Code: |
Filesystems -> Miscellaneous filesystems ->
<*> UFS file system support (read only)
|
Then allow for BSD disklabels:
Code: |
Filesystems -> Partition types ->
[*] Advanced partition selection
[*] PC BIOS (MSDOS partition tables) support
[*] BSD disklabel (FreeBSD partition tables) support
|
Recompile the kernel, install it and reboot.
Code: |
# make
# mount /boot
# cp arch/i386/boot/bzImage /boot/kernel
# reboot
|
Mounting
Depending on whether your FreeBSD partitions are of type UFS1 or UFS2 you need to apply different mount options. ufstype=44bsd is for UFS1, ufstype=ufs2 for UFS2.
A FreeBSD / partition (/dev/ad0s1a) of type UFS1 would be mounted thus:
Code: |
# mount -r -t ufs -o ufstype=44bsd /dev/hda1 /mnt
|
This tells mount to mount the partition read-only and apply the mount option ufstype=44bsd to tell the kernel it is of type UFS1.
Code: |
# mount -r -t ufs -o ufstype=44bsd /dev/hda8 /mnt/usr
|
This would mount the FreeBSD /usr partition on /mnt/usr.
Notes
I only have disks of type UFS1 so I can't verify that it is possible to mix UFS1 and UFS2 mounts. For example the default setup under FreeBSD 5.1 onwards is to create a UFS1-type / partition and UFS2 partitions for everything else (/var, /usr, ...).
Theoretically it should be possible to do this:
Code: |
# mount -r -t ufs -o ufstype=44bsd /dev/hda1 /mnt
# mount -r -t ufs -o ufstype=ufs2 /dev/hda8 /mnt/usr
|
As said, I can't verify that but it seems reasonable.
If you find any errors or mishaps in this Mini-howto please point them out. _________________ Instead of asking why a piece of software is using 1970s technology,
start asking why software is ignoring 30 years of accumulated wisdom.
Last edited by daff on Wed Apr 27, 2005 6:08 pm; edited 1 time in total |
|
Back to top |
|
|
Moloch Apprentice
Joined: 17 Mar 2003 Posts: 293 Location: Albuquerque, NM, US
|
Posted: Wed Aug 11, 2004 6:27 pm Post subject: |
|
|
Thanks! Although I could have used this howto 4 weeks ago. |
|
Back to top |
|
|
dob Apprentice
Joined: 04 Oct 2002 Posts: 199 Location: S.L.P.
|
Posted: Sat May 21, 2005 1:47 pm Post subject: |
|
|
nice one |
|
Back to top |
|
|
isaacpeel n00b
Joined: 27 Jun 2005 Posts: 12
|
Posted: Mon Jun 27, 2005 6:01 pm Post subject: RE:Mini-Mini-Howto: Mount FreeBSD Filesystems (UFS1 and UFS) |
|
|
I've followed your mini how-to and am still unable to mount my ufs drive. I get the following output:
#mount -r -t ufs -o ufstype=44bsd /dev/hdc1 /music
mount: unknown filesystem type 'ufs'
I have the following two lines in my kernel config file
CONFIG_UFS_FS=y
CONFIG_UFS_FS_WRITE=y (note: I've tried it with out this one too)
Any ideas? I'm new to linux, just switching over from freeBSD. Is there a way I can check to see if these new kernel options were installed correctly? |
|
Back to top |
|
|
isaacpeel n00b
Joined: 27 Jun 2005 Posts: 12
|
Posted: Mon Jun 27, 2005 6:48 pm Post subject: |
|
|
Pay me no mind I've figured it out. Thanks for the how-to. |
|
Back to top |
|
|
PoUaScAiLLe n00b
Joined: 17 Aug 2005 Posts: 1
|
Posted: Wed Aug 17, 2005 8:54 am Post subject: |
|
|
Thx for this how to very usefull for me:D _________________ http://www.vakarm.net |
|
Back to top |
|
|
Gnux n00b
Joined: 14 Aug 2003 Posts: 38
|
Posted: Sun May 28, 2006 9:10 pm Post subject: |
|
|
Nice tip, just one addenda:
Code: | mount -t ufs -o ufstype=44bsd etc... |
does not work for me with a freebsd 6.0... To mount this block I have to type:
Code: | mount -t ufs -o ufstype=5xbsd etc... |
But this is not very practicable (a swap block between the two (in ext2fs for ex) worth it really much more) |
|
Back to top |
|
|
kwisatz_haderais Tux's lil' helper
Joined: 28 Sep 2004 Posts: 143
|
Posted: Tue Jul 04, 2006 10:22 am Post subject: |
|
|
thanks for the howto, however... doesn't really work for me
Quote: | usb 1-1: new high speed USB device using ehci_hcd and address 8
usb 1-1: configuration #1 chosen from 1 choice
scsi1 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 8
usb-storage: waiting for device to settle before scanning
Vendor: Maxtor Model: OneTouch II Rev: 023g
Type: Direct-Access ANSI SCSI revision: 04
SCSI device sda: 586114704 512-byte hdwr sectors (300091 MB)
sda: Write Protect is off
sda: Mode Sense: 24 00 00 00
sda: assuming drive cache: write through
SCSI device sda: 586114704 512-byte hdwr sectors (300091 MB)
sda: Write Protect is off
sda: Mode Sense: 24 00 00 00
sda: assuming drive cache: write through
sda: sda1
sda1: <bsd: >
sd 1:0:0:0: Attached scsi disk sda
usb-storage: device scan complete
|
a command like
Code: | mount -r -t ufs -o ufstype=ufs2 /dev/sda /mnt/tmp/
|
results in: Quote: | ufs_read_super: bad magic number |
although it says sda1 in dmesg, there's no such device in /dev
sda is the only one.
The hdd works on my freebsd server though... |
|
Back to top |
|
|
mofa n00b
Joined: 20 Jul 2006 Posts: 11
|
Posted: Sat Oct 21, 2006 9:56 am Post subject: same problem |
|
|
i have the same problem with my firewire hd.
kwisatz_haderais wrote: | thanks for the howto, however... doesn't really work for me
Quote: | usb 1-1: new high speed USB device using ehci_hcd and address 8
usb 1-1: configuration #1 chosen from 1 choice
scsi1 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 8
usb-storage: waiting for device to settle before scanning
Vendor: Maxtor Model: OneTouch II Rev: 023g
Type: Direct-Access ANSI SCSI revision: 04
SCSI device sda: 586114704 512-byte hdwr sectors (300091 MB)
sda: Write Protect is off
sda: Mode Sense: 24 00 00 00
sda: assuming drive cache: write through
SCSI device sda: 586114704 512-byte hdwr sectors (300091 MB)
sda: Write Protect is off
sda: Mode Sense: 24 00 00 00
sda: assuming drive cache: write through
sda: sda1
sda1: <bsd: >
sd 1:0:0:0: Attached scsi disk sda
usb-storage: device scan complete
|
a command like
Code: | mount -r -t ufs -o ufstype=ufs2 /dev/sda /mnt/tmp/
|
results in: Quote: | ufs_read_super: bad magic number |
although it says sda1 in dmesg, there's no such device in /dev
sda is the only one.
The hdd works on my freebsd server though... |
|
|
Back to top |
|
|
gohmdoree Guru
Joined: 12 Oct 2004 Posts: 533
|
Posted: Fri Dec 27, 2013 7:46 pm Post subject: thank you |
|
|
Thanks for this mini howto. helped me a lot. |
|
Back to top |
|
|
|