A GRUB Configuration for Multiple Solaris Instances

In an earlier article I suggested that it might be possible to have more than one Solaris instance on a system. There are several ways that this can be done, some more supported than others.

Let's start with the supported method - Live Upgrade. Live Upgrade is one of the most useful features in Solaris, and this is the recommended method of maintaining multiple Solaris instances. You get the benefit of being able to share all of your data across all of your OS instances and recovery from upgrades is simple. And did I mention that this is the only supported method ?

It is quite possible that this experiment will take us well outside the design parameters of Live Upgrade, so let's consider some other possibilities.

Platform virtualization software such as VMware would do the trick, but we've placed a constraint of zero cost, and I'm not ready to give up - not yet. The Xen Project shows tremendous promise, but is still early days in development. So let's keep looking.

What does Solaris really require ? A single primary disk partition. That's it. Well, not exactly - there is an additional requirement that it be the only Solaris partition (id=0xbf). I notice that in our disk layout we had 2 available partitions, so if we can play games with partition IDs then maybe we can make this work.

This is where the order of OS installation became important. One feature of GRUB as bootloader is the ability to change partition IDs dynamically. We will use this feature to hide one Solaris instance from the other one. Let's look at how this plays in with the installation process.
  1. Install Windows XP from the vendor recovery discs. This creates one large partition with the Windows bootloader in the Master Boot Record (MBR) and in the boot sector of the first partition. At this point you don't may not notice the significance of this, but you will shortly.
  2. Resize the single NTFS file system (and associated partition) and create the remaining partitions as listed in our table.
  3. Install Solaris 10 3/05. Now we have the Solaris bootloader in the MBR and in the boot sector of the second primary partition. The Solaris bootloader supports chaining which allows you to boot both of the operating systems you have installed so far. It does not support chaining to a logical partition (in the extended partition) so this is as far as we will go with the Solaris 10 bootloader.
  4. Install Fedora Core 4 (or the Linux distribution of your choice). Now we will have GRUB in the MBR as well as the boot sector for the Linux root partition, which is in the extended area. This is what lets us play with partition IDs so that you can fake out the Solaris installer to put your next OS instance in the proper place.
  5. Install Software Express for Solaris in the remaining primary partition. This will put the newboot bootloader in the boot sector of our new Solaris partition but will leave the Linux GRUB in the MBR. This is exactly what we want (for the moment - we will look at how to make use of the OpenSolaris bootloader - but that's another article for a later day).


The last factor of this equation is the GRUB configuration file. This will be introduced in step 4, which will make step 5 possible. For our example configuration, the GRUB configuration file /boot/grub/menu.lst looks like
default=0
timeout=5
splashimage=(hd0,5)/boot/grub/splash.xpm.gz
hiddenmenu

title Fedora Core (2.6.11-1.1369_FC4)
	root (hd0,5)
	kernel /boot/vmlinuz-2.6.11-1.1369_FC4 ro root=LABEL=/ selinux=0
	initrd /boot/initrd-2.6.11-1.1369_FC4.img

title Solaris 10
	parttype (hd0,1) 0x83
	parttype (hd0,2) 0xbf
	root (hd0,2)
	makeactive
	chainloader +1

title Software Express for Solaris
	parttype (hd0,2) 0x83
	parttype (hd0,1) 0xbf
	root (hd0,1)
	makeactive
	chainloader +1

title Windows XP
	rootnoverify (hd0,0)
	chainloader +1


Let's take a closer look at one of the Solaris stanzas to see what's happening.
title Solaris 10
	parttype (hd0,1) 0x83
This sets the ID of the second partition, aka (hd0,1), /dev/hda2, /dev/dsk/c0d0p2) to 0x83 which is a Linux file system. Not only will the current Solaris instance ignore it, but all other operating systems will think that it is proper data and leave it alone. This turns out to be very important for a Linux installer that might misinterpret other partition IDs and do something unexpected, like destroy the data.
	parttype (hd0,2) 0xbf
