Do I manually have to configure partitions to map to /dev/mapper when working with LVM?
I'm creating a brand, new RHEL 5 server (VM) from scratch and I'm configuring the various partitions to fit into LVM. This will be living on a SAN, and I have two other servers that will be coming down the pipe here soon as well, so I want to plan/prepare for them as well.
I'm looking at what the previous sys admin did and I see that /dev/mapper is coming into play.
While building the various physical, volume and logical volumes, do I have to do anything manually to point those to /dev/mapper? Or will that automatically map the varopis Volume Managers and Logical Volumes to it? The reason I ask is when I look at previous build servers, using the df -ha command I can see the various partitions that are pointing to /dev/mapper. Also can see this under /etc/fstab too.
On the brand new server, if I look at /dev/mapper, this is currently what I'm seeing:
[cmmiller@ameda4aisrx0111 mapper]$ ls -al
total 0
drwxr-xr-x 2 root root 100 Apr 21 13:50 .
drwxr-xr-x 11 root root 4500 Apr 22 09:10 ..
brw-rw---- 1 root disk 253, 0 Apr 21 13:50 VolGroup00-LogVol00
brw-rw---- 1 root disk 253, 1 Apr 21 13:50 VolGroup00-LogVol01
crw------- 1 root root 10, 60 Apr 21 13:50 control
[cmmiller@ameda4aisrx0111 mapper]$
To me, it looks like VolGroup00, Logical Volume 00 and Logical Volume 01 automatically mapped to /dev/mapper. So far I don't see any partitions mapped to either of these along with nothing under /etc/fstab.
thanks
Responses
You don't need to create partitions in LVM volumes.
When you have a traditional block device like /dev/sda you create partitions to act as "containers" for filesystems. For example, you might create an ext3 filesystem in /dev/sda1 and mount that at /boot, then you might create another ext3 filesystem in /dev/sda2 and mount that at /.
When you use Logical Volume Manager, you're abstracting away the concept of a single block device. You don't really care where the data ends up, you just use the container and let LVM worry about the rest. So your Logical Volume /dev/mapper/VolGroup00-LogVol01 is the container for the filesystem.
You can add your SAN storage as LVM Physical Volumes, create a Volume Group on them, create new Logical Volumes in that Volume Group, then use those LVs as containers for filesystems.
Your fstab might then contain a line like:
/dev/mapper/vg_data-lv_data /data ext3 defaults,noatime 0 0
You don't have to call them "VolGroupXX" or "LogVolXX", you can call them something like "vg_data" or "backupvg" and "lv_data" or "backuplv". You don't have to include "vg" or "lv" in the name, but I think this is good practice to keep track of things.
You might want to browse along to the LVM Admin Guide in the product documentation to learn more. I'll include the RHEL6 version here because it's significantly longer than the RHEL5 version:
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html-single/Logical_Volume_Manager_Administration/
Aside, rolling out a brand new RHEL5 system may not be what you want. RHEL5 is in the wind-down part of its product lifecycle and is no longer getting regular updates. The current versions to deploy are RHEL6 and RHEL7.
You can read more about the product lifecycle at: https://access.redhat.com/support/policy/updates/errata/
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
