-
Notifications
You must be signed in to change notification settings - Fork 59
33_LVM_Configuration
The Logical Volume Manager in Linux is a time-tested, stable piece of software. Its used by default on installs in big-name Linux distributions and has proven its usefulness. In ESOS, LVM a very helpful layer when use between the back-end storage devices, and SCST targets. It allows one to partition and manage back-storage easily, and includes advanced features like snapshots. There is lots of great information on using LVM2 on the web, so we definitely won't try to cover everything here. We'll provide a few brief examples below.
The clvmd daemon is also included with ESOS. This service is utilized when using LVM2 in a cluster; it prevents concurrent metadata updates from different nodes on shared storage (eg, using DRBD). The clvmd service is disabled by default. The clvmd daemon uses DLM for locking and requires a working Corosync cluster. To enable clvmd and dlm_controld, edit /etc/rc.conf, then change the value for 'rc.dlm_enable' and 'rc.clvmd_enable' to 'YES'. After you are sure Corosync is running and you have quorum (check it with: corosync-cfgtool -s
) start the services:
/etc/rc.d/rc.dlm start
/etc/rc.d/rc.clvmd start
Configuring LVM involves three (3) different types of components: Physical Volumes (PV's), Volume Groups (VG's), and Logical Volumes (LV's). The physical volumes are the actual block devices that will be part of LVM. These can be SCSI disks, MD arrays, or just about any other type of block device that is available. A volume group is a collection of one or more physical volumes. And a logical volume is the actual device that we can read and write data from/to -- a LV (logical volume) belongs to a volume group (VG).
To start, you'll need to first initialize any block devices that you'd like to use as physical volumes. Use the TUI (LVM -> Add Physical Volume) to select the new devices. You can also remove any unused PV's via the TUI (LVM -> Remove Physical Volume).
After you've created your PV(s) you can then create a new volume group (LVM -> Add Volume Group) with the TUI. You'll be able to select one or more LVM PV's from a list, and will then be given a dialog to type a name for the new VG. The TUI also allows you to remove any unused volume groups (LVM -> Remove Volume Group) from the system.
Finally, you can create one or more logical volumes on your LVM volume group with the TUI (LVM -> Add Logical Volume). Once a LV has been added, you can then create an SCST device using the "vdisk_blockio" device handler, and map the device as a LUN to your security group(s). Removing unused LV's using the TUI is also supported (LVM -> Remove Logical Volume).
To create a physical volume (PV) for LVM using an entire SCSI disk (/dev/sdc):
pvcreate -v /dev/sdc
Next you can create a volume group (VG) for LVM using the PV we created above:
vgcreate -v big_space_1 /dev/sdc
Now we can create a 500 GB logical volume (LV) called "small_vmfs_1" that can be used with SCST:
lvcreate -v -L 500G -n small_vmfs_1 big_space_1
These were a couple very basic examples that should show you how to get started with LVM2; this software is very powerful and flexible and can be used in a number of different ways. Read up on the LVM2 documentation (and man pages)!
After you have added your LVM logical volumes, continue with the 35_Hosts_and_Initiators wiki page to configure your security groups and initiators (servers). Or if you've already configured your security groups, continue with the 36_Devices_and_Mappings to map the new LV to a LUN on your remote initiators.