欢迎加入IT云增值在线QQ交流群:342584734
分类:
2006-03-18 21:18:57
There are many circumstances in which it may be necessary to remove the operating system from Veritas Volume Manager control. For years, Veritas included the command vxunroot
to accomplish this task; however, it had several restrictions, including the inability to execute if there were any partitions on the rootdisk other than the big-4 (/, /var, swap, and /opt). However, I just discovered that version VxVM 3.5 no longer includes this restriction. I've tested it successfully, and the following description may only be necessary for those systems running earlier versions of VxVM.
Typically, the administrator is often under pressure while performing these types of maintenance. Because simple mistakes at this stage can render the system unusable, it is important that the process be well documented and tested prior to using it in production.
In the example below, the server pegasus has two internal disks (c0t0d0 and c0t1d0) under Veritas Volume Manager control. The operating system is mirrored between the two devices.
From the "ok" prompt, boot from the cdrom device into single-user mode:
ok boot cdrom -s Boot device: /pci@1f,4000/scsi@3/disk@6,0:f File and args: -s SunOS Release 5.8 Version Generic_108528-07 64-bit Copyright 1983-2001 Sun Microsystems, Inc. All rights reserved. Configuring /dev and /devices Using RPC Bootparams for network configuration information. / INIT: SINGLE USER MODE # TERM=vt100; export TERM #
Perform a filesystem check on the root filesystem:
# format /pci@1f,4000/scsi@3/sd@0,0 1. c0t1d0/pci@1f,4000/scsi@3/sd@1,0 Specify disk (enter its number): # fsck -y /dev/rdsk/c0t0d0s0 ** /dev/rdsk/c0t0d0s0 ** Last Mounted on / ** Phase 1 - Check Blocks and Sizes ** Phase 2 - Check Pathnames ** Phase 3 - Check Connectivity ** Phase 4 - Check Reference Counts ** Phase 5 - Check Cyl groups 41356 files, 1047059 used, 5553722 free (4802 frags, 693615 blocks, 0.0% fragmentation) # mount /dev/dsk/c0t0d0s0 /a
Update the /a/etc/system file, removing references to the VxVM root device:
# cp /a/etc/system /a/etc/system.orig # vi /a/etc/systemThe system must not boot from the Veritas volumes. You can either delete the following two lines or change them from:
rootdev:/pseudo/vxio@0:0 set vxio:vol_rootdev_is_volume=1to:
* 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 /a/etc/vfstab /a/etc/vfstab.vm # cp /a/etc/vfstab.prevm /a/etc/vfstab # cat /a/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/c0t0d0s1 - - swap - no - /dev/dsk/c0t0d0s0 /dev/rdsk/c0t0d0s0 / ufs 1 no logging /dev/dsk/c0t0d0s4 /dev/rdsk/c0t0d0s4 /var ufs 1 no logging swap - /tmp tmpfs - yes -
If the install-db file exists, the VxVM daemons will not start on bootup:
# touch /a/etc/vx/reconfig.d/state.d/install-db
The root-done file indicates that the root disk has been encapsulated. Remove it now:
# rm /a/etc/vx/reconfig.d/state.d/root-done
Finally, unmount the root filesystem and reboot:
# cd /; umount /a
# stop-a
Boot from the root device
ok boot Resetting ... screen not found. Can't open input device. Keyboard not present. Using ttya for input and output. Sun Ultra 30 UPA/PCI (UltraSPARC-II 296MHz), No Keyboard OpenBoot 3.27, 512 MB memory installed, Serial #9377973. Ethernet address 8:0:20:8f:18:b5, Host ID: 808f18b5. Initializing Memory Rebooting with command: boot Boot device: disk File and args: SunOS Release 5.8 Version Generic_108528-16 64-bit Copyright 1983-2001 Sun Microsystems, Inc. All rights reserved. NOTICE: VxVM not started configuring IPv4 interfaces: hme0. Hostname: pegasus NOTICE: VxVM not started NOTICE: VxVM not started The system is coming up. Please wait. starting rpc services: rpcbind done. Setting netmask of hme0 to 255.255.255.0 Setting default IPv4 interface for multicast: add net 224.0/4: gateway pegasus Starting sshd... This platform does not support both privilege separation and compression Compression disabled syslog service starting. VxVM Provider initialization warning: vxinstall has not been run. Print services started. /dev/bd.off: not a serial device. volume management starting. No VVR license installed on the system; vradmind not started. No VVR license installed on the system; in.vxrsyncd not started. The system is ready. pegasus console login: root Password: Oct 23 17:41:55 pegasus login: ROOT LOGIN /dev/console Sun Microsystems Inc. SunOS 5.8 Generic February 2000 # df -k Filesystem kbytes used avail capacity Mounted on /dev/dsk/c0t0d0s0 6607349 1053634 5487642 17% / /proc 0 0 0 0% /proc fd 0 0 0 0% /dev/fd mnttab 0 0 0 0% /etc/mnttab /dev/dsk/c0t0d0s4 1016863 239898 715954 26% /var swap 1401536 16 1401520 1% /var/run swap 1401536 16 1401520 1% /tmp
At this point, the operating system is no longer under Veritas Volume Manager control. The disk c0t1d0 is unused, and the system would not survive the failure of c0t0d0 if it were to die now.
Note that even though the operating system is no longer under system control, in some cases you might wish to continue running Veritas volume manager for non-os volumes. In this situation a few additional steps are required:
Manually start up volume manager processes:
# rm /etc/vx/reconfig.d/state.d/install-db
# vxiod set 10
# vxconfigd -m disable
# vxdctl enable
Confirm that all previous root volumes are accessible:
# 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 1035409531.1025.pegasus dm rootdisk c0t0d0s2 sliced 3359 17690400 - dm rootmirror c0t1d0s2 sliced 3359 17690400 - v rootvol - DISABLED ACTIVE 13423200 ROUND - root pl rootvol-01 rootvol DISABLED ACTIVE 13423200 CONCAT - RW sd rootdisk-B0 rootvol-01 rootdisk 17690399 1 0 c0t0d0 ENA sd rootdisk-02 rootvol-01 rootdisk 0 13423199 1 c0t0d0 ENA pl rootvol-02 rootvol DISABLED ACTIVE 13423200 CONCAT - RW sd rootmirror-01 rootvol-02 rootmirror 0 13423200 0 c0t1d0 ENA v swapvol - DISABLED ACTIVE 2096640 ROUND - swap pl swapvol-01 swapvol DISABLED ACTIVE 2096640 CONCAT - RW sd rootdisk-01 swapvol-01 rootdisk 13426559 2096640 0 c0t0d0 ENA pl swapvol-02 swapvol DISABLED ACTIVE 2096640 CONCAT - RW sd rootmirror-02 swapvol-02 rootmirror 13423200 2096640 0 c0t1d0 ENA v var - DISABLED ACTIVE 2100000 ROUND - fsgen pl var-01 var DISABLED ACTIVE 2100000 CONCAT - RW sd rootdisk-03 var-01 rootdisk 15523199 2100000 0 c0t0d0 ENA pl var-02 var DISABLED ACTIVE 2100000 CONCAT - RW sd rootmirror-03 var-02 rootmirror 15519840 2100000 0 c0t1d0 ENA
Remove the previous root volumes from VxVM:
# vxedit -rf rm rootvol swapvol var
Remove the root disk from VxVM:
# vxdg rmdisk rootdisk
Finally, restore the original vtoc to c0t0d0:
/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 0x2 0x200 0 13423200 1 0x3 0x201 13426560 2096640 2 0x5 0x200 0 17693760 3 0xe 0x201 0 17693760 4 0x7 0x200 15523200 2100000 5 0x0 0x200 0 0 6 0x0 0x200 0 0 7 0xf 0x201 17690400 3360 # THE NEW PARTITIONING WILL BE AS FOLLOWS : #SLICE TAG FLAGS START SIZE 0 0x2 0x200 0 13423200 1 0x3 0x201 13426560 2096640 2 0x5 0x200 0 17693760 3 0x0 0x200 0 0 4 0x7 0x200 15523200 2100000 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
At this point the root disk c0t0d0 is completely free of VxVM, but any other Veritas volumes can be brought online and mounted if required.