Pick a Free OS

User login


LVM: The logical way to manage space

There are tools available that can resize your partition, but what do you do if there is no free space left on your hard drive? One option is that you delete and re-create your partitions. Add another hard drive, create a bigger partition there and move our data there. Although possible, such methods are temporary and in all probability, you will run out of space again. The need of the hour therefore, is not a static and temporary solution, but a more dynamic one that’s also easy to administer and maintain. And LVM fulfills that need.

LVM is very close to the magic 1.0 release (it’s at 0.9), but you don’t have to wait for that version. It’s now part of the 2.4 kernel and patches for 2.2.17+ are available. Some distributions like SuSE have patched the 2.2 kernel for LVM support and also provide the required tools.

LVM frees you from dilemmas like `Should I have a /home that is 5GB or should I make it 4GB and make a slightly larger /var partition?’ For whatever decision you take, most of the time, you either end up allocating more space than required or you find that future requirements have nullified your allocations. But with LVM, you don’t need to spend time thinking about how much space you should allocate to a partition. You can make a partition as big or as small as you like. You can always dynamically add/reduce the space allocated to the partition. Even better, you can do this while your partition is online i.e. it is still mounted.

Get it!

Head over to http://www.sistina.com/lvm. Download the tarball for your LVM version. We grabbed the 0.9.1 beta 2 release. Untar the file in a suitable location and change into the LVM/0.9 directory.

Compile it!

If you’re working with a 2.2 kernel, get your hands on kernel 2.2.17 because that’s the kernel version for which patches are available in the `Patches’ sub-directory. Applying the patches is a simple affair. Read the `Install’ file for more information on the patches suitable for your system. Change to /usr/src/linux or to the directory containing the kernel sources and run the following commands to patch your kernel. Patch in the order given below.

cat /src/LVM/0.9/PATCHES/linux-2.2.17-rawio.patch | patch –p1

cat /src/LVM/0.9/PATCHES/lvm-0.9-2.2.17-stock.patch | patch -p1

Patches for beta 2.4 kernels are also available, but since it has already made its way into the kernel, you will be better off using a stable kernel release. Here, we’re using kernel 2.4.3.