Mounting an lvm disk

LVM (Logical Volume Manager) is a wonderful thing. For those who find themselves doing a lot of partition resizing and shuffling of physical disks it can be very helpful. But mounting an LVM disk on another machine isn’t exactly an intuitive operation. Read one.

Rule number one to keep in mind is that you can’t mount two LVM volumes with the same name on the same machine. Ever. So if a volume on machine A is labelled “fedora-home” and a volume on machine B is labelled “fedora-home” they both can’t be mounted on either machine at the same time.

A good rule of thumb is to name your volumes for the host they reside on, or some other unique value (like a serial number, for example the date plus random digits: “2014080601-home”). Keep in mind that the only place the volume label shows up is in /etc/fstab and the output from the LVM utilties.

Note you can rename a volume, and if you’re moving one from another machine you’ll probably want to. This is something probably best done using a Live CD/DVD/USB stick.

Before you can mount an LVM disk you’ll want to gather some information.

Find all LVM volume groups:

vgscan

Activate:

vgchange -a -y [name of volume group]

To rename a volume:

vgrename [original name] [new name]

Keep in mind that if you do the above on a boot drive you’re going to have to go in and conform /etc/mtab and /etc/fstab to reflect the new volume names (I don’t recommend using LVM on a boot drive, and do encourage the use of an entirely separate physical disk for booting — modestly sized SSD drives are very fast, and now very cheap).

Mount the volume:

mount /dev/[volume name] /mnt
This entry was posted in System Administration on by .

About phil

My name is Phil Lembo. In my day job I’m an enterprise IT architect for a leading distribution and services company. The rest of my time I try to maintain a semi-normal family life in the suburbs of Raleigh, NC. E-mail me at philipATlembobrothersDOTcom. The opinions expressed here are entirely my own and not those of my employers, past, present or future (except where I quote others, who will need to accept responsibility for their own rants).