Mount LVM Partition in Rescue Mode

Usually, for the system repair purposes, such as troubleshooting of the boot-related issues (e.g. GRUB rescue) or for data recovery, it is required to know how to mount an LVM partition in a live Linux session (when a system boots from a live CD/DVD or from a special rescue USB stick).

In this article i will show how to identify volume groups and logical volumes on an “external” drive and how to mount the discovered LVM partitions in a rescue mode and get access to the data.

Cool Tip: How to create a Linux rescue USB stick! Read more →

Mount LVM Partition in Rescue Mode

Boot from the rescue media (this can be a special SystemRescue USB stick or a simple live USB with Ubuntu or Linux Mint or any other system with a Linux shell prompt).

Scan for the volume groups:

# lvm vgscan -v
-- sample output --
  Found volume group "vgubuntu" using metadata type lvm2
  Archiving volume group "vgubuntu" metadata (seqno 3).
  Creating volume group backup "/etc/lvm/backup/vgubuntu" (seqno 3).

Above output indicates that I have a “vgubuntu” LVM group. To activate it, run:

# vgchange -a y "vgubuntu"
-- sample output --
  2 logical volume(s) in volume group "vgubuntu" now active

List the logical volumes:

# lvm lvs --all
-- sample output --
  LV     VG       Attr       LSize   Pool Origin Data% ...
  root   vgubuntu -wi-ao---- 114,02g                                                    
  swap_1 vgubuntu -wi-ao---- 980,00m         

To get access to the “root” LVM partition – create a mount point and mount the “root” logical volume as follows:

# mkdir -p /mnt/root
# mount /dev/vgubuntu/root /mnt/root/
# ls -al /mnt/root/
-- sample output --
total 80
drwxr-xr-x  19 root root  4096 Sep 30 20:38 .
drwxr-xr-x  19 root root  4096 Sep 30 20:38 ..
lrwxrwxrwx   1 root root     7 Sep 30 20:34 bin -> usr/bin
drwxr-xr-x   4 root root  4096 Oct  6 17:09 boot
drwxr-xr-x   2 root root  4096 Sep 30 20:38 cdrom
drwxr-xr-x  22 root root  4480 Nov 21 21:53 dev
drwxr-xr-x 152 root root 12288 Nov 21 15:31 etc
drwxr-xr-x   4 root root  4096 Oct  7 20:22 home
lrwxrwxrwx   1 root root     7 Sep 30 20:34 lib -> usr/lib
lrwxrwxrwx   1 root root     9 Sep 30 20:34 lib32 -> usr/lib32
lrwxrwxrwx   1 root root     9 Sep 30 20:34 lib64 -> usr/lib64
lrwxrwxrwx   1 root root    10 Sep 30 20:34 libx32 -> usr/libx32
drwx------   2 root root 16384 Sep 30 20:34 lost+found
...

Cool Tip: How reinstall GRUB from Live USB with UEFI + LVM! Read more →

Leave a Reply