Recovering PV of Mirrored LVM--Jaylin Zhou
时间:2009-08-17 来源:rha030
Recovering PV of Mirrored LVM
Author:Jaylin Zhou
Now there are three PVs:
# pvs |
Create a VG with this three PVs:
# vgcreate /dev/myvg /dev/sdb[567] |
Check the status of VG:
# vgs |
Create a one-mirrored LV by putting the two mirror legs in /dev/sdb5 and /dev/sdb6, putting log in /dev/sdb7 :
# lvcreate -l 20 -n mylv -m1 /dev/myvg /dev/sdb5 /dev/sdb6 /dev/sdb7 |
Check the status of LV and find the mirrored LV is available:
# lvs -a -o +devices |
Make a file system on LV:
# mkfs.ext3 /dev/myvg/mylv |
Mount LV then add some data on it:
# mount /dev/myvg/mylv /mnt/ |
Destroy one mirror leg, in the example i.e. /dev/sdb5 :
# dd if=/dev/zero of=/dev/sdb5 count=10 |
Check the status of LV and find a device is unavailable:
# lvs |
Mount LV and it is still available:
# mount /dev/myvg/mylv /mnt/ |
Check the status of PVS and find an unknown device:
# pvs |
Make VG unavailable:
# vgchange -an /dev/myvg |
Recover the destroyed PV:
# pvcreate --uuid 'XTXw2z-p4LH-MBGd-AeG2-JNGx-r3nz-xz2lEH' --restorefile /etc/lvm/archive/myvg_00070.vg /dev/sdb5 |
Restore the VG's metadata:
# vgcfgrestore /dev/myvg |
Check the status of LV and find the destroyed mirror is normal, but the LV is unavailable:
# lvs -a -o +devices |
Make the LV available:
# lvchange -ay /dev/myvg/mylv |
Check the status of LV again and find the LV is available:
# lvs -a -o +devices |
Mount LV and find it is available:
# mount /dev/myvg/mylv /mnt/ |