Tuesday, August 30, 2011

How to make LiveCD detect and mount LVM partition?


Reestablish Volume Group

To tap into the volume group you wish to work with, make sure /etc/lvm/lvm.conf filters are able to see the /dev/md? devices, and execute the following:
[tempsrv] # vgscan
Reading all physical volumes. This may take a while...
Found volume group "rootvg" using metadata type lvm2


which should display the volume group (here it is “rootvg”)associated with an md device you enabled. Then, to make the logical volumes (LVs) available for mounting, execute the following:
[tempsrv] # vgchange -ay rootvg

Now Mount the Logical Volumes:

Now all you need do is mount the reestablished LVs. I find this an excellent time to make use of Bash:
[tempsrv] # for i in `ls /dev/rootvg`; do mount /dev/rootvg/$i /mnt/$i; done;
Of course, you need to create the destination mount point before running the script.