Web Search


Site Search






Logical Volume Management LVM on SLES


Purchase "Deploying Suse Linux Enterprise Server"
at Lulu.com

Installing Suse Linux Enterprise Server

Logical Volume Management

Normally when you create disk "volumes", you partition a hard drive, the drive's "partition table" gets written/updated, then you format the partitions so you can write data to the disk. Once the partitions are created you cannot "resize" or "move" the partitions without having special software utilities (and probably a few reboots).

What if you want to be able to "resize" or "move" a volume or maybe even add a drive to a volume to increase the storage capacity ? This is exactly why LVM exists today, to do these things. Basically LVM moves the partitioning of volumes from the physical drive to the Operating System, this allows much more flexibility and freedom in configuring your storage solution.

With LVM you are able to "resize" partitions without having to restart the computer, you are able to add drives to an existing LVM volume, you can even take a "snapshot" of an existing volume for backup purposes (or other reasons). However, it is also important to state that LVM does not implement any sort of data redundancy, but you can use RAID arrays with LVM to gain the benefits of both.


Note: Because LVM moves the partitioning of drives to the Operating System, the /boot directory must be located on a "physical" partition in order for the computer to actually start the Operating System. Also note that if you are going to build your own kernel, or if you are using a GNU/Linux distribution that does not include LVM into it's initial ramdisk (or built within the kernel itself), you will probably want to ensure the "/" root partition is also "physical" partition.


Creating LVM Logical Volumes

Preparing your system for LVM is similar to preparing your system for Software RAID, you must have a "physical base" to place your LVM Volume Group upon. This "physical base" can be a Software RAID array, or it can be a partition on a single drive (or a hardware RAID array).

In this example, I am going to create a "physical base" out of single hard drives. Normally you would not want to do this, but for teaching purposes it is probably the most effective. A more realistic example will be shown in the "Putting it all Together" section.


Creating LVM VolumesAdding LVM Volumes to Volume Groups
Creating LVM Volumes and adding them to a LVM Volume Group

As with a Software RAID array, the first thing you need to do is to create "Linux LVM" partitions on your hard drive(s). These partitions will become the physical base for your LVM Volume Group. These partitions can be any size as they will simply be "added together" to form your storage solution.

Once you create your "Linux LVM" partitions, you will now need to add them to a "Volume Group". Normally you will only have one "Volume Group" on a server, but it is possible to create multiple Volume Groups (although most situations do not justify it). This "Volume Group" then grows in size when you add partitions to it.

The easiest way to explain a Volume Group is to almost equate this to a physical drive. Once you create this "Volume Group", you will now have to "partition" areas of it in order for you to store data upon it. You do this by adding "Logical Volumes" to the "Volume Group".


Adding Logical Volumes with a Group
Adding Logical Volumes with a Group

The process of creating "Logical Volumes" is similar to creating physical partitions. You must specify a filesystem and a "Mount Point", and with "Logical Volumes" you must also specify a "volume name" that will be used to mount the volume and perform other functions. A common procedure is to name the logical volume after where it will be mounted, for instance a logical volume that will be mounted to /home should simply be called "home".

There are a few things to keep in mind as you create these logical volumes. First you need to be aware of the fact that the ext2/ext3 filesystems will not let you resize the filesystem while it is currently mounted (this functionality should be added in the near future). For now, if you want to grow the filesystem while it is mounted, you must format the logical volume as reiserfs or xfs. Also note that xfs will not allow you to shrink a partition at all and reiserfs will only allow you to shrink a partition when it is not mounted.


Note: You will want to Keep in mind as you create logical volumes the fact that you will not want to fill the entire volume group with logical volumes, you will at least want to keep a little free space left to ensure that all the features of LVM will be available to you.


Next


Purchase "Deploying Suse Linux Enterprise Server"
at Lulu.com