Официален блог на WebEKM EKM очаквайте сайта онлайн скоро.

Download Free Templates http://bigtheme.net/ free full Wordpress, Joomla, Mgento - premium themes.

LVM Logical Volume Manager – SAN virtualization in Linux

linux-lvm-pv-vl-lvLogical volume manager is a storage virtualization that allows us easily manage the disk space. Without any problems we can expand, shrink, add disks to the virtual Volume and for the sake of redundancy apply RAID if required.

 

In LVM we take a couple of physical disks, create a Volume Group from them and then release the Logical Volume from the Volume Group. Pretty easy idea but very robust. It is simillar to the Dynamic Disks in Windows.

 

lvmogol.jpg
 

Let’s find out some terminology before we go over the configuration:

Physical Volume (PV) – physical HDDs / partitions destined to work in LVM
Physical Extent (PE) – a segment of disk space, PV are splitt into PEs
Volume Group (VG) – a storage pool made of physical volumes
Logical Extent (LE) – PE are associated with LE, and these PEs are combined into a LV
Logical Volume (LV)– logical part of volume group (not necessairly physicaly on the same HDD). Logical volume works independently of physical volume and volume group, so we may add another HDDs and add them to volume group and then enlarge logical volume. LV is a part of VG. Filesystem is being written to logical volume.

Steps to deploy LVM

1. Firstly we have to set up choosen disks or partitions as PV (Physical Volume). System gets to know which resources may be use in LVM. 

2. We have to create Volume Groups (VG) from one or more PV

3. VG organize the physical storage in a collection of chunks know as Physical Extents (PE)

4. Than we may organize PE into Logical Volumes (LV)

5. LV consists of Logical Extents (LE) which map to the appropriate Physical Extents

6. LV can be formatted and mounted now!

The LAB

Let’s lab it out. 

Assumptions and steps :

– there are 2 HDDs /sde and /sdf, they both are partitioned to /sde1 /sde2 and /sdf1 /sdf2

– I will configure 4 Physical Volumes:  /sde1 /sde2 /sdf1 /sdf2

– then I will create 2 Volume Groups VolumeGroupFirst (sde1-2) and VolumeGroupSecond (sdf1-2)

–  I will create some Logical Volumes
–  I will add another PV (sdg) to VolumeGroupFirst

 

 

1. We have 2 HDDs /dev/sde and dev/sdf that have been partitioned onto /dev/sde1 /dev/sde2 and /dev/sdf1 /dev/sdf2

1.sde parted
 >

2.sdf parted
 

 

2. Let’s create physical volume sde1-2 and sdf1-2

We are making this with pvcreate command:

3.pvcreate
 

 

Let’s check what have been created with pvdisplay and pvscan

 

0.pvdisplay
 

0.pvscan
 

2. Now let’s create volume groups  with vgcreate  command

4.vgcreate
 

Let’s verify this with vgdisplay

5vgdisplay
 

3. Now I am going to create Logical Volumes that will become our partitions later on VolumeGroupFirst. We are making this with lgcreate command. We may make that in 2 ways: first we may configure how many Physical Extends we want to assign to particular Logical Volume (default one PE has 4MB, you may read this  from vgdisplay command.
lvcreate -l number_of_PEs VolumeGroupFirst -n LogicalVolume1

or by giving the size with -L switch :

lvcreate -L 3GB VolumeGroupFirst -n LogicalVolume1

lvcreate -L 4GB VolumeGroupSecond -n LogicalVolume2

6lvcreate
 

lvdisplay will show us the result !

7lvdisplay
 

Now the first logical volume (LV) may be formatted, mounted and use as an ordinary partition !

The last step, let’s add /dev/sdg1 to the VolumeGroupFirst, first we have to create PV with pvcreate and then use vgextend, thats all

pvcreate /dev/sdg1

vgextend VolumeGroupFirst /dev/sdg1

and let’s check if VolumeGroupFirst has enlarged its size, success !

8 vgdisplayafter
 

and would be great to extend the size of Logical Volume (+4 GB) what we do with command:

lvextend -L+4G /dev/VolumeGroupFirst/LogicalVolume1

9.lvextend

LVM and RAID

RAID takes place on Physical Volumes unless we want to play with software RAID, then we may deploy on LVM, but of course this is not recommended owing to slowness. 

LVM and hardware RAID

lvm and hw raid.jpg
 

LVM and Software RAID

lvm raid software.jpg
 

,

Onlain bookmaker bet365.com - the best bokie

Menu