How to mount LVM partitions

Q I'm working on upgrading our school computers to Fedora. Up until now we were on Fedora, which seems to use ext3. Basically, I set up one computer on FC4 and do all the upgrades. Then I do a minimal install on the other drives (to correctly partition them) before transferring the files across by mounting the drives as secondary in my main computer for the operation (I can put both drives in my computer at the same time, performing the main file swapping operation using a Knoppix CD) Problem: while the /dev/hdb1 directory (Grub boot partition) can be mounted, the /dev/hdb2 cannot. Attempts to mount /dev/hdb2 result in reports that /dev/hdb2 is already in use or cannot be mounted. When I launch Parted it does not show a filetype for the /dev/hdb2 partition. Launching Fdisk shows that it is of type 8e - 'Linux LVM' format. How do I mount a partition that has been written in LVM format? Is it simply a -t option to the mount command? Please give me an example if it is.

A You do not mount an LVM partition directly. This is a container holding the data for the logical partitions, which are what you need to mount. Knoppix does not support LVM, so either use Recovery Is Possible (RIP, or a Gentoo install disc. After booting from the RIP disc, you need to type

sh /etc/rd.d/rc.lvm2 start

Type lvdisplay to see a list of your logical partitions. Each one will have a device name in the form: /dev/volume-group/volume-name. Use that to mount the logical volume, eg:

mount /dev/vg0/vol1 /mnt/otherroot

However, if both disks have been prepared by the Fedora installer, they will both have the same volume group name of VolGroup00, so you will not be able to access both at the same time. Remove the slave disc or disable it in the BIOS, then type

vgchange --available n
vgrename VolGroup00 VolGroup01

Reconnect the slave drive and type

vgchange --available y

Now your master drive's LVM partitions will be in /dev/VolGroup01 with the slave's partitions in /dev/VolGroup00. You could use a more descriptive name for the master drive's volume group if you prefer. You will need to edit /etc/fstab to reflect the changed names so that you can still boot into Fedora.

Follow us on or Twitter

Username:   Password:
Create Account | About TuxRadar