SXCE and OpenSolaris boot environments can (be made to) share a pool
By user12629787 on Nov 16, 2009
So you have a laptop running Solaris Nevada SXCE and want to "upgrade" to OpenSolaris before SXCE becomes
history and maybe run them side by side for a few builds, (uhmm) to get the transition sorted out.
There are several ways to achieve this, none of them are supported but this one is "relatively" clean to do.
Sun internal folks can download the build 127 usb iso from the usual sfbay location, and from here for the community.
http://genunix.org/distributions/indiana/osol-dev-127-x86.usbWhat do we need:
You'll need two spare USB sticks, one of at least 1GB and the other of at least 4GB, you need to already be
running ZFS boot on your SXCE install. See http://blogs.sun.com/thinslice/entry/upgrade_to_all_zfs_root
for a great set of instructions from Iain Curtain to get to that point
We'll use usbcopy to put the OpenSolaris Build 127 liveusb iso onto the smaller stick, we'll boot that live
image and then install OpenSolaris on the larger stick. Then we put a new OpenSolaris BE on to the same rpool
used by your SXCE BEs and force them to play nice together for a while.
If you haven't made a backup of your rpool I suggest you do it now before we start,
I don't anticipate trouble but if it comes don't be unprepared.
Grab usbcopy if you don't already have it, best make it executable .
# /usr/sfw/bin/wget http://src.opensolaris.org/source/xref/livemedia/livemedia/usbcopy
Insert the smaller stick
# chmod a+rx usbcopy
# ./usbcopy osol-dev-127-x86.usb
Select the newly inserted stick.
Once complete, reboot the system from that stick, then also insert the second larger USB stick.
Install OpenSolaris on to it using the installer icon on the desktop
Now the fun bits:
- DO \*\*NOT\*\* reboot yet.
To avoid a collision of root pool names, if your zfs booted SXCE uses "rpool" for the name of your root
pool, you will need to rename the root pool on your newly installed 4Gb stick.
a/ export the pool
You will expect to see two pools named rpool, select the one you know to be the usb stick,
# zpool export rpool
b/ Obtain the numeric ID of the instance of "rpool" residing on the USB stick.
# zpool import
if in any doubt, use "eject -l" to tell you which USB sticks equate to which disk device
displayed by "zpool import".
# zpool import
c/ Import that ID under a new name, (this will make the stick unbootable without intervention but we can handle that).
# zpool import 5398210322707898534 Rpool
Export the pool again.
# zpool status
scrub: none requested
NAME STATE READ WRITE CKSUM
Rpool ONLINE 0 0 0
c6t0d0s0 ONLINE 0 0 0
# zpool export Rpool
Now halt the live usb instance and remove the small USB stick
Boot from the large USB stick, at the grub menu use the "e" key to edit the
grub menu and select the line "bootfs rpool/ROOT/opensolaris" then "e" to edit
that line, (please don't be tempted to also change the findroot line).
The "bootfs" line needs to use the new pool name, so it should read
Once done escape back to the grub menu and boot the modified entry
using the "b" key.
Now that we are booted in OpenSolaris, we will make a new OpenSolaris boot environment
on the real disk based rpool which already contains your SXCE BEs.
# beadm create -p rpool zOBE
You can of course name it "opensolaris" if you want but zOBE suits me.
Activate the new BE.
# beadm activate zOBE
Halt and remove the larger memory stick, but KEEP it as you may want it
later if you choose to do further updates of your SXCE environments
using "Live-Upgrade". You can do that, it will work fine however
you MUST remember that OpenSolaris is your BE master environment now,
to activate a new or upgraded SXCE BE do \*\*NOT\*\* use luactivate.
Instead boot manually via GRUB to test OR reboot OpenSolaris and use
"beadm activate" from the osol boot environment to activate the
new SXCE BE.
This is necessary as the SXCE grub appears to be poisonous to OpenSolaris
BEs and must not be propagated. If you do use luactivate you'll need the
"rescue" USB stick you have just put aside for later.
Boot from your newly activated OpenSolaris BE.
# beadm list
Create a new safety BE and then start grabbing bits as needed from your old environment.
BE Active Mountpoint Space Policy Created
-- ------ ---------- ----- ------ -------
opensolaris - - 4.32G static 2009-11-14 08:58 (That's my 4Gb stick)
zABE - - 18.28G static 2009-11-07 23:42 (My old SXCE main BE)
zMBE - - 115.02M static 2009-10-22 09:06 (My old SXCE alternate BE)
zOBE NR / 3.21G static 2009-11-15 14:43 (The new OpenSolaris BE)
You will definitely want to copy across /etc/hostid from your existing SXCE
or things get very messy at each reboot.
Mount your latest SXCE BE filesystem using the zfs commands (I'm not using beadm here,
but only as I haven't tested that yet, I expect it'll work fine but the usual caveats apply).
# zfs set mountpoint=/mnt rpool/ROOT/zABE
# zfs mount rpool/ROOT/zABE
# cp /mnt/etc/hostid /etc/hostid
# cp ... ..
# zfs umount /mnt
Check that the OpenSolaris BE is sharing the swap and dump devs with the SXCE BEs.
# zfs set mountpoint=/
# dumpadm -d /dev/zvol/dsk/rpool/dump
Add it manually if needed
Dump content: kernel pages
Dump device: /dev/zvol/dsk/rpool/dump (dedicated)
Savecore directory: /var/crash/georges-home
Savecore enabled: yes
Save compressed: on
# swap -l
No swap devices configured
# swap -a /dev/zvol/dsk/rpool/swap
Edit /etc/vfstab to add the following line for swap.
/dev/zvol/dsk/rpool/swap - - swap - no -
Now you are good to go with a reboot, then manually select an SXCE BE at
the GRUB menu, using lustatus you should see ONLY the SXCE BEs, just try
to remember that this environment is on it's way to being deprecated so
don't allow GRUB or GRUB menus to be propagated from here. SO, don't use
luactivate or installgrub at all when booted SXCE.
So back to your OpenSolaris BE, it's time to use the pkg_manager to go
fetch the packages you want, from the dev repository. (We are on the bleeding
edge here aren't we, since we're likely on snv_127 in both SXCE and Osol .