Why you should check out LVM

By  

LVM (currently released as LVM2), the "logical volume manager", is a flexible storage manager for the Linux kernel. It allows you to add, remove and resize partitions to suit your needs. Instead of having to predict how your disk space is going to be use when your install a new server, you dedicate a good amount of disk space to LVM and then can make changes to how that storage is allocated when you need.

The easiest way to think of LVM is to picture a set of partitions or disks (one or many). These become your "physical volumes". For a personal system, your physical volumes may comprise just one large partition on your drive. For a critical server at work, they may be a rack of disks, possibly configured as a RAID array. Using LVM, you can concatenate your physical volumes into what LVM calls a "volume group". This volume group represents the disk space that is available to you for carving up into "logical volumes". You might think of these logical volumes as virtual partitions that are created on your overall disk space, but without any particular need to resemble the geometry of those disks.

Your logical volumes are where you will build partitions and create your file systems. Unlike the file systems that we've been using for years, however, these file systems will be resizable. If /home fills up and you have storage space in reserve (a good idea if you have enough disk space), you can make it bigger. If /home fills up and you don't have space in reserve, you can steal it from another partition. You can also create new partitions as you need them or add more physical volumes to increase your overall disk space.

The commands available for working with LVM are named after the various components of LVM. When you see "pv", think "physical volume". Commands for setting up physical volumes might look like these that initialize partitions as physical volumes.

# pvcreate /dev/sda3
# pvcreate /dev/sdb
# pvcreate /dev/sdc

When you see "vg", think "volume group". This is the overall storage that you have to work with. You create your volume group using the vgcreate command.

# vgcreate VolGroup00 /dev/sda3 /dev/sdb1 /dev/sdc1

Once you volume group is set up, you can verify it using the command "vgscan" -- as shown here:

# vgscan
 Reading all physical volumes.  This may take a while...
 Found volume group "VolGroup00" using metadata type lvm2

When you see "lv", think "logical volume". A logical volume is a portion of the overall disk space available in your volume group that you have designated to be treated as a separate volume. Once you have your volume group set up, you can slice off pieces of it to create your logical volumes.

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

StorageWhite Papers & Webcasts

See more White Papers | Webcasts

Answers - Powered by ITworld

ITworld Answers helps you solve problems and share expertise. Ask a question or take a crack at answering the new questions below.

Ask a Question
randomness