LOGICAL VOLUME MANAGER (LVM)

Wednesday, November 18, 2009
Your Ad Here
If we have logical volume we can dynamicly add or remove diskspace to or from it. Any disk partitions to used as physical volumes need to have their partition types set to 8e, Linux LVM. After creating Primary Volu me, we must create a Volume Group with any name.After that we will create Logical Volume. Not only to the Logical Volume, we can extend or reduce the size of a Volume Group.
Lets start -
Create a Partition of LVM type using fdisk and reboot the system. –

fdisk /dev/hda
n
(define/accept the first cylinder)
(define the last cylinder) +100M
n
(define/accept the first cylinder)
(define the last cylinder) +150M
p (check the newly created partitions at the bottom, note down the partition no.
We are assuming /dev/hda10 and /dev/hda11 are created)
t
10 (partition no)
l ( to list codes - please note the code for Linux LVM, it is 8e)
8e
t
11 (partition no)
8e
w ( to write to partition table and exit from fdisk)

reboot ( reboot your system)

Initialize the LVM Configuration Files
vgscan

Initialize the LVM partitions as physical volumes.
pvcreate /dev/hda10 /dev/hda11

Create Vouume Group.
vgcreate vg1 /dev/ hda10
Here, vg1 is volume group name

Create Logical Volume.

lvcreate -L 50M -n lvm1 vg1
Here, lvm1 is logical volume name

Make filesystem.

mkfs /dev/vg1/lvm1
Mount the newly created logical volume to a directory, say /lvmone
mount /dev/vg1/lvm1 /lvmone

Check the volume size.

lvdisplay /dev/vg1/lvm1


If you want to resize it, first unmount the partion and run
e2fsadm -L+25M /dev/vg1/lvm1

Check the volume size once again. If you want to reduce the partition size run -
e2fsadm -L-20M /dev/vg1/lvm1

Run the following command to see the volume group size and space left on it.
vgdisplay

To extend the volume group size

vgextend vg1 /dev/hda11

Run ‘vgdisplay’ once again to check the volume group size, allocated space and free space.

Labels: , , , , , , , , , , ,

 
posted by Gautam at 2:09 AM, |

0 Comments:

Post a Comment



Post a Comment