How to mount LVM volume from an external hard disk on CentOS?

On Fedora, after inserting/plugging in an exteranl hard disk with LVM partitions on it, the partitions will appear under /dev like /dev/lvm-group/lvm-partition.

However, on CentOS 6, the LVM volumes do not appear automatically. How to mount LVM partitions from an external hard disk on CentOS?

What you need on CentOS is to activate the LVM volumes by the vgchange command

# vgchange -aay

About the options:

-a, –activate [a|e|l]{y|n}

Controls the availability of the logical volumes in the volume group for input/output. In other words, makes the logical volumes known/unknown to the kernel. If autoactivation option is used (-aay), each logical volume in the volume group is activated only if it matches an item in the activation/auto_activation_volume_list set in lvm.conf. If this list is not set, then all volumes are considered for activation. The -aay option should be also used during system boot so it’s possible to select which volumes to activate using the activation/auto_activation_volume_list settting.

Activation of a logical volume creates a symbolic link /dev/VolumeGroupName/LogicalVolumeName pointing to the device node. This link is removed on deactivation. All software and scripts should access the device through this symbolic link and present this as the name of the device. The location and name of the underlying device node may depend on the distribution and configuration (e.g. udev) and might change from release to release.

If clustered locking is enabled, add ‘e’ to activate/deactivate exclusively on one node or ‘l’ to activate/deactivate only on the local node. Logical volumes with single-host snapshots are always activated exclusively because they can only be used on one node at once.

Then you should be able to find the LVM volume at /dev/VolumeGroupName/LogicalVolumeName and you can mount them as usual.

Eric Ma

Eric is a systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.

Leave a Reply

Your email address will not be published. Required fields are marked *