Introduction to lvm in linux

Introduction to lvm in linux
LVM is an implementation of a logical volume manager for the Linux kernel. It was originally written in 1998 by Heinz Mauelshagen, which was based on the Veritas volume manager used in HP-UX systems.

LVM includes many of the features expected from a volume manager, including:

Logical group resizing
Resizing logical volumes
Read-only snapshots (LVM2 offers read and write)
RAID0 of logical volumes.
LVM does not implement RAID1 or RAID5, so it is recommended to use specific RAID software for these operations, having the LVs above the RAID


In the image shown we can see how LVM works. Logical volumes group physical disk partitions, and these in turn, although not represented in the figure, are included in a logical group. Thus, / home is composed of hda3, hda4 and hdb3, and in turn, / usr encompasses hda1, hda2, hdb1 and hdb2.

After knowing this we will see some examples.

The first step is to create the logical volumes

  #pvcreate / dev / sda1 
we can add several albums in this case it was only one but if we wanted more it would look like this:

  pvcreate / dev / sda1 / dev / sdb1 / dev / sdc1 

Now we are going to create a group where we will add our logical volumes in this case with the name vg1:

  # vgcreate vg1 / dev / sda1 * if we want more we just put the name of the lvm 
Now we are going to create a logical volume of 2G with the name disk1 within the group vg1
  lvcreate -L2G -n disk1 vg1 
Now being able to create a file of files, mount or do some practice the route will be like this

  mount / dev / vg1 / disk1 
Here ends this basic introduction to lvm wait for the next entry

Comentarios