- 论坛徽章:
- 2
|
There are several situations when the administrator wants to break the link between the root disk and the root mirror device, while retaining the ability to boot from the mirror. For example, the administrator would like to make changes to the operating system which may be difficult to reverse (eg. applying a patch cluster or upgrading the operating system). By creating a separate bootable mirror prior to the maintenance, the administrator would retain the option of booting from the mirror if the maintenance did not go as well as expected.
The following sequence of steps assumes that the system starts as a standard encapsulated boot disk and associated mirror device.
# vxprint -ht
Disk group: rootdg
DG NAME NCONFIG NLOG MINORS GROUP-ID
DM NAME DEVICE TYPE PRIVLEN PUBLEN STATE
RV NAME RLINK_CNT KSTATE STATE PRIMARY DATAVOLS SRL
RL NAME RVG KSTATE STATE REM_HOST REM_DG REM_RLNK
V NAME RVG KSTATE STATE LENGTH READPOL PREFPLEX UTYPE
PL NAME VOLUME KSTATE STATE LENGTH LAYOUT NCOL/WID MODE
SD NAME PLEX DISK DISKOFFS LENGTH [COL/]OFF DEVICE MODE
SV NAME PLEX VOLNAME NVOLLAYR LENGTH [COL/]OFF AM/NM MODE
DC NAME PARENTVOL LOGVOL
SP NAME SNAPVOL DCO
dg rootdg default default 0 1035385242.1025.pegasus
dm rootdisk c0t0d0s2 sliced 3359 17693759 -
dm rootmirror c0t1d0s2 sliced 3359 17690400 -
sd rootdiskPriv - rootdisk 13423200 3359 PRIVATE c0t0d0 ENA
v rootvol - ENABLED ACTIVE 13423200 ROUND - root
pl rootvol-01 rootvol ENABLED ACTIVE 13423200 CONCAT - RW
sd rootdisk-B0 rootvol-01 rootdisk 13423199 1 0 c0t0d0 ENA
sd rootdisk-02 rootvol-01 rootdisk 0 13423199 1 c0t0d0 ENA
pl rootvol-02 rootvol ENABLED ACTIVE 13423200 CONCAT - RW
sd rootmirror-01 rootvol-02 rootmirror 0 13423200 0 c0t1d0 ENA
v swapvol - ENABLED ACTIVE 2096640 ROUND - swap
pl swapvol-01 swapvol ENABLED ACTIVE 2096640 CONCAT - RW
sd rootdisk-01 swapvol-01 rootdisk 13426559 2096640 0 c0t0d0 ENA
pl swapvol-02 swapvol ENABLED ACTIVE 2096640 CONCAT - RW
sd rootmirror-02 swapvol-02 rootmirror 13423200 2096640 0 c0t1d0 ENA
v var - ENABLED ACTIVE 2100000 ROUND - fsgen
pl var-01 var ENABLED ACTIVE 2100000 CONCAT - RW
sd rootdisk-04 var-01 rootdisk 15523199 2100000 0 c0t0d0 ENA
pl var-02 var ENABLED ACTIVE 2100000 CONCAT - RW
sd rootmirror-03 var-02 rootmirror 15519840 2100000 0 c0t1d0 ENA
Record which slices of rootmirror are allocated for the Veritas public and private regions (3 and 4 in our case):
# vxdisk list rootmirror | egrep "private|public"
flags: online ready private autoconfig autoimport imported
public: slice=3 offset=1 len=17690400
private: slice=4 offset=1 len=3359
Disassociate and then remove all of the operating system plexes on the mirror device "rootmirror":
# vxplex -g rootdg dis rootvol-02 swapvol-02 var-02
# vxedit -g rootdg -r rm rootvol-02 swapvol-02 var-02
Remove the rootmirror disk from rootdg
# vxdg -g rootdg rmdisk rootmirror
Run a filesystem check on each of the ufs filesystem slices on c0t1d0 (formerly identified as "rootmirror"):
# fsck -F ufs -y /dev/rdsk/c0t1d0s0
# fsck -F ufs -y /dev/rdsk/c0t1d0s4
Update the /etc/system and /etc/vfstab files on c0t1d0 so that there are no references to volume manager devices:
# mount /dev/dsk/c0t1d0s0 /mnt
# cp /mnt/etc/system /mnt/etc/system.orig
# vi /mnt/etc/system
Change the lines: rootdev:/pseudo/vxio@0:0
set vxio:vol_rootdev_is_volume=1
to: * rootdev:/pseudo/vxio@0:0
* set vxio:vol_rootdev_is_volume=1
Restore the pre-VxVM version of the vfstab file. Note that the vxinstall process makes a backup copy of the original vfstab file named vfstab.prevm. We'll make use of that backup now:
# cp /mnt/etc/vfstab /mnt/etc/vfstab.vm
# cp /mnt/etc/vfstab.prevm /mnt/etc/vfstab
Edit the /mnt/etc/vfstab file so that it references c0t1 instead of c0t0: # cat /mnt/etc/vfstab
#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot options
#
#/dev/dsk/c1d0s2 /dev/rdsk/c1d0s2 /usr ufs 1 yes -
fd - /dev/fd fd - no -
/proc - /proc proc - no -
/dev/dsk/c0t1d0s1 - - swap - no -
/dev/dsk/c0t1d0s0 /dev/rdsk/c0t1d0s0 / ufs 1 no logging
/dev/dsk/c0t1d0s6 /dev/rdsk/c0t1d0s6 /var ufs 1 no logging
swap - /tmp tmpfs - yes -
Note that the slices used for the various partitions may be different on the mirror disk than they were on the original root disk prior to encapsulation! When it initialized the rootmirror device, Veritas probably used slices 3 and 4 for the private and public regions, and relocated other slices elsewhere on the mirror. For example, if c0t0d0s4 was the original pre-encapsulated /var, then it is possible that new location of /var on the mirror device is c0t1d0s6, for example. You will have to carefully examine the partition table of c0t1d0 to determine how Veritas managed the slice allocation process on the mirror and update the /mnt/etc/vfstab file accordingly.
If the install-db file exists, the VxVM daemons will not start on bootup:
# touch /mnt/etc/vx/reconfig.d/state.d/install-db
The root-done file indicates that the root disk has been encapsulated. Remove it now:
# rm /mnt/etc/vx/reconfig.d/state.d/root-done
Finally, unmount the root filesystem and reboot:
# cd /; umount /mnt
Zero out the private and public regions on c0t1d0:
# format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c0t0d0
/pci@1f,4000/scsi@3/sd@0,0
1. c0t1d0
/pci@1f,4000/scsi@3/sd@1,0
Specify disk (enter its number): 1
selecting c0t1d0
[disk formatted]
...
partition> print
Current partition table (original):
Total disk cylinders available: 5266 + 2 (reserved cylinders)
Part Tag Flag Cylinders Size Blocks
0 root wm 1 - 3995 6.40GB (3995/0/0) 13423200
1 swap wu 3996 - 4620 1.00GB (625/0/0) 2100000
2 backup wm 0 - 5265 8.44GB (5266/0/0) 17693760
3 - wu 0 - 0 1.64MB (1/0/0) 3360
4 - wu 1 - 5265 8.44GB (5265/0/0) 17690400
5 unassigned wm 0 0 (0/0/0) 0
6 var wm 4621 - 5245 1.00GB (625/0/0) 2100000
7 unassigned wm 0 0 (0/0/0) 0
partition> 3
Part Tag Flag Cylinders Size Blocks
3 - wu 0 - 0 1.64MB (1/0/0) 3360
Enter partition id tag[unassigned]:
Enter partition permission flags[wu]:
Enter new starting cyl[0]:
Enter partition size[3360b, 1c, 1.64mb, 0.00gb]: 0
partition> 4
Part Tag Flag Cylinders Size Blocks
4 - wu 1 - 5265 8.44GB (5265/0/0) 17690400
Enter partition id tag[unassigned]:
Enter partition permission flags[wu]:
Enter new starting cyl[1]: 0
Enter partition size[17690400b, 5265c, 8637.89mb, 8.44gb]: 0
partition> p
Current partition table (unnamed):
Total disk cylinders available: 5266 + 2 (reserved cylinders)
Part Tag Flag Cylinders Size Blocks
0 root wm 1 - 3995 6.40GB (3995/0/0) 13423200
1 swap wu 3996 - 4620 1.00GB (625/0/0) 2100000
2 backup wm 0 - 5265 8.44GB (5266/0/0) 17693760
3 unassigned wu 0 0 (0/0/0) 0
4 unassigned wu 0 0 (0/0/0) 0
5 unassigned wm 0 0 (0/0/0) 0
6 var wm 4621 - 5245 1.00GB (625/0/0) 2100000
7 unassigned wm 0 0 (0/0/0) 0
partition> label
Ready to label disk, continue? y
partition> quit
Shutdown the operating system and confirm that you can boot from the former mirror device.
Having broken it off and booted successfully from the mirror, reboot to the encapsulated rootdisk and perform the maintenance, confident that you have a pre-patched image of the operating system available "just in case".
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/524/showart_87423.html |
|