User Tools

Site Tools


ubuntu:disk:recover_lvm_disks

Ubuntu - Disk - Recover LVM disks

If for some reason a disk cannot be read, the following may help.

  • Plug the disks in and try reading them.

List devices that may be used as physical volumes

sudo lvmdiskscan

lvmdiskscan scans all SCSI, (E)IDE disks, multiple devices and a bunch of other block devices in the system looking for LVM PVs.

returns

  /dev/loop0            [      89.12 MiB] 
  /dev/ubuntu-vg/root   [      <1.82 TiB] 
  /dev/loop1            [     <14.75 MiB] 
  /dev/sda1             [     512.00 MiB] 
  /dev/ubuntu-vg/swap_1 [     976.00 MiB] 
  /dev/loop2            [     408.69 MiB] 
  /dev/sda2             [      <1.82 TiB] LVM physical volume
  /dev/loop3            [    <323.86 MiB] 
  /dev/loop4            [      54.50 MiB] 
  /dev/loop5            [      89.10 MiB] 
  /dev/loop6            [    <140.67 MiB] 
  /dev/loop7            [    <156.04 MiB] 
  /dev/loop8            [      54.50 MiB] 
  /dev/loop9            [      42.80 MiB] 
  /dev/loop10           [      <4.20 MiB] 
  /dev/loop11           [    <156.68 MiB] 
  /dev/loop12           [    <323.72 MiB] 
  /dev/loop13           [      14.74 MiB] 
  /dev/loop14           [       3.64 MiB] 
  /dev/loop15           [    <140.67 MiB] 
  /dev/loop17           [     <44.18 MiB] 
  /dev/loop18           [       3.64 MiB] 
  /dev/loop20           [     396.69 MiB] 
  /dev/loop21           [      <4.20 MiB] 
  1 disk
  22 partitions
  0 LVM physical volume whole disks
  1 LVM physical volume

That last line shows that a LVM Physical Volume has been picked up. Good.


List all logical volumes in all volume groups

Get a list of volume names:

sudo lvscan

returns:

  ACTIVE            '/dev/ubuntu-vg/root' [<1.82 TiB] inherit
  ACTIVE            '/dev/ubuntu-vg/swap_1' [976.00 MiB] inherit

Install LVM2 tools, if needed

This step may or may not be required.

sudo apt install lvm2 

Verify your LVM partition(s) is/are detected.

sudo pvscan

returns

  PV /dev/sda2   VG ubuntu-vg       lvm2 [<1.82 TiB / 0    free]
  Total: 1 [<1.82 TiB] / in use: 1 [<1.82 TiB] / in no VG: 0 [0   ]

Scan for LVM Volume Group(s)

sudo vgscan

returns:

  Reading volume groups from cache.
  Found volume group "ubuntu-vg" using metadata type lvm2

Activate LVM Volume Group(s)

sudo vgchange -ay

The params to vgchange are:

a = activate
y = yes.  It will not prompt you.

Scan for available Logical Volumes

sudo lvscan

returns:

  ACTIVE            '/dev/ubuntu-vg/root' [<1.82 TiB] inherit
  ACTIVE            '/dev/ubuntu-vg/swap_1' [976.00 MiB] inherit

Mount the Logical Volume

This should allow you to access the data on the drive, by going to the MountPoint.

sudo mount /dev/YourVolGroup00/YourLogVol00 /YourMountPoint

ubuntu/disk/recover_lvm_disks.txt · Last modified: 2020/07/15 09:30 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki