1. Check the LVM partitioned disk
fdisk -l
Example
[root@server ~]# fdisk -l
Disk /dev/hda: 82.3 GB, 82348277760 bytes
255 heads, 63 sectors/track, 10011 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 267 2040255 82 Linux swap
/dev/hda3 268 10011 78268680 83 Linux
Disk /dev/hdc: 82.3 GB, 82348277760 bytes
255 heads, 63 sectors/track, 10011 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hdc1 * 1 13 104391 83 Linux
/dev/hdc2 14 10011 80308935 8e Linux LVM
Clearly from the last line /dev/hdc2 had partitioned in lvm format
Note: The module dm-mod should be compiled in with the kernel to support lvm format, check this using
lsmod
and if not present add the modules using
modprobe dm-mod
(When configuring the kernel, make sure to configure the kernel to support LVM)
2. Check for volume groups (VG)
vgscan
Example
[root@server ~]# vgscan
Reading all physical volumes. This may take a while…
Found volume group “VolGroup00″ using metadata type lvm2
Here the available volume group is VolGroup00, it may be different (say vg0 ) as setup in a disk. If there are more than one volume group they may be named as VolGroup01 or vg1, VolGroup02 or vg2 …
3. Check for physical volumes (PV)
pvscan
Example
[root@server ~]# pvscan
PV /dev/hdc2 VG VolGroup00 lvm2 [76.56 GB / 32.00 MB free]
Total: 1 [76.56 GB] / in use: 1 [76.56 GB] / in no VG: 0 [0 ]
4. Activate the volume group
vgchange VolGroup00 -a y
Example
[root@server ~]# vgchange VolGroup00 -a y
2 logical volume(s) in volume group “VolGroup00″ now active
The above command actually make the volume group VolGroup00 known to the kernel and after this the device is mapped to the logical volumes in volume groups. If there are more than one volume group and want to activate all, we have to modify the command as below
vgchange -a y
As per the output in the above example two logical volumes are active, we can verify as follows
[root@server ~]# cd /dev/VolGroup00/
[root@server VolGroup00]# ll
total 0
lrwxrwxrwx 1 root root 31 Jun 29 10:33 LogVol00 -> /dev/mapper/VolGroup00-LogVol00
lrwxrwxrwx 1 root root 31 Jun 29 10:33 LogVol01 -> /dev/mapper/VolGroup00-LogVol01
5. Mount the partition
mkdir /mnt/old
mount /dev/VolGroup00/LogVol00 /mnt/old
Example
[root@server ~]# mount /dev/VolGroup00/LogVol00 /mnt/old/
[root@server ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda3 74G 16G 55G 22% /
/dev/hda1 99M 17M 77M 18% /boot
/usr/tmpDSK 485M 13M 447M 3% /tmp
/tmp 485M 13M 447M 3% /var/tmp
/dev/mapper/VolGroup00-LogVol00
74G 16G 54G 23% /mnt/old