Thursday, August 2, 2012

LVM (Logical Volume Manager)


LVM (Logical Volume Manager)

Create 3 partitions for implementing RAID using fdisk command.

e.g. #fdisk /dev/sda

Press n to create the 3 new partitions each of 100Mb in size.

Press p to see the partition table.

Press t to change the partition id of all the three partitions created by you to 8e (Linux LVM).

Press wq to save and exit from fdisk utility in linux.

Use fdisk -l to list the partition table.

Creating LVM

# pvcreate /dev/sdaX /dev/sdaX /dev/sdaX
# pvdisplay

#vgcreate vg /dev/sdaX /dev/sdaX /dev/sdaX
#vgdisplay vg

#lvcreate -L +10M -n data vg

-L is used to define size.
-n is used to define the name.

#mkfs.ext3 /dev/vg/data
#lvdisplay /dev/vg/data

#mkdir disk
#mount /dev/vg/data disk
#df -h disk

#lvextend -L +10M /dev/vg/data
#ext2online /dev/vg/data

#df -h disk

#umount disk

#vgchange -an vg  (optional) -a control the avability of the logical volume in the volume group for input and output.

#lvremove /dev/vg/data
Press y to continue
#lvdisplay



#vgremove /dev/vg
#vgdisplay

#pvremove /dev/sdaX /dev/sdaX /dev/sdaX
#pvdisplay


Note:- X stands for your disk partition Number

No comments:

Post a Comment