Recover Lvm From Pv

Home » CentOS » Recover Lvm From Pv
CentOS 11 Comments

I have a vanilla CentOS 5.9 system. I have a pair of 2Tb sata drives with a RAID 1 array on them. This array contains an LVM physical volume. I have added these two drives to my system and now need to access the volume group on this physical volume. This volume group, vg0, contains 10 ext3 file systems and I need to get the data from them.

What do I know:

[root@mickey ~]# pvscan
PV /dev/sda2 VG VolGroup00 lvm2 [465.66 GB / 0 free]
PV /dev/sdb1 VG VolGroup00 lvm2 [465.75 GB / 0 free]
PV /dev/md125 lvm2 [1.81 TB]
Total: 3 [2.72 TB] / in use: 2 [931.41 GB] / in no VG: 1 [1.81 TB]
[root@mickey ~]#

The first two contain the running system. The third one, /dev/md125 is my lvm physical volume.

[root@mickey ~]# pvdisplay
——— snip first two pvs —–

11 thoughts on - Recover Lvm From Pv

  • After the ‘vchange -a y’ you ‘ls /dev/LVM_GRP_NAME/’ to get the mount points then

    mount /dev/LVM_GRP_NAME/VOL_NAME /mnt/whatever

    At least that is what I do for regular LVM partitions that I need to rescue.

  • [root@mickey www]# vgscan
    Reading all physical volumes. This may take a while…
    Found volume group “VolGroup00” using metadata type lvm2
    [root@mickey www]# vgchange -a y
    2 logical volume(s) in volume group “VolGroup00” now active
    [root@mickey www]#

  • Do both Volume Groups on those two sets of disks have the same name?
    VolGroup00

    That’s odd /dev/md125 doesn’t have a VG name associated with it…
    * You might consider booting to a rescue environment with the 2TB disks in a separate system. Find out what the VG name is and maybe even just recover the data you need from the rescue environment … rsync is your friend.

  • Actually, no. The VolGroup00 name is associated with the running system. It’s the default name when you install CentOS with the default option. The vol group on the other disks is “vg0” and is the name I used when I created the system several years ago.

    Harold

  • I would have expected that to show as a result of the vgscan and vgchange commands. Does RAID change things wrt LVM appareance to the system?

  • OK, I have just written off the disks as corrupt. I put in another pair with yet another raid LV on them. This time I was able to successfully mount the data.

    Something like this:

    After assembling the raid array from the two disks with

    mdadm –assemble /dev/md125 /dev/sdc3 /dev/sdd3

    [root@mickey ~]# cat /proc/mdstat Personalities : [raid1]
    md125 : active raid1 sdc3[0] sdd3[1]
    2925020024 blocks super 1.0 [2/2] [UU]
    [=>……………….] resync = 8.5% (249426816/2925020024) finish57.5min speed4707K/sec

    unused devices:

    [root@mickey ~]# vgscan
    Reading all physical volumes. This may take a while…
    Found volume group “rvg” using metadata type lvm2
    Found volume group “VolGroup00” using metadata type lvm2

    [root@mickey ~]# vgchange -a y
    10 logical volume(s) in volume group “rvg” now active
    2 logical volume(s) in volume group “VolGroup00” now active

    [root@mickey ~]# pvscan
    PV /dev/md125 VG rvg lvm2 [2.72 TB / 1.66 TB free]
    PV /dev/sda2 VG VolGroup00 lvm2 [465.66 GB / 0 free]
    PV /dev/sdb1 VG VolGroup00 lvm2 [465.75 GB / 0 free]
    Total: 3 [3.63 TB] / in use: 3 [3.63 TB] / in no VG: 0 [0 ]

    [root@mickey ~]# lvscan
    inactive ‘/dev/rvg/lv00’ [1.00 GB] inherit
    inactive ‘/dev/rvg/lv08’ [10.00 GB] inherit
    inactive ‘/dev/rvg/lv09’ [1000.00 GB] inherit
    inactive ‘/dev/rvg/lv04’ [20.00 GB] inherit
    inactive ‘/dev/rvg/lv03’ [2.00 GB] inherit
    inactive ‘/dev/rvg/lv02’ [4.00 GB] inherit
    inactive ‘/dev/rvg/lv06’ [40.00 GB] inherit
    inactive ‘/dev/rvg/lv07’ [10.00 GB] inherit
    inactive ‘/dev/rvg/lv01’ [5.00 GB] inherit
    inactive ‘/dev/rvg/lv05’ [512.00 MB] inherit
    ACTIVE ‘/dev/VolGroup00/LogVol00’ [925.75 GB] inherit
    ACTIVE ‘/dev/VolGroup00/LogVol01’ [5.66 GB] inherit

    [root@mickey ~]# ls /dev/rvg lv00 lv01 lv02 lv03 lv04 lv05 lv06 lv07 lv08 lv09

    [root@mickey ~]# mount /dev/rvg/lv00 /mnt

    [root@mickey ~]# ls /mnt big dev lib media opt sbin sys usr bin etc lib64 misc proc selinux TFTPboot var boot home lost+found mnt root srv tmp

    [root@mickey ~]#

LEAVE A COMMENT