There may be times when you want to boot from the unencapsulated SVM root disk by detaching one submirror. The term unencapsulation refers to a method of taking disk out of SVM control while retaining its content. The reason to do this can be many – For patching or when the system is not bootable when under SVM (this offcourse can not be done in multi-user environment and requires you to boot the system in single user-mode. The procedure remains the same in that case too)
The setup where we are performing the unencapsulation is as below :
The Setup
We begin with a system in which the root file system and swap are mirrored on c0t0d0 and c0t1d0. At the end of this procedure, c0t0d0 will be unchanged and will still boot under SVM control, and c0t1d0 will boot directly from slices. The two disks under a mirrored SVM configuration are :
# echo | format Searching for disks...done AVAILABLE DISK SELECTIONS: 0. c0t0d0 [SUN36G cyl 24620 alt 2 hd 27 sec 107] /pci@1c,600000/scsi@2/sd@0,0 1. c0t1d0 [SUN36G cyl 24620 alt 2 hd 27 sec 107] /pci@1c,600000/scsi@2/sd@1,0
The /etc/fstab entries for the SVM mirrors are :
# cat /etc/vfstab #device device mount FS fsck mount mount #to mount to fsck point type pass at boot options … /dev/md/dsk/d20 - - swap - no - /dev/md/dsk/d10 /dev/md/rdsk/d10 / ufs 1 no -
We have 6 state metadatabase replicas (3 on each disk) :
# metadb flags first blk block count a m p luo 16 8192 /dev/dsk/c0t0d0s7 a p luo 8208 8192 /dev/dsk/c0t0d0s7 a p luo 16400 8192 /dev/dsk/c0t0d0s7 a p luo 16 8192 /dev/dsk/c0t1d0s7 a p luo 8208 8192 /dev/dsk/c0t1d0s7 a p luo 16400 8192 /dev/dsk/c0t1d0s7
The root and swap partition and their SVM mirrors :
# metastat -p d20 -m d21 d22 1 d21 1 1 c0t0d0s1 d22 1 1 c0t1d0s1 d10 -m d11 d12 1 d11 1 1 c0t0d0s0 d12 1 1 c0t1d0s0 # df -h / Filesystem size used avail capacity Mounted on /dev/md/dsk/d10 29G 8.2G 20G 29% / # swap -l swapfile dev swaplo blocks free /dev/md/dsk/d20 85,20 16 8389632 8389632
Unencapsulation procedure
Lets begin with the unencapsulation procedure.
Step 1 : Use metadetach and metaclear to detach and remove submirrors on c0t1d0. (If the submirrors have already been detached, do not repeat the metadetach commands; just use metaclear to remove them.)
# metadetach d10 d12 d10: submirror d12 is detached # metadetach d20 d22 d20: submirror d22 is detached # metaclear d12 d22 d12: Concat/Stripe is cleared d22: Concat/Stripe is cleared # metastat -p d10 d20 d10 -m d11 1 d11 1 1 c0t0d0s0 d20 -m d21 1 d21 1 1 c0t0d0s1
Step 2 : Remove state database replicas from c0t1d0. (This step is technically not necessary because replicas can exist on this disk even if it is not under SVM control. We include it here to remove all traces of SVM on c0t1d0.)
# metadb -d c0t1d0s7 # metadb flags first blk block count a m p luo 16 8192 /dev/dsk/c0t0d0s7 a p luo 8208 8192 /dev/dsk/c0t0d0s7 a p luo 16400 8192 /dev/dsk/c0t0d0s7
Step 3 : Mount the root file system on c0t1d0 on /mnt.
# mount /dev/dsk/c0t1d0s0 /mnt
Step 4 : Edit /mnt/etc/system to remove the following lines :
* Begin MDD root info (do not edit) rootdev:/pseudo/md@0:0,10,blk * End MDD root info (do not edit)
Step 5 : Edit /mnt/etc/vfstab to change entries from metadevices to Solaris slices :
Before: /dev/md/dsk/d20 - - swap - no - /dev/md/dsk/d10 /dev/md/rdsk/d10 / ufs 1 no - After: /dev/dsk/c0t1d0s1 - - swap - no - /dev/dsk/c0t1d0s0 /dev/rdsk/c0t1d0s0 / ufs 1 no -
Step 6 : Use “init 0” and then boot from OBP to reboot the system. Because changes have been made to the root file system mounted on /mnt, this will update the boot archive for that disk, /mnt/platform/sun4u/boot_archive.
# init 0 Creating boot_archive for /mnt updating /mnt/platform/sun4u/boot_archive … ok> boot mirrordisk
Refer the post How to identify primary and alternate boot disk to identify altername rootdisk (mirrordisk) above.
Step 7 : Verify that the system started from the non-mirrored disk c0t1d0s0
# df -h Filesystem size used avail capacity Mounted on /dev/dsk/c0t1d0s0 29G 8.2G 20G 29% / # swap -l swapfile dev swaplo blocks free /dev/dsk/c0t1d0s1 32,33 16 8389632 8389632
Reestablishing the mirrors
In case if you want to have the original setup of a mirrored root under SVM, here is what you do. In this example the data on d10/d11 will be copied to d12 and d20/21 data is copied over to d22 respectively. Firstly, boot from the SVM submiror disk (aliased as rootdisk) :
ok> boot rootdisk (I assume that this is still a SVM root mirror which have one submirror active)
Create the submirrors d12 (root), d22 (swap) and attach them to the existing mirror d10 and d20 respectively :
# metainit d12 1 1 c0t1d0s0 d12: Concat/Stripe is setup # metainit d22 1 1 c0t1d0s1 d22: Concat/Stripe is setup # metattach d10 d12 d10: submirror d12 is attached # metattach d20 d22 d20: submirror d22 is attached
Check if the resyncing process has started :
# metastat d10 d20 | grep Resync (to monitor the resyncing process) State: Resyncing Resync in progress: 1 % done State: Resyncing State: Resyncing Resync in progress: 12 % done State: Resyncing
If the metadb was removed in step 2 then add it back with :
# metadb -a -c 3 c0t1d0s7