Access to Solaris from Linux
Contents
Installation Stuff
When installing Solaris 10 or OpenSolaris 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 bf (Solaris):
Device Boot Start End Blocks Id System /dev/sda1 1 1034 8305573+ a5 FreeBSD /dev/sda2 1035 2251 9775552+ bf Solaris /dev/sda3 * 2252 2283 257040 83 Linux /dev/sda4 2284 19457 137950155 5 Extended /dev/sda5 2284 5445 25398733+ 8e Linux LVM /dev/sda6 5446 5713 2152678+ 82 Linux swap /dev/sda7 5714 19457 110398648+ 8e Linux LVM
The installer of Solaris finds the partition of type bf and you can create your slices within this partiton. While installing make sure that you use ufs as filesystem since the Linux kernel lacks support for zfs. Furthermore be sure that the bootloader is not to be installed in the MBR but in the Solaris partition's boot block.
When I installed Solaris on my Laptop I let the Solaris installer automatically slice my disk. This works fine for the installation. But later I ran into problems. The reason is that /var is way to small. You will notice this when you try to install additional software. It will soon fail. Since we didn't use Solaris Disk Suite (kind of LVM) resizing /var is not an option. The solution I found is to create a symbolic link:
Solaris# mkdir /export/home/var Solaris:/var# cd /var Solaris:/var# tar cBf - sadm | ( cd /export/home/var && tar xvpBf - ) Solaris:/var# rm -rf sadm Solaris:/var# ln -s /export/home/var/sadm sadm
/var/sadm is the location where Solaris stores all package related information.
2. Kernel Configuration
In order to be able to see our Solaris slices under Linux we need to configure our Linux kernel with Solaris (x86) partition table support:
root@tux# 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 we also need support for Solaris' filesystem type ufs.
Miscellaneous filesystems ---> + +-------------------------------------------------------------------+ + | | <M> UFS file system support (read only) | | | | [ ] UFS file system write support (DANGEROUS) | | | | [ ] UFS debugging | |
As we see write support is still marked as DANGEROUS.
A note on the kernel version: If you use SATA disk controllers you have to use a recent kernel (2.6.30 or higher). Otherwise you won't be able
to access slices higher than /dev/sda15! This is a stupid restriction of older Linux kernels - coming from the days where the Linux SCSI driver
was designed for real SCSI targets. In our example we need to go up to /dev/sda18. If we would use an older kernel Solaris'
/usr and /export/home filesystems could not be accessed from Linux!
Access the Solaris filesystem
First we should check our /etc/vfstab under Solaris, e.g. for the above example it might look as shown below:
Solaris# cat /etc/vfstab
#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot options
#
fd - /dev/fd fd - no -
/proc - /proc proc - no -
/dev/dsk/c1t0d0s3 - - swap - no -
/dev/dsk/c1t0d0s0 /dev/rdsk/c1t0d0s0 / ufs 1 no -
/dev/dsk/c1t0d0s6 /dev/rdsk/c1t0d0s6 /usr ufs 1 no -
/dev/dsk/c1t0d0s1 /dev/rdsk/c1t0d0s1 /var ufs 1 no -
/dev/dsk/c1t0d0s7 /dev/rdsk/c1t0d0s7 /export/home ufs 2 yes -
/devices - /devices devfs - no -
sharefs - /etc/dfs/sharetab sharefs - no -
ctfs - /system/contract ctfs - no -
objfs - /system/object objfs - no -
swap - /tmp tmpfs - yes -
Back at Linux we check the kernel messages for the Solaris disklabel:
root@tux# dmesg | grep solaris sda2: <solaris: [s0] sda13 [s1] sda14 [s2] sda15 [s3] sda16 [s6] sda17 [s7] sda18 [s8] sda19 >
If we compare this output with the /etc/vfstab of our Solaris installation, we can easily see what linux partiton name matches a Solaris Slice name:
/dev/dsk/c1t0d0s0
is/dev/sda13
is/
/dev/dsk/c1t0d0s6
is/dev/sda17
is/usr
/dev/dsk/c1t0d0s1
is/dev/sda14
is/var
/dev/dsk/c1t0d0s7
is/dev/sda18
is/export/home
This is all we need to know to add the Solaris filesystems to our /etc/fstab under Linux:
# Solaris
/dev/sda13 /solaris ufs ro,ufstype=sun 1 0
/dev/sda14 /solaris/var ufs ro,ufstype=sun 1 0
/dev/sda17 /solaris/usr ufs ro,ufstype=sun 1 0
/dev/sda18 /solaris/export/home ufs ro,ufstype=sun 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.
Solaris uses Grub as bootmanager. You might want to try to integrate the Solaris partition in your Linux' Grub confguration. However, since I use LILO as boot loader I could not test such a setup.
Assuming we use LILO as our primary boot manager we add a section like
#
# Solaris 10
#
other = /dev/sda2
label = Solaris
to /etc/lilo.conf and rerun lilo. The above entry creates a line 'Solaris' in LILO's boot menu, that in fact starts Grub as a second boot loader.
To get this to work make sure that under Solaris you don't use the master boot record for installing Grub.