Tuesday, August 9, 2011

LVM (Logical Volume Manager) in linux


Create 3 partitions for implementing RAID using fdisk command.

e.g. #fdisk /dev/hda
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/hda6 /dev/hda7 /dev/hda8
# pvdisplay
#vgcreate vg /dev/hda6 /dev/hda7 /dev/hda8
#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/hda6 /dev/hda7 /dev/hda8
#pvdisplay



Thanks,
http://myownlab.blogspot.com/
myownlab2011@gmail.com

No comments:

Post a Comment