Upgrading from Nevada to OpenSolaris the easy way

The OpenSolaris installer is simple and quick to use but it has one significant drawback - it gives you no control of how your disk is laid out. I needed to upgrade my Toshiba R500 laptop from Nevada to OpenSolaris and I had the disk set up with 3 VTOC slices - 2 ZFS pools, one for the root pool and one for a data pool - home dirs, installed software and so on. The final slice is a raw swap device. A straightforward install would have overwritten the entire disk, so I wanted to find a way of installing without clobbering everything. Ed Pilatowicz outlined some time back how you could do a hand-crafted OpenSolaris install to work around this, but I wanted to see if there was an easier way of achieving the same result with a more recent build of OpenSolaris.

My first attempt was to use the OpenSolaris 2009.06 livecd to install OpenSolaris onto a 8Gb USB stick so I could boot off that and have a poke around. That was fairly straightforward, but when I tried importing the existing root pool from the disk I hit a problem - the Nevada build I was running was onnv_124, but 2009.06 was based on 111b and the ZFS format has been rev'd since then so the pool wouldn't import. I then tried to update my USB image to build 125, but the stick wasn't big enough for the 125 BE and the 'pkg image-update' failed. Drat.

Third try was to pull a build 125 livecd image from the internal repo, boot off that and do a fresh install onto the USB stick. As before that worked fine so I rebooted off the USB stick. When I originally installed Nevada I had renamed the root pool from 'rpool' to 'solaris', so I typed 'zpool import solaris' and my existing boot pool on the drive appeared - looking good so far. Next thing to try was 'beadm list', and not only did my OpenSolaris BE show up, but the Nevada BEs on the drive also appeared. Ok, so far so good.

Now I needed to try to get an OpenSolaris BE onto the disk root pool. Worst case I could just blow away the existing root pool on the drive and create an OpenSolaris BE in that, but I wanted to see if I could preserve the existing Nevada BEs if possible. As Nevada and OpenSolaris are very similar and as I was using Nevada 124 and OpenSolaris 125 I figured there was a reasonable chance that if I could just get an OpenSolaris BE into the existing root pool I'd be able to get it into the grub config so I could boot it, even if that meant some hand-editing of menu.lst.

The easiest way to get an OpenSolaris BE onto the disk was to use 'beadm create'. Normally that creates the new BE on the same volume as the source BE, but there's a '-p' flag that allows you to specify an alternate pool to do the install into, which in my case was the existing 'solaris' pool on my disk - so, 'beadm create -p solaris on_125'. That seemed to work OK, so with everything appropriately crossed I typed 'beadm activate on_125' and rebooted. When Grub appeared, my new OpenSolaris BE was listed along with my existing Nevada ones, and both the OpenSolaris and Nevada BEs work just fine. Huzzah!

So, to summarise, here are the steps:

  • Make sure you are running a recent Nevada release
  • Obtain an OpenSolaris LiveCD image that is close to or the same as your Nevada release
  • Install OpenSolaris onto a spare disk - a 8Gb or larger USB memory stick or a USB disk will do fine
  • Boot into the OpenSolaris image
  • Import your existing root zpool - see below why this many not be as easy for you as it was for me
  • Create a new OpenSolaris BE on the imported pool with 'beadm' using the '-p' flag to specify the imported pool
  • Activate the new BE
  • Reboot, and you should see your existing Nevada BEs along with the OpenSolaris one which will be booted by default

Some caveats - this is clearly unsupported, don't be surprised if it doesn't work with a different mix of OpenSolaris and Nevada builds and don't blame me if it fries your machine. Also, this isn't a true upgrade in that you end up with a new OpenSolaris install and you'll have to manually migrate the necessary config from your Nevada BE into the OpenSolaris one - but at least you'll still have your Nevada BE :-) The final thing is I definitely got lucky - When I originally installed I'd renamed my Nevada root pool from 'rpool' to 'solaris'. That meant I could import it without it conflicting with the name of the root pool on the USB stick. If I hadn't done so I'd have to have imported it using the pool identifier and a new name. That would almost certainly have invalidated the contents of the menu.lst on that drive, so unless beadm fixed it up for me I'd have had to do some surgery to fix it up. If you try this yourself and figure out what's needed, please drop me a comment to let me know what you did :-)

Categories : Solaris, Tech, Work