in Blog-en, IT-en

Backing up data from an LVM partition

If you need to access some files on a partition that was formatted with LVM, you can follow this procedure:

1. Get a live CD and boot from it. Here I’m using a Kubuntu live CD, which means all my commands will be done with sudo. Otherwise run from root.

2. Install LVM

sudo apt-get install lvm2

3. Find your partition with fdisk

sudo fdisk -l

4. Use pvscan to scan all disks for physical volume

sudo pvscan
  PV /dev/sda5   VG kubuntu-vg      lvm2 [111.55 GiB / 0    free]
  Total: 1 [111.55 GiB] / in use: 1 [111.55 GiB] / in no VG: 0 [0   ]

5. Use vgscan to scan all disks for volume groups

sudo vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "kubuntu-vg" using metadata type lvm

6. Activate all volume groups available.

sudo vgchange -a y
  2 logical volume(s) in volume group "kubuntu-vg" now active

7. Use lvscan to scan all disks for logical volumes

sudo lvscan
  ACTIVE            '/dev/kubuntu-vg/root' [103.55 GiB] inherit
  ACTIVE            '/dev/kubuntu-vg/swap_1' [8.00 GiB] inherit

8. Create a mounting point and mount the partition that you need to access

sudo mkdir /mnt/kubuntu-vg-root
sudo mount /dev/kubuntu-vg/root /mnt/kubuntu-vg-root

9. You can access the partition in the directory and can backup your data

This information was initially found on: http://www.linuxwave.info/2007/11/mounting-lvm-disk-using-ubuntu-livecd.html

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.