|
Notes for Full Unencapsulation:
Under normal circumstances, if the system can be booted to at least single user mode, it is recommended that the vxunroot command be used to unencapsulate root. A full unencapsulation should be performed if the vxunroot command is not working for some reason, or if the system cannot be booted and we want to completely remove Volume Manager from having any control over the root disk.
You cannot perform a full unencapsulation and still maintain Volume Manager functionality if the root disk is the ONLY disk in the rootdg diskgroup. If the root disk is the only disk in rootdg, you can still unencapsulate, but Volume Manager will not work until another disk is initialized into rootdg using vxinstall after the system has been fully unencapsulated. Normally if root it is encapsulated, it is also mirrored which gives us another disk in rootdg, however it should always be verified that there is at least one other disk in rootdg before following this procedure so that we know what to expect once root is unencapsulated.
Also note that Volume Manager will allow you to create volumes using free space on the root disk, after the root disk has been encapsulated. Volumes created post-encapsulation like this do not have underlying hard partitions and therefore are not recoverable with this procedure. If at all possible, make backups of any volumes created on the rootdisk post-encapsulation before following this procedure. Once you are unencapsulated, if you have free space and a free partition, you could newfs that partition and restore to it from your backup.
Steps for Full Unencapsulation:
Bring the system to the OK prompt and insert a Solaris CD into the CDROM drive.
Then issue:
boot cdrom -s
Once booted to the cdrom, set your terminal type so that vi will work correctly.
If TERM=sun doesn't work, often times TERM=vt100 will.
TERM=sun;export TERM
Fsck your root filesystem:
fsck -y /dev/rdsk/c#t#d#s0
If fsck comes back cleanly, mount slice 0 to /a. If fsck cannot repair the root file system,
there are obviously a number of possibilities. This procedure does not attempt to explain
file system corruption or how to repair it beyond fsck. Fsck must come back cleanly to continue
and mount root.
mount /dev/dsk/c#t#d#s0 /a
Make a backup of /a/etc/system and then edit it:
cp /a/etc/system /a/etc/system.orig
vi /a/etc/system
Completely remove the following lines from the system file.
If you re-encapsulate in the future, these lines will be added back correctly so there
is nothing to be lost by removing them.
rootdev:/pseudo/vxio@0:0
set vxio:vol_rootdev_is_volume=1
Make a backup of /a/etc/vfstab and then edit it:
cp /a/etc/vfstab /a/etc/vfstab.orig
vi /a/etc/vfstab
Edit the vfstab file back to it's original state, pointing /, swap, /usr, and /var
to hard partitions on the disk like /dev/dsk and /dev/rdsk rather than /dev/vx/ entries.
Temporarily comment out all other /dev/vx volumes from the /a/etc/vfstab file using the #
character. This includes filesystems like /opt and /export, if they exist.
The original /etc/vfstab will look something like this, assuming root is c0t0d0:
Note: Columns have been aligned and spaces added for clarity.
---------------------------------------------------------------------------
/dev/vx/dsk/swapvol - - swap - no -
/dev/vx/dsk/rootvol /dev/vx/rdsk/rootvol / ufs 1 no -
/dev/vx/dsk/usr /dev/vx/rdsk/usr /usr ufs 1 no -
/dev/vx/dsk/var /dev/vx/rdsk/var /var ufs 1 no -
/dev/vx/dsk/export /dev/vx/rdsk/export /export ufs 2 yes -
swap - /tmp tmpfs - yes -
/dev/vx/dsk/datadg/somevol /dev/vx/rdsk/datadg/somevol /somevol ufs 2 yes -
#NOTE: volume rootvol (/) encapsulated partition c0t0d0s0
#NOTE: volume swapvol (swap) encapsulated partition c0t0d0s1
#NOTE: volume usr (/usr) encapsulated partition c0t0d0s5
#NOTE: volume var (/var) encapsulated partition c0t0d0s6
#NOTE: volume export (/export) encapsulated partition c0t0d0s7
---------------------------------------------------------------------------
Once edited, the vfstab should look something like this:
---------------------------------------------------------------------------
/dev/dsk/c1t0d0s1 - - swap - no -
/dev/dsk/c1t0d0s0 /dev/rdsk/c0t0d0s0 / ufs 1 no -
/dev/dsk/c1t0d0s5 /dev/rdsk/c0t0d0s5 /usr ufs 1 no -
/dev/dsk/c1t0d0s6 /dev/rdsk/c0t0d0s6 /var ufs 1 no -
#/dev/dsk/c1t0d0s7 /dev/rdsk/c0t0d0s7 /export ufs 2 yes -
swap - /tmp tmpfs - yes -
#/dev/vx/dsk/datadg/somevol /dev/vx/rdsk/datadg/somevol /somevol ufs 2 yes -
#NOTE: volume rootvol (/) encapsulated partition c0t0d0s0
#NOTE: volume swapvol (swap) encapsulated partition c0t0d0s1
#NOTE: volume usr (/usr) encapsulated partition c0t0d0s5
#NOTE: volume var (/var) encapsulated partition c0t0d0s6
#NOTE: volume export (/export) encapsulated partition c0t0d0s7
---------------------------------------------------------------------------
Now make sure Volume Manager does not start on the next boot:
touch /a/etc/vx/reconfig.d/state.d/install-db
This is important because IF the root disk contains mirrors, and the system
boots up, the mirrors will get resynced, corrupting the changes we just made.
Remove the flag that tells Volume Manager that the root disk is encapsulated:
rm /a/etc/vx/reconfig.d/state.d/root-done
Reboot the system for changes to take effect:
reboot
When we reboot we will come up in an partially unencapsulated state with /, /usr, /var, and swap
mounted. Volume Manager will not start but we can start it manually once we are booted.
To start Volume Manager, run the following commands:
rm /etc/vx/reconfig.d/state.d/install-db
vxiod set 10
vxconfigd -m disable
vxdctl enable
Now we can remove the volumes that existed on the encapsulated boot disk. They will generally
be rootvol, swapvol, usr, and var. They might also include home, opt, or other non-standard
root partitions. Use the command 'vxprint -htg rootdg' to list the volumes in rootdg before
removing them. Then, for each volume, run the command:
/usr/sbin/vxedit -rf rm <volume name>
Remove the rootdisk from rootdg now that it has no volumes, plexes or subdisks:
The disk name is usually 'rootdisk'
/usr/sbin/vxdg rmdisk <disk name>
The final step is to re-write the vtoc of the disk so that hard partitions are again defined for
the root file systems. There are several ways to put the hard partitions back, including using
fmthard on a modified /etc/vx/reconfig.d/disk.d/c#t#d#/vtoc file, using format to manually repartition
the disk, or using the vxmksdpart command. The simplest method however is to use the vxedvtoc command
as explained below.
When Volume Manager encapsulates a disk, it makes a record of the old vtoc of the disk.
This file is stored for each disk in /etc/vx/reconfig.d/disk.d/c#t#d#. This file is stored in a Volume Manager
specific format, so it can't be used as an argument to fmthard unless it is modified. The 'vxedvtoc' command is
similar to fmthard but knows how to read this vtoc file and write that vtoc to a disk. The command takes the form:
vxedvtoc -f <filename> <devicename>
Assuming that the boot disk is c0t0d0 we would now run the command
/etc/vx/bin/vxedvtoc -f /etc/vx/reconfig.d/disk.d/c0t0d0/vtoc /dev/rdsk/c0t0d0s2
# THE ORIGINAL PARTITIONING IS AS FOLLOWS :
#SLICE TAG FLAGS START SIZE
0 0x0 0x200 0 0
1 0x0 0x200 0 0
2 0x5 0x201 0 8794112
3 0x0 0x200 0 0
4 0x0 0x200 0 0
5 0x0 0x200 0 0
6 0xe 0x201 0 8794112
7 0xf 0x201 8790016 4096
# THE NEW PARTITIONING WILL BE AS FOLLOWS :
#SLICE TAG FLAGS START SIZE
0 0x0 0x200 0 2048000
1 0x0 0x200 2048000 2048000
2 0x5 0x201 0 8794112
3 0x0 0x201 4096000 2048000
4 0x0 0x201 6144000 2048000
5 0x0 0x200 0 0
6 0x0 0x200 0 0
7 0x0 0x200 0 0
DO YOU WANT TO WRITE THIS TO THE DISK ? [Y/N] :y
WRITING THE NEW VTOC TO THE DISK
This will partition the disk back to a pre-encapsulation state. Now we can uncomment the entries
for any of the non Big-4 root partitions from /etc/vfstab, as well as any data volumes. In this
example we removed comments from /export and the data volume /somevol.
vi /etc/vfstab
/dev/dsk/c0t0d0s1 - - swap - no -
/dev/dsk/c0t0d0s0 /dev/rdsk/c0t0d0s0 / ufs 1 no -
/dev/dsk/c0t0d0s5 /dev/rdsk/c0t0d0s5 /usr ufs 1 no -
/dev/dsk/c0t0d0s6 /dev/rdsk/c0t0d0s6 /var ufs 1 no -
/dev/dsk/c0t0d0s7 /dev/rdsk/c0t0d0s7 /export ufs 2 yes -
swap - /tmp tmpfs - yes -
/dev/vx/dsk/datadg/somevol /dev/vx/rdsk/datadg/somevol /somevol ufs 2 yes -
Just to make sure, start all volumes
/usr/sbin/vxvol startall
Now issue a mountall to mount the now uncommented volumes
mountall
At this point the root disk is completely free of Volume Manager control, Volume Manager daemons
are started, and all file systems / volumes should be mounted.
|