November 12, 2011

LVM-Logical Volume Manager

LVM is a Logical Volume Manager for the Linux operating system.

LVM 2 uses the device mapper kernel driver and supports snapshots which allow the administrator to create a new block device which presents an exact copy of a logical volume, frozen at some point in time.



Anatomy of LVM:

Volume Group, the highest level abstraction used within the LVM. It gathers together a collection of Logical Volumes and Physical Volumes into one administrative unit.

A physical volume is typically a hard disk, though it may well just be a device that ‘looks’ like a hard disk.

Logical volume, the equivalent of a disk partition in a non-LVM system. The LV is visible as a standard block device; as such the LV can contain a file system.

Each physical volume is divided chunks of data, known as physical extents, these extents have the same size as the logical extents for the volume group.

Each logical volume is split into chunks of data, known as logical extents. The extent size is the same for all logical volumes in the volume group.


Overview of a LVM system:
      hda1      hdc1      (PV: on partitions or whole disks)
             \     /
               \ /
           diskvg        (VG)
             /  |  \
           /    |    \
usrlv  rootlv  varlv (LV)
   |            |           |
ext2  reiserfs  xfs (filesystems)
 
 
 
Steps to create a LVM system:
1. create lvm partition, fdisk, partition system id is 0x8e
2. create pv, pvcreate
3. create vg, vgcreate
4. create lv, lvcreate
5. format lv, mkfs
6. mount lv, mount

Steps to extend a Logical volume:
1. extend the logical volume, lvextend
2. resize file system, for ext2/ext3, resize2fs


Reference:
LVM HOWTO

No comments:

Post a Comment