Solaris 10 & OpenSolaris p2p, p2v, v2p

Solaris has always been one of the easier OSes to move between machines. When we would try to boot Solaris on a newly prototyped SPARC machine (back in the day when I worked in the SPARC H/W org), we would install a Solaris image on an older SPARC machine, and then fix it up so that it could boot on the prototype. Once OBP could load unix, it usually took us a day or two to work through the H/W, FPGA, OBP, and Solaris bugs so we could get to multiuser login.

Now that we have zfs root, it's more difficult, and at the same time, much more powerful. zfs stores platform specific boot information in it's meta data which isn't easily accessed, making it more difficult. But, zfs supports live snapshots which makes it much more powerful.

With zfs, we can "easily move" the machine from one "machine" to another. This generally applies to S10 and Opensolaris, as long as it's running a zfs root.. You can go from a physical machine, VirtualBox guest, xVM guest, etc. to a different physical machine, VirtualBox guest, xVM guest, etc.

For an example, I thought I would share some tricks on how you can transform a x86 box running OpenSolaris to a VirtualBox guest without ever shutting down or rebooting the x86 box.

The first thing you want to do is boot a new VirtualBox guest with an OpenSolaris live install iso. You want to make sure that the zfs version in the install iso matches the zfs version on your x86 box.

Once you have booted the install iso, open a shell. Enable ssh, and then run format. Write down the disk your going to use (e.g. c4t0d0s0), then run fdisk from within format. Usually you will create a single disk partition for Solaris here.. Exit fdisk saving your changes.

Now partition your Solaris disk. Select the 0 partition, set the tag to "root" (without the quotes), and set the range from 1 to the last cylinder. Make sure partition 8 is set to 0 - 0 cylinders, then label the disk and exit format.

On your x86 box, write down your hostname and hostid info.

	: core2[1]#; hostname
        core2
	: core2[1]#; hostid
	05bdb9c2
	: core2[1]#; echo "hw_serial,0xa?B" | mdb -k
	hw_serial:
	hw_serial: 39 36 33 31 39 39 33 38 0 0
On your VirtualBox guest, update hostname and hostid to match your x86 system.
	root@opensolaris:~# hostname core2
	root@core2:~# hostid
	00041f55
	root@core2:~# echo "hw_serial/v 39 36 33 31 39 39 33 38 0 0" | mdb -kw
	root@core2:~# hostid
	05bdb9c2
	root@core2:~# 
Now, create the zfs root on the VirtualBox guest using the disk you saw in format. Make sure that you create the zpool on slice 0 (s0). If your moving multiple pools, you'll probably want to setup multiple pools on the guest now too.
   zpool create -R /a -f rpool /dev/dsk/c4t0d0s0
Back to the x86 system, snapshot the root pool, then send it to the opensolaris guest (which is 192.168.0.117 in my example). Do the same for all pools you want to move.
   zfs snapshot -r rpool@p2v
   zfs send -R rpool@p2v | ssh jack@192.168.0.117 pfexec /usr/sbin/zfs receive -dF rpool
Once this completes, if the x86 system is actively being used, you'll want to shut down the apps your using (e.g. databases, etc.), take a snapshot again, then do a differencing zfs send to do a final sync.

Back on the VirtualBox guest, lets finalize the disk. Set bootfs to the BE you want to boot.

   zpool set bootfs='rpool/ROOT/--your-bootfs--' rpool
On the VirtualBox guest, install grub
   /a/sbin/installgrub /a/boot/grub/stage1 /a/boot/grub/stage2 /dev/rdsk/c4t0d0s0
If your NICs are different, you need to update them. If you have hostname.--nic-- and dhcp.--nic-- files, update them to point to your new NIC(s). You may have neither. Or you may only have a hostname.--nic--. You may also have to update /a/etc/nwam/llp. For multiple BEs, don't forget to update the NICs in all the BEs you want to boot.
   devfsadm -r /a -i e1000g
   mv /a/etc/hostname.--oldnic-- /a/etc/hostname.e1000g0
   mv /a/etc/hostname.--oldnic-- /a/etc/dhcp.e1000g0
If your using the same IP, you may want to take your x86 box off the net now... Eject the CDROM and reboot your VirtualBox guest... Hopefully it booted right up :-)
Comments:

Hi There,

Great post - very useful. I was wondering, you didn't mention doing a reconfiguration boot (touch /reconfigure) - is that no longer needed in newer Solaris/OpenSolaris builds if you're changing between hardware?

Cheers,

Alasdair

Posted by Alasdair Lumsden on January 15, 2010 at 09:17 AM EST #

Thanks for the post, this is a killer feature!

I'm going to be trying this out asap. I'm thinking it could allow for a cheap and easy disaster recovery plan (well for our systems with zfs root anyways).

cheers,
Aidan

Posted by Aidan on January 16, 2010 at 06:39 PM EST #

I was wondering, when will I have the capability to convert a physical Solaris 10 server into a zone? I can do this for solaris 8 and 9, why not 10?

Thanks!

Posted by Martin on January 17, 2010 at 05:49 PM EST #

> I was wondering, you didn't mention doing a
> reconfiguration boot (touch /reconfigure) - is that no
> longer needed in newer Solaris/OpenSolaris builds if
> you're changing between hardware?

yeah, actually you should probably do a touch /a/etc reconfigure... It's not as much as a requirement as it used to be... You could probably get away with a devfsadm -r /a -C... But causing a reconfig boot would be the safe thing to do.

> I was wondering, when will I have the capability to
> convert a physical Solaris 10 server into a zone?
> I can do this for solaris 8 and 9, why not 10?

Sorry, I don't work in this area so I can be sure. I would expect you to be able to do this for a branded s10 zone on OpenSolaris though?

Posted by Mark Johnson on January 19, 2010 at 12:57 AM EST #

Post a Comment:
Comments are closed for this entry.
About

mrj

Search

Categories
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