LVM: mounting LVM partitions

From FreekiWiki
Revision as of 13:38, 22 February 2013 by Paulm (talk | contribs)
Jump to navigation Jump to search

Some hard drives now come configured with LVM (Logical Volume Manager). These need to be mounted using a special process.

First you need to ensure you have the relevant tools:

   sudo apt-get install lvm2

Then run fdisk to make sure the drive is recognised

   sudo fdisk -l

Now run pvscan to scan all for LVM physical volumes on the installed hard drives .

   sudo pvscan

       PV /dev/sda2 VG VolGroup00 lvm2 [74.41 GB / 32.00 MB free]
       Total: 1 [74.41 GB] / in use: 1 [74.41 GB] / in no VG: 0 [0 ]

Next run vgscan to detect LVM logical volumes (with LVM a partition can span more than one physical disk)

   vgscan

       Reading all physical volumes. This may take a while...
       Found volume group "VolGroup00" using metadata type lvm2

Now activate these using vgchange

   vgchange -a y

       2 logical volume(s) in volume group "VolGroup00" now active

Then you can run lvscan to detect the logical volumes. You will see the active partitions on the disks. You can also use lvdisplay which gives mor edetailed information.

    lvscan

       ACTIVE '/dev/VolGroup00/LogVol00' [72.44 GB] inherit
       ACTIVE '/dev/VolGroup00/LogVol01' [1.94 GB] inherit

You will now be able to mount the partition

   mount /dev/VolGroup00/LogVol00 /mnt

   (often mount /dev/mapper/freegeek-root /mnt )