When Good Disks Go Bad: Dealing with Disk Failures Under LVM (5900-3153, June 2013)

27
# umount /dev/vg01/lvol1
umount: cannot unmount /dump : Device busy
# fuser -u /dev/vg01/lvol1
/dev/vg01/lvol1: 27815c(root) 27184c(root)
# ps -fp27815 -p27184
UID PID PPID C STIME TTY TIME COMMAND
root 27815 27184 0 09:04:05 pts/0 0:00 vi test.c
root 27184 27182 0 08:26:24 pts/0 0:00 -sh
# fuser -ku /dev/vg01/lvol1
/dev/vg01/lvol1: 27815c(root) 27184c(root)
# umount /dev/vg01/lvol1
For this example, it is assumed that you are permitted to halt access to the entire volume group while
you recover the disk. Use vgchange to deactivate the volume group and stop LVM from accessing
the disk:
# vgchange a n vg01
Proceed with the disk replacement and recover data from backup:
# <replace the hot-swappable disk>
# vgcfgrestore n vg01 /dev/rdsk/c2t2d0
# vgchange a y vg01
# newfs [options] /dev/vg01/rlvol1
# mount /dev/vg01/lvol1 /dump
# <restore the file system from backup>
Scenario 3: No Hot-Swappable Disk
In this example, the disk is not hot-swappable, so you must reboot the system to replace it. Once
again, the bad disk is represented by device special file /dev/dsk/c2t2d0. Enter the following
commands:
# lvlnboot v
Boot Definitions for Volume Group /dev/vg00:
Physical Volumes belonging in Root Volume Group:
/dev/dsk/c0t5d0 (0/0/0/3/0.5.0) -- Boot Disk
Boot: lvol1 on: /dev/dsk/c0t5d0
Root: lvol3 on: /dev/dsk/c0t5d0
Swap: lvol2 on: /dev/dsk/c0t5d0
Dump: lvol2 on: /dev/dsk/c0t5d0, 0
# pvdisplay v /dev/dsk/c2t2d0 | more
--- Distribution of physical volume ---
LV Name LE of LV PE for LV
/dev/vg01/lvol1 4340 4340
# lvdisplay v /dev/vg01/lvol1 | grep “Mirror copies”
Mirror copies 0
This confirms that the logical volume is not mirrored, and it is not in the root volume group. Shutting
down the system disables access to the disk, so you do not need to determine who is using the logical
volume.
# shutdown h
# <replace the disk>
# <reboot normally>
# vgcfgrestore n vg01 /dev/rdsk/c2t2d0
# vgchange a y vg01