This sets the ID of our partition to 0xbf which is the new Solaris partition ID. It is now the only one of type 0xbf, so we have met all of our requirements. Very cool!
	root (hd0,2)
	makeactive
These two actions make our partition the active IDE partition which may be required for some of the Solaris 10 boot process.
	chainloader +1
Jump to the bootloader in the boot sector of our partition.

You would expect the stanza for the other Solaris instance to be similar, just swapping partition IDs - and you would be correct.

Why go to all this trouble ? Updates, specifically Fedora Core. At this point we are done with the Windows and Solaris configurations, but not with Fedora. Each kernel update will come with at least three new GRUB stanzas (the uniprocessor kernel, a Xen Dom0 kernel, and a DomU paravirtualized kernel). The RPM post-install scripts will modify /boot/grub/menu.lst, so it is much easier if we make this our primary bootloader.

Enough for now. Next time we'll actually do the first Solaris 10 3/05 installation and look at some of the post-install tasks that will make it easier for the frugal road warrior.

Technocrati Tags:
Comments:

very interesting information. Is it possible to have multiple instances of (open)solaris on the same disks, but everyone sharing the same /home partition?

Posted by gerard henry on January 24, 2006 at 03:49 AM CST #

Yes it is. Now that Solaris 10 1/06 (aka Update 1) is out I will be rebuilding my laptop to do exactly that. Update 1 makes this a lot easier with the inclusion of a GRUB based bootloader. Use one large Solaris partition and allocate several slices for root. You can adjust your GRUB configuration to use whichever boot environment you want. And if you are zone free, liveupgrade will be your friend.

I do remember having to convince the installer to preserve the old root, but not calling it /. I'll have to dig out some notes on that one.

There is one subtle thing that can cause you lots of frustration - GNOME configurations. If your Solaris instances have different versions of GNOME (ie OpenSolaris with a GNOME 2.12) then you might not be able to share your .gnome, .gconf directories. The format of the repository changes and the incompatibilities can cause all sorts of difficulties.

Posted by guest on January 28, 2006 at 02:54 PM CST #

Did you upgrade your laptop with the new grub boot loader? On my laptop where is solaris express nv_33 installed, i'm trying to install nexentaOS (opensolaris), but it fails. Trying to do as you: parttype (hd0,2) 0x83 parttype (hd0,1) 0xbf solaris grub said: parttype (hd0,2) 0x83 Error 30: Invalid argument

Posted by gerard henry on May 08, 2006 at 04:37 AM CDT #

Hey Gerard,
Yes I did upgrade to the GRUB based newboot. In fact I've completely rebuilt my laptop and have gone away from using separate partitions to house my Solaris instances. I gain a shared file system with links and file ownerships - but more importantly I've gained Live Upgrade. I'll post my new partition table in a couple of days - but Live Upgrade has made my OpenSolaris experience much much more pleasurable.

To your question, yes I did pop into command line grub and used parttype to change the partition id of several partitions. In fact I lost count and turned my entire extended partition into an unrecognizable blob. Fortunately I was able to get it back - using command line GRUB from Solaris.

Posted by Bob Netherton on May 25, 2006 at 03:00 PM CDT #

I'm working on an x4200 and have mirrored the disks as per doc 83605. When doing an upgrade we usually break the mirror and if anything goes wrong we boot back to the secondary disk after modifying the vfstab and system file for metadata info. The issue is I can't find a way to get it to boot off that secondary disk. I've tried BIOS settings and GRUB info but nothing. any help would be greatly appreciated. I do have a Sun case open but have conflicting info. Thanks

Posted by John Brooks on December 15, 2006 at 04:41 AM CST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Bob Netherton is a Principal Sales Consultant for the North American Commercial Hardware group, specializing in Solaris, Virtualization and Engineered Systems. Bob is also a contributing author of Solaris 10 Virtualization Essentials.

This blog will contain information about all three, but primarily focused on topics for Solaris system administrators.

Please follow me on Twitter Facebook or send me email

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today