Mounting a secondary LVM drive, etc.

This is something I’d written awhile ago when using Centos. It should apply to Scientific Linux, as well.

Here’s a little update, too. If your using a Linux live CD (eg. Slax) to recover files from a hard drive with a LVM partition these commands are handy as well. You can run the following to activate the partition for mounting::

lvm lvscan
lvm vgchange -ay

Adding a slave drive with an LVM master

With only the secondary drive attached, place a Centos cd/dvd in the optical drive and type rescue mode at the boot prompt.

You will be asked some questions, the most important being about activating the LVM partitions – you do not want to activate LVM volumes at this point.

Now, type:

lvm lvscan

You will, normally, see a LVM group with the name VolGroup00.

Very likely both of your hard drives will have LVM partitions that have the same names – usually “VolGroup00”. This won’t work, so do something like this to rename the secondary drives partition:

lvm vgrename VolGroup00 VolGroup07

I created a directory call /harddisk2, and, added the following to rc.local to mount the second hard drive at boot time:

lvm lvscan
lvm vgchange -ay
mount /dev/VolGroup07/LogVol00 /harddisk2

Further, to mount a specific directory (in this case, /etc) on the second hard drive the following works, although I haven’t tried it in rc.local yet:

mount --bind /harddisk2/etc /mount2

UPDATE: the above does work in rc.local, and, adding the mounted directory as a share in smb.conf worked, as well. I assume you should probably start smbd and nmbd after the LVM activation, mount, etc. My rc.local file looks like this:

touch /var/lock/subsys/local
lvm lvscan
lvm vgchange -ay
mount /dev/VolGroup07/LogVol00 /harddisk2
mount --bind /harddisk2/stuff /mount2
/usr/sbin/smbd start
/usr/sbin/nmbd start
/etc/rc.d/mysql.server start
/usr/local/apache2/bin/apachectl start

Leave a Reply