How do I recover a lost LVM volume group, not found by vgscan and lvmdiskscan

13,304

I see this is an old question with no answers. But here are some pointers for those with a similar problem:

  • The fact that the partition table indicates the partition type as Linux LVM is no guarantee that the partition actually holds LVM data. The partition might have already been overwritten.
  • Try file -s /dev/sda2 to see whether the contents of the partition actually look like LVM PV data or not. The response should be similar to this (with different UUID and size values, of course):

    /dev/sda2: LVM2 PV (Linux Logical Volume Manager), UUID: xxxxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxxxx, size: <number>

  • If the partition contains a recognizable LVM PV, try pvdisplay -m /dev/sda2 to see if it actually contained the LV(s) you wish to recover. The output will be helpful in planning the next operations, so please add it to your question post.

  • If it looks like the partition has been overwritten (by e.g. a mis-aimed mkfs or pvcreate -ff), STOP doing anything that might write on the partition. You can try file recovery tools like PhotoRec or contact some file recovery professionals: in this case, whether anything can be recovered will depend on how thorough the overwrite operation was. If only the filesystem metadata was overwritten, it might be possible to salvage some files from the non-overwritten parts, but that requires specialized applications and possibly some in-depth knowledge of the structures of the LVM and the filesystem.

Share:
13,304

Related videos on Youtube

s-n-2
Author by

s-n-2

Updated on September 18, 2022

Comments

  • s-n-2
    s-n-2 over 1 year

    I have a post: How to copy the old disk data ?

    The answer is good, but did not help me. The answer user suggest me to open a new post there, because this is some difference.

    I tried to scan the system looking for my old volume group using vgscan, it could not find my old volume group.

    I also used lvmdiskscan to look for my old physical volume, unfortunately, lvmdiskscan could not find it. Below is the output of lvmdiskscan:

    [root@localhost mapper]# lvmdiskscan
      /dev/ram0             [      16.00 MiB] 
      /dev/loop0            [     930.53 GiB] 
      /dev/root             [      50.00 GiB] 
      /dev/ram1             [      16.00 MiB] 
      /dev/sda1             [     500.00 MiB] 
      /dev/VolGroup/lv_swap [       7.05 GiB] 
      /dev/ram2             [      16.00 MiB] 
      /dev/sda2             [     931.02 GiB] 
      /dev/VolGroup/lv_home [     873.97 GiB] 
      /dev/ram3             [      16.00 MiB] 
      /dev/ram4             [      16.00 MiB] 
      /dev/ram5             [      16.00 MiB] 
      /dev/ram6             [      16.00 MiB] 
      /dev/ram7             [      16.00 MiB] 
      /dev/ram8             [      16.00 MiB] 
      /dev/ram9             [      16.00 MiB] 
      /dev/ram10            [      16.00 MiB] 
      /dev/ram11            [      16.00 MiB] 
      /dev/ram12            [      16.00 MiB] 
      /dev/ram13            [      16.00 MiB] 
      /dev/ram14            [      16.00 MiB] 
      /dev/ram15            [      16.00 MiB] 
      /dev/sdb1             [     500.00 MiB] 
      /dev/sdb2             [     931.02 GiB] LVM physical volume
      3 disks
      20 partitions
      0 LVM physical volume whole disks
      1 LVM physical volume
    

    lvmdiskscan could only find one LVM physical volume, which is my new lvm installation which resides on /dev/sdb2.

    Here is the output of fdisk -l:

    [root@localhost mapper]# fdisk -l 
    
    Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
    255 heads, 63 sectors/track, 121601 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 4096 bytes
    I/O size (minimum/optimal): 4096 bytes / 4096 bytes
    Disk identifier: 0x2cbfcf8a
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1   *           1          64      512000   83  Linux
    Partition 1 does not end on cylinder boundary.
    /dev/sda2              64      121602   976248832   8e  Linux LVM
    
    Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
    255 heads, 63 sectors/track, 121601 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 4096 bytes
    I/O size (minimum/optimal): 4096 bytes / 4096 bytes
    Disk identifier: 0xe8a4e8a4
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1   *           1          64      512000   83  Linux
    Partition 1 does not end on cylinder boundary.
    /dev/sdb2              64      121602   976248832   8e  Linux LVM
    
    Disk /dev/mapper/VolGroup-lv_root: 53.7 GB, 53687091200 bytes
    255 heads, 63 sectors/track, 6527 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 4096 bytes
    

    /dev/sda2 is where my old lvm installation resides.