Linux: LVM-An Introduction

Linux: LVM-An Introduction

Have you ever wondered while your linux installation that how much space should you reserve for the system and user files ?  That’s a question that troubles many of us “How should i partition my disk drive ? ” Although you would get many suggestions on that but why to think about it if you have a better alternative…..LVM

According to Wikipedia , logical volume management or LVM provides a method of allocating space on mass-storage devices that is more flexible than conventional partitioning schemes. In particular, a volume manager can concatenate, stripe together or otherwise combine partitions into larger virtual ones that administrators can re-size or move, potentially without interrupting system use.
Let’s understand it with an example
Say Samuel has the following partitions on his disk

/boot    /dev/sda1     512 Megabytes
swap     /dev/sda2    256 Megabytes
/        /dev/sda3      10 Gigabytes
/home    /dev/sda4      30 Gigabytes

Now Samuel installed a bunch of softwares and is left with no space on root for further installation of softwares.He has the following alternatives for resizing :

  1. Reformat the disk, change the partitioning scheme and reinstall.
  2. Buy a new disk and figure out some new partitioning scheme that will require the minimum of data movement.
  3. Set up a symlink farm on / pointing to /home and install the new software on /home

But in case of lvm say if the partitioning is

/boot     /dev/hda1        512 Megabytes
swap      /dev/vg/swap   256 Megabytes
/         /dev/vg/root    10  Gigabytes
/home     /dev/vg/home    30 Gigabytes

If the same condition arises in lvm you don’t need to follow the long lengthy steps . Resizing is just a few commands away that too when you are working on the system disk drive whose partitioning you want to configure.That’s where LVM comes in place. Other advantages include:

  • Have logical volumes stretched over several disks.
  • Create small logical volumes and resize them “dynamically” as they get filled up.
  • Resize logical volumes regardless of their order on disk. It does not depend on the position of the LV within VG, there is no need to ensure surrounding available space.
  • Resize/create/delete logical and physical volumes online. File systems on them still need to be resized, but some (such as ext4) support online resizing.
  • Snapshots allow you to backup a frozen copy of the file system, while keeping service downtime to a minimum.

Most LVM’s share the following design:LVM_original_description

  1. They start with physical volumes (PVs), which can be either hard disks, hard disk partitions. Volume management treats each PV as being composed of a sequence of chunks called physical extents (PEs).
  2. Logical volume groups are created by combining PVs.
  3. As each PV consists of a number of fixed-size physical extents (PEs), similarly, each LV consists of a number of fixed-size logical extents (LEs)

I will include LVM installation  in my upcoming blogs. Till then keep exploring and keep learning in this big REDAIX world ..:)

One thought on “Linux: LVM-An Introduction

Leave a Reply

Your email address will not be published. Required fields are marked *