Access to BSD slices from Linux
Contents
Installation Stuff
When installing OpenBSD or FreeBSD together with Linux the easiest and painleast way is to create a primary partition under Linux (with fdisk or cfdisk) and set the partition ID to a5 (FreeBSD) or a6 (OpenBSD):
Device Boot Start End Blocks Id System /dev/hda1 1 1459 11719386 7 HPFS/NTFS /dev/hda2 1460 1463 32130 83 Linux /dev/hda3 1464 1829 2939895 a6 OpenBSD /dev/hda4 1830 9729 63456750 5 Extended
The installer of FreeBSD finds the partition of type a5 and you can create your slices within this partiton.
If you install OpenBSD, the installer will go straight into OpenBSD's fdisk program. The first screen is very
confusing. Type 'print' to get a human readable partition overview. You should see the partition you created under Linux as OpenBSD.
You can exit fdisk with or without writing changes to disk.
The installer will then go into OpenBSD's disklabel editor. You can create your BSD slices within the existing OpenBSD partition.
2. Kernel Configuration
In order to be able to see your BSD slices under Linux your Linux kernel must be configured for BSD disklabel support:
# make menuconfig
Partition Types ---> + +-------------------------------------------------------------------+ + | | [*] Advanced partition selection | | | | [ ] Acorn partition support | | | | [ ] Alpha OSF partition support | | | | [ ] Amiga partition table support | | | | [ ] Atari partition table support | | | | [ ] Macintosh partition map support | | | | [*] PC BIOS (MSDOS partition tables) support | | | | [*] BSD disklabel (FreeBSD partition tables) support | | | | [ ] Minix subpartition support | | | | [ ] Solaris (x86) partition table support | |
And obviously you also need support for BSD's filesystem type ufs.
Miscellaneous filesystems ---> + +-------------------------------------------------------------------+ + | | <M> UFS file system support (read only) | | | | [ ] UFS file system write support (DANGEROUS) | | | | [ ] UFS debugging | |
As you see write support is still marked as DANGEROUS.
Access the BSD filesystem
FreeBSD and OpenBSD actually don't use the same filesystem type. If you want to mount your OpenBSD filesystems under Linux put something like
# OpenBSD
/dev/hda15 /bsd ufs ro,ufstype=44bsd 1 0
/dev/hda17 /bsd/usr ufs ro,ufstype=44bsd 1 0
to Linux' /etc/fstab. For FreeBSD 'ufstype=ufs2' is used instead of 'ufstype=44bsd' :
# FreeBSD
/dev/sda8 /bsd ufs ro,ufstype=ufs2 1 0
/dev/sda10 /bsd/var ufs ro,ufstype=ufs2 1 0
/dev/sda11 /bsd/tmp ufs ro,ufstype=ufs2 1 0
/dev/sda12 /bsd/usr ufs ro,ufstype=ufs2 1 0
As mentioned before, write support is still marked as dangerous - to be on the safe side we add the read-only (ro) option.
If you don't know how your BSD slices show up in Linux, first check your fstab under BSD, e.g. for the above example it might look as below:
BSD# cat /etc/fstab
# Device Mountpoint FStype Options Dump Pass#
/dev/ad4s1b none swap sw 0 0
/dev/ad4s1a / ufs rw 1 1
/dev/ad4s1e /tmp ufs rw 2 2
/dev/ad4s1f /usr ufs rw 2 2
/dev/ad4s1d /var ufs rw 2 2
/dev/acd0 /cdrom cd9660 ro,noauto 0 0
Back at Linux you check the kernel messages for the BSD disklabel:
root@tux# dmesg|grep -w bsd sda1: <bsd: sda8 sda9 sda10 sda11 sda12 >
The Linux partitions are the same order as the BSD slices: sda8-ad4s1a (/), sda9-ad4s1b (swap), sda10-ad4s1d (/var), sda11-ad4s1e (/tmp), ad4s1f-sda12 (/usr).
LILO Configuration
Under Linux you add a section like
#
# BSD
#
other=/dev/hda3
label=BSD
to your /etc/lilo.conf and rerun lilo. The above entry creates a line 'BSD' in LILO's boot menu, that starts BSD's chain loader. This entry is valid for both OpenBSD and FreeBSD (and possibly for other BSDs aswell).