Using ZFS Root in OpenSolaris Developer Preview to Protect Yourself During UpgradesAnthony Juckel, May 2008 One of the great features of OpenSolaris Developer Preview 2, which is
not yet included in the Solaris Express distributions, is the use of ZFS
for all file systems, even the root. For example, after installing it on
my laptop, NAME USED AVAIL REFER MOUNTPOINT rpool 15.2G 16.8G 53K /rpool rpool@install 18.5K - 49.5K - rpool/ROOT 7.81G 16.8G 18K /rpool/ROOT rpool/ROOT@install 15K - 18K - rpool/ROOT/preview2 7.81G 16.8G 6.61G legacy rpool/ROOT/preview2@install 342M - 1.94G - rpool/ROOT/preview2/opt 885M 16.8G 885M /opt rpool/ROOT/preview2/opt@install 120K - 3.61M - rpool/export 7.28G 16.8G 19K /export rpool/export@install 15K - 19K - rpool/export/home 7.28G 16.8G 450K /export/home rpool/export/home@install 19K - 21K - The file system Because you cannot boot directly from a snapshot, the first step is to
clone the snapshot into a mountable file system, set its mountpoint to
be $ pfexec zfs clone rpool/ROOT/preview2@install \ rpool/ROOT/install-clone $ pfexec zfs set mountpoint=legacy rpool/ROOT/install-clone $ pfexec mount -F zfs rpool/ROOT/install-clone /mnt/solaris0 Remember, if you make no modifications to this clone, there is
nearly nil overhead in actual on-disk storage. ZFS is smart enough to
keep track of the shared blocks between the two file systems, but you
can also modify files on each file system ( Now that we have the file system mounted, we want to update # Comment out the original / mountpoint #rpool/ROOT/preview2 - / zfs - no - # Use the newly created clone as the / mountpoint. rpool/ROOT/install-clone - / zfs - no - Finally, you can update GRUB to ensure that you always have the option
of booting from this newly created clone. To do so, you have to edit
################################################################## # # # For zfs root, menu.lst has moved to /rpool/boot/grub/menu.lst. # # # ################################################################## Before making your modifications, your splashimage /boot/grub/splash.xpm.gz timeout 30 default 0 #---------- ADDED BY BOOTADM - DO NOT EDIT ---------- title OpenSolaris Developer Preview 2 snv_79b X86 kernel$ /platform/i86pc/kernel/$ISADIR/unix -B $ZFS-BOOTFS module$ /platform/i86pc/$ISADIR/boot_archive #---------------------END BOOTADM-------------------- The $ zpool get bootfs rpool NAME PROPERTY VALUE SOURCE rpool bootfs rpool/ROOT/preview2 local Now, we don't want to have to update this property every time we need
to recover, but luckily the GRUB within the Solaris OS adds a # In case something goes wrong, use this to # boot the initial install image. title OpenSolaris Developer Preview 2 Initial Install bootfs rpool/ROOT/install-clone kernel$ /platform/i86pc/kernel/$ISADIR/unix -B $ZFS-BOOTFS module$ /platform/i86pc/$ISADIR/boot_archive After these steps are done, you should be able to reboot your
Solaris machine, and choose the new title from the GRUB boot menu, and
boot to a clone of the initial install of your system. Even if you
break the system on Also, it should be noted that all file systems under the original root
will also be available within your clone install. For instance, when
you boot from Finally, be aware that there is nothing special about the $ pfexec zfs snapshot rpool/ROOT/preview2@recentsnapshot $ pfexec zfs clone rpool/ROOT/preview2@recentsnapshot rpool/ROOT/recentsnapshot $ pfexec zfs set mountpoint=legacy rpool/ROOT/recentsnapshot Then follow the previous instructions for updating About the AuthorAnthony Juckel has been administering Linux at home and at work for 10 years. Within the last 2 years, technologies like ZFS and DTrace have convinced him to give the Solaris OS a serious look.
Comments (latest comments first)Discuss and comment on this resource in the BigAdmin Wiki
Unless otherwise licensed, code in all technical manuals herein (including articles, FAQs, samples) is provided under this License. |
BigAdmin SubscriptionsBigAdmin Areas
BigAdmin Sun Center
BigAdmin Topics | ||||||||||