分类:
2010-05-27 21:31:15
How to recover VERITAS Volume Manager (tm) configuration information by using the Volume Manager utility "vxprivutil dumpconfig"
Details:
1. Select a disk and extract the configuration information from the private region using vxprivutil:
Use /etc/vx/diag.d/vxprivutil list
Example:
/etc/vx/diag.d/vxprivutil list /dev/dsk/c?t?d?s# For Sliced disk Solaris OS- where # is the private slice number
/etc/vx/diag.d/vxprivutil list /dev/dsk/c?t?d?s2 For CDS disk Solaris OS- where # is the private slice number
/etc/vx/diag.d/vxprivutil list /dev/dsk/c?t?d? For HP-UX operating system only
Example:
#/etc/vx/diag.d/vxprivutil list /dev/dsk/c2t14d0s3 For Solaris OS sliced disk
#/etc/vx/diag.d/vxprivutil list /dev/dsk/c2t14d0s2 For Solaris OS CDS disk
#/etc/vx/diag.d/vxprivutil list /dev/dsk/c2t14d0 For HP-UX operating system Only
Note: The private region also can be located with the prtvtoc command. The partition with a tag 15 is the private region on a sliced disk. On a CDS disk the private and public region are combined and there is only tag 15. On an HP-UX operating system, there is no prtvtoc command or tag 15.
Dump the configuration copy to a file:
/etc/vx/diag.d/vxprivutil dumpconfig /dev/rdsk/c?t?d?s# > file_name - Solaris OS
/etc/vx/diag.d/vxprivutil dumpconfig /dev/rdsk/c?t?d? > file_name - HP-UX OS
Example:
# /etc/vx/diag.d/vxprivutil dumpconfig /dev/dsk/c2t14d0s3 > config.out - Solaris OS for sliced disk
# /etc/vx/diag.d/vxprivutil dumpconfig /dev/dsk/c2t14d0s2 > config.out - Solaris OS for CDS cdsdisk
# /etc/vx/diag.d/vxprivutil dumpconfig /dev/dsk/c2t14d0 > config.out - HP-UX OS
2. Check the extracted configuration to see if it appears valid. In some cases, there will be duplicate Volume Manager objects that will need to be removed:
# cat config1.out | vxprint -D - -ht
3. Create a script file to use as input for vxdg, to create (if needed) the diskgroup, and add the disks:
# cat config1.out | vxprint -D - -d -F "vxdg -g
4. Run prtvtoc on all the disks in the diskgroup. Check the Volume Manager public and private region offsets. This step is not needed for HP-UX OS.
/usr/sbin/prtvtoc /dev/dsk/c?t?d?s2
Example:
# /usr/sbin/prtvtoc /dev/dsk/c2t14d0s2
Warning: The following vxdisksetup in step 5 initializes the disks to all default settings only. If anything is not set to default, like the privlen, publen, etc, use:
vxdisk -f init
Example:
# vxdisk -f init c2t14d0
# vxdisk -f init c2t15d0
Note: Please beware that the private region length has been increased in Volume Manager 3.2 and later. If one is trying to restore a diskgroup that was created under Volume Manager 3.1.1 and earlier (diskgroup version 80 and earlier), using 3.2 or later vxdisksetup with a bigger private region length, then one could lose some data due to the overlapping of the private and public regions. Please refer to "Full Disk Mirroring Considerations" procedure in the release notes of Volume Manager 3.5 for further details.
5. Run these commands in ksh/sh if all the disks listed in config1.sh needs to be re-initialized under Volume Manager, but check the warning first
# for i in ` awk -F= '{print $2}' config1.sh | awk -Fs '{print $1}' ` ; do
/etc/vx/bin/vxdisksetup -i $i
done
6. This line will initialize the diskgroup with the same name and add the first disk to the diskgroup
# vxdg init ` head -1 config1.sh | awk '{print $3,$5}' `
Or just use the first disk listing in config1.sh generated by step 3 to initialize the diskgroup.
# vxdg init
7. Add the rest of the disks back to the diskgroup, except the first disk, because the first disk is added in step 4
# eval ` tail +2 config1.sh | awk '{print $0";"}' `
If the above command is confusing, just edit config1.sh to delete the first line, save the new changes, make config1.sh executable, and run it to add the rest of the disks back to the diskgroup.
8. Use the output from dumpconfig as input to vxprint to make a copy that vxmake can use:
# cat config1.out | vxprint -D - -mpvsh > config2.out
For Volume Manager 3.x or later, it is necessary to add an " r " , for example:
# cat config1.out | vxprint -D - -mpvshr > config2.out
9. Use the configuration information saved in config2.out as input to vxmake:
# vxmake -g `head -1 config1.sh | awk '{print $3}' ` -d config2.out
Or just plug in the diskgroup name
# vxmake -g
10. Set the volume and plex states to "clean" so that the volumes can be started:
# vxvol -g
11. Start the volumes:
# vxvol -g
Use delay recovery to immediately start the volume if it has mirrored or RAID 5 plexes. This will allow for testing the validity of the data. Also, for mirrored volumes, one of the plexes should be switched "off" to provide for data recovery from either plex.
12. Mount the file systems on the started volumes after running an fsck on them first, and then verify
fsck -F vxfs /dev/vx/rdsk/
mount -F vxfs /dev/vx/dsk/
df -k
Example:
# fsck -F vxfs /dev/vx/rdsk/tesdg/testvol
# mount -F vxfs /dev/vx/dsk/tesdg/tesvol /testvol
# df -k /testvol