Thursday, August 23, 2012

Some info about managing LVM in Debian 5


The hierarchy of LVM is


1.Physical volume(lowest layer)

2.Volume Groups

3.Logical Volume

Use fdisk to create partion in one or separate harddisk,make it's type LVM(8e),writing partition table might throw an error,in that case try pvcreate first then write the partition table

pvcreate /dev/hda1 /dev/hda2 /dev/hda4 to create Physical volumes

pvdisplay will show the physical volumes

vgcreate volumegroup001 /dev/hda1 /dev/hda2 /dev/hda5

lvcreate -L 2.5GB volgroup001

lvdisplay or

lvdisplay volumegroup001

find the the location of the logical volume from the output of the command lvdisplay

in my case it is

/dev/volumegroup001/lvol0

then

mkfs.ext3 /dev/volumegroup001/lvol0(to enable a journaling filesystem)

create a folder

mkdir souravlvm

mount /dev/volumegroup001/lvol0 souravlvm/ && echo $?

see the mounted folder by


df -h

put it in the /etc/fstab file to make it available after reboot

/dev/volumegroup001/lvol0 /home/sourav/souravlvm ext3 defaults 0 2

unmount it by umount souravlvm/

then run mount -a which will read the fstab entry and then if you do df -h you will see the logical volume mounted in souravlvm again

No comments:

Post a Comment