Saturday, July 4, 2009

LVM( logical Volume Managment )


Create a LVM


>first create Three Partition

>change ID of created partitions 83 to 8e

#partprobe /dev/sda
> create LAYER 1

#pvcreate /dev/sda5 /dev/sda6 /dev/sda7

#pvdisplay |less


> Create LAYER 2

#vgcreate volume1 /dev/sda5 /dev/sda6 /dev/sda7

#vgdisplay

> create LAYER 3

#lvcreate -l 25GB -n logical1 volume1

#lvdisplay
> format partition
#mkfs.ext /dev/volume1/logical1

#mkdir /dirname

#vim /etc/fstab

/dev/volume1/logical1 /dirname ext3 defaults 0 0

#mount -a
#df -TH

> How to extend the LVM?


#vgdisplay

if free space is there then uses command:-

# lvextend -L +10GB -n /dev/volume1/logical1

> then online format

#resize2fs /dev/volume1/logical1

otherwise create partition and change ID of partition

#partprobe /dev/sda

#pvcreate /dev/sda8

#vgextend volume1 /dev/sda8

#vgdisplay

#lvextend -L 10GB -n /dev/volume1/logical1

#resize2fs /dev/volume1/logical1

#df -TH

REMOVE LVM


#df -TH

#umount /dirname

Remove fstab entry

#vim /etc/fstab

#mount -a
#lvdisplay

#lvremove /dev/volume1/logical1

#vgremove /dev/volume1

#fdisk -l

#pvremove /dev/sda5 /dev/sda6 /dev/sda7 /dev/sda8

then delete the partitons

No comments:

Post a Comment