There are 3 ways to replace a failed disk under volume manager
control:
1.) The GUI
2.) vxdiskadm
3.) the cli
The first 2 are well documented elsewhere, but the last one is
not. It is actually very simple and would lend itself well to
scripting.
The Process:
1.) Find the failed disk
# vxdisk list | grep failed
2.) Physically remove the disk
(Do the following if it is an FC disk)
# luxadm remove_device <enc>,<pos> (or WWN, use format)
3.) Remove disk from vxvm config
# vxdg -g <dg> -k rmdisk <dm_name>
# vxdisk rm <disk>
4.) Physically insert the disk
(If a fibre disk do this step)
# luxadm insert
5.) Have vxvm rebuild it's config database
# vxdctl enable
6.) Reinitialize the disk
# /etc/vx/bin/vxdisksetup -i <ctd>
7.) Add the disk back into the disk group
# vxdg -g <dg> -k adddisk <dm_name>=<ctd>
This is a decision point:
Mirrored boot disk?
8.) Use vxmirror so the bootblock gets created
# vxmirror -v -V -g rootdg rootmirror rootdisk
(NOTE - this will only mirror /, /usr, /var, and /swap, if
you have other volumes, either use vxdiskadm or use vxassist to
mirror the rest after this finishes)
9.) For FC disks you need to change the boot alias to reflect the new WWN.
View and save the aliases:
# eeprom nvramrc 2> /dev/null | sed -e "1s/nvramrc=//p" -e 1d
Use vxeeprom to remove, then re-add the alias for the bootdisk
# vxeeprom devunalias <dm_name>
# vxeeprom devalias vx-<root or mirror> /dev/dsk/c#t#d#
The changes will show up after the next reboot.
Standard mirrored data disk?
8.) Start the recovery in the background
# vxrecover -sb
You should be back in action, "vxtask list" should list the plex
attach tasks.
There is one more step if this is a mirrored, encapsulated, boot
disk. Run the vxmksdpart command to create the hard slices.
10.) VXMKSDPART DOCUMENTED:
NOTE - I use c0t0d0s0 and rootdisk only as examples this
procedure will work for either disk.
Vxmksdpart writes the hard slices using the following syntax:
Usage: vxmksdpart [-f] [-g diskgroup] subdisk sliceno [tag flags]
"tag and flag" In the prtvtoc and fmthard manpage
VAR ="0x07 0x00"
USR ="0x04 0x00"
SWAP ="0x03 0x01"
HOME ="0x08 0x00"
UNASG ="0x00 0x00"
"sliceno" What disk slice you want to put the
partition on - match to vfstab
"subdisk" Use the vxprint command below to get
the volume -> subdisk mapping. Where
<dm_name> is rootdisk and rootmirror.
# vxprint -Q -g rootdg -e "pl_sd.sd_dm_name == \"rootdisk\"" -p -F "%{name:-14} %{sdaslist}"
Example for rootdisk:
rootvol-01 rootdisk-01:0
swapvol-01 rootdisk-02:0
var-01 rootdisk-03:0
The vxmksdpart commands would be (the root slice is always there):
swap
# vxmksdpart -g rootdg rootdisk-02 1 0x03 0x01
var
# vxmksdpart -g rootdg rootdisk-03 5 0x07 0x00
* Now that you have a valid vtoc - save it off to a file!
# prtvtoc /dev/dsk/c0t0d0s2 > /var/tmp/vtoc_c0t0.sav++++++++++++++++++++++++
MOVING A "SIMPLE" VOLUME FROM ONE DG TO ANOTHER
(this was modified from Infodoc 14166 to add CLI options)
You can use this as a basis for more complex operations of a
relevant nature. Be aware that the disk can not be removed from
the current dg unless all sub-disks have been cleared.
Note: To provide an extra measure of security you should back-up
the data first.
1) Unmount the file system and/or kill the application(s) to stop all
i/o to the volume.
2) Save off the volume configuration.
# vxprint -g <dg_name> -hmvps <vol_name> > <file_name>
3) Remove the volume recursively.
GUI:
highlight the volume
basic_ops -> vol_ops -> remove volume recursively
CLI:
# vxedit -rf rm <vol_name>
4) Verify that no additional sub-disks reside on the VM disk/s and
remove it/them from the dg.
GUI:
highlight the vm disk
adv_ops -> disk_group -> remove_disks
CLI:
# vxdg -g <dg> rmdisk <dm_name> (for each disk)
5) Add the disk/s to the new disk group using the original disk
media name/s.
GUI:
bring up a view of the ssa
highlight the appropriate disk
commands -> volume_manager -> add_disk
a pop-up window appears. This is where you change the
default name to be the original dm_name.
CLI:
(if dg already exists)
# vxdg -g <dg> adddisk <dm_name>=<ctd>
(if you need to create one)
# vxdg init <dg> <dm_name>=<ctd>
6) Re-create the volume in the new DG.
# vxmake -g <dg> -d <file_name>
7) Start the volume (you may need to change it's state "vxmend"
or force start it).
GUI:
highlight the volume
adv_ops -> volume -> start_volumes -> start
CLI:
# vxvol -f start <vol_name>
8) Update vfstab to reflect new dev/vx path.+++++++++++++++++++++++++
VxVM Plex STATES and State Transition Commands
Plex State Transition Flowchart
Object Kernel State Plex State Transition Commands
plex DISABLED ACTIVE vxplex (-f) att vol plex
plex DETACHED IOFAIL vxmend fix clean plex
vxmend fix active plex
vxplex (-f) att vol plex
vxvol (-f) start
plex DETACHED IOFAIL vxmend fix empty plex
vxmend fix clean plex
vxmend fix active plex
vxplex (-f) att vol plex
plex DISABLED RECOVER vxtask list
- Should be a recovery
process running
plex DISABLED IOFAIL vxvol -f start volname
plex STALE ACTIVE vxplex dis plex
vxplex (-f) att vol plex
plex DISABLED STALE vxtask list
- Should be fixing itself
Otherwise:
vxplex dis plex
vxplex (-f) att vol plex
plex ENABLED STALE vxtask list
- Should be fixing itself
Otherwise:
vxplex dis plex
vxplex (-f) att vol plex
plex ENABLED DEGRADED Enters this state if disk was just added to a RAID
plex ENABLED RECOVER vxtask list
REGEN - Should be fixing itself
plex/volume
DISABLED EMPTY The volume is iether sparse (volume lager
than plex contiguous space) or the the state
is just incorrect. see SRDB ID: 20563
vxvol -f start <vol>
For LOGGING plexs
plex DISABLED STALE vxplex dis <logplex>
vxedit -rf rm <logplex>
vxassist -g <diskdg> addlog <vol> <disk>