Install Nevada and OpenSolaris on the same zfs rpool
By mrj on Nov 20, 2009
DISCLAIMER: this is totally unsupported by Sun, could mess up your system, etc. etc. It works great for me.. But may not for you. :-)
You can also use this script on an OpenSolaris system to install a new Boot Environment (BE) from scratch. When you do a beadm create, OpenSolaris will create a copy-on-write (COW) clone of the current filesystem (which is what you want normally). There are cases where you may not want to clone your existing config. e.g. If you really messed up your system configuration, you can re-install into a new BE (allows you to keep the old config around) instead of re-installing from scratch. Or you can use this to install an older build in a new BE. e.g. say you need to test something in an older build and you didn't keep any of your older BEs around. Here's an example invocation...
create-be --build=121 --bename=osol-121 --repo=http://pkg.opensolaris.org/dev
To install OpenSolaris on a Nevada system, you first need to install the OpenSolaris packaging system on your Nevada system. I'm not going to go over how to build the ipkg gate, but this should get you going in the right direction if you can't find binary packages.
hg clone ssh://email@example.com/hg/pkg/gate pkg-gate \*\* build everything cd packages pkgadd -d . SUNWipkg SUNWpython-ply SUNWpython-pycurlYou need to be using a zfs root of course.. i.e.
root@pico:~# df / Filesystem 1K-blocks Used Available Use% Mounted on rpool/ROOT/snv_127 ...Now use the script to create a new OpenSolaris BE on your nevada rpool, giving it a BE name, and tell it to create a grub menu entry. This will take a while :-).. You can override the default build (--build=
create-be --bename=osol-127 --menu="OpenSolaris b127"This script does a fresh install... So you will have to reconfigure the system when you reboot into the new BE (the current BE is unaffected). The only settings I presently migrate over is the grub menu entry and the console settings in bootenv.rc.
Once the install completes (repeats the "takes a while"), you can now reboot into the OpenSolaris BE.. A note here.. you should update the grub menu so the default menu entry is the new entry which was added. This is because you will reboot into the new BE, configure it, and it will reboot again after it completes configuring the OpenSolaris BE. fastreboot will then boot into the original BE if you don't change the default grub menu entry. Also, make sure you do a reboot -p!!!!
-bash-4.0# bootadm list-menu the location for the active GRUB menu is: /rpool/boot/grub/menu.lst default 0 timeout 10 0 Solaris Express Community Edition snv_127 X86 1 Solaris failsafe 2 OpenSolaris b127 -bash-4.0# bootadm set-menu default=2
Now that you have booted and configured your OpenSolaris BE, lets poke around... run beadm list to make sure you actually booted into the right BE first :-). NOTE: OpenSolaris thinks the Nevada BE is an opensolaris BE which works out nice... I like to copy over my ssh keys since I use the same IP address for the nevada BE and OpenSolaris BE. I'll also create a new OpenSolaris BE using beadm..
root@pico:/etc/ssh# beadm list BE Active Mountpoint Space Policy Created -- ------ ---------- ----- ------ ------- osol-127 NR / 3.79G static 2009-11-20 20:03 snv_127 - - 7.97G static 2009-11-19 10:48 root@pico:/etc/ssh# beadm mount snv_127 /mnt root@pico:/etc/ssh# cp /mnt/etc/ssh/\*key\* /etc/ssh/ root@pico:/etc/ssh# cp /mnt/etc/ssh/sshd_config /etc/ssh/ root@pico:/etc/ssh# beadm umount snv_127 root@pico:/etc/ssh# svcadm refresh ssh root@pico:/etc/ssh# svcadm restart ssh root@pico:/etc/ssh# beadm create test-osol-be root@pico:/etc/ssh# beadm list BE Active Mountpoint Space Policy Created -- ------ ---------- ----- ------ ------- osol-127 NR / 3.79G static 2009-11-20 20:03 snv_127 - - 7.97G static 2009-11-19 10:48 test-osol-be - - 51.0K static 2009-11-21 06:54Finally, lets reboot back into nevada and look around (I love fast reboot).
root@pico:/etc/ssh# beadm activate snv_127 root@pico:/etc/ssh# reboot Nov 21 06:57:26 pico reboot: initiated by root on /dev/console syncing file systems... done rebooting... SunOS Release 5.11 Version snv_127 32-bit Copyright 1983-2009 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Hostname: pico Reading ZFS config: done. Mounting ZFS filesystems: (7/7) pico console login: root Password: Nov 21 06:59:06 pico login: ROOT LOGIN /dev/console Last login: Sat Nov 21 05:10:55 on console Sun Microsystems Inc. SunOS 5.11 snv_127 November 2008 -bash-4.0# beadm list -bash: beadm: command not found -bash-4.0# lustatus ERROR: No boot environments are configured on this system ERROR: cannot determine list of all boot environment names -bash-4.0# zfs list NAME USED AVAIL REFER MOUNTPOINT rpool 13.2G 132G 35.5K /rpool rpool/ROOT 11.8G 132G 21K legacy rpool/ROOT/osol-127 3.80G 132G 3.79G / rpool/ROOT/snv_127 7.97G 132G 7.97G / rpool/ROOT/test-osol-be 51K 132G 3.79G / rpool/dump 959M 132G 959M - rpool/export 44K 132G 23K /export rpool/export/home 21K 132G 21K /export/home rpool/swap 512M 133G 9.05M - -bash-4.0# df / / (rpool/ROOT/snv_127):277843413 blocks 277843413 files -bash-4.0#