Make
four partitions of size 100M, 50M, 75M and 150M with partition ID 8e. 8e is the ID of LVM type
partition.
Suppose
the newly created partitions are: /dev/hda10, /dev/hda11, /dev/hda12, /dev/hda13.
Now
create Physical Volume:
#pvcreate /dev/hda10
#pvcreate /dev/hda11
#pvcreate /dev/hda12
#pvcreate
/dev/hda13
To
check status of pv:
#pvscan
#pvdisplay
Now
create volume group:
#vgcreate vg01
/dev/hda10 /dev/hda11
#vgcreate vg02 /dev/hda12
/dev/hda13
To
check status of vg:
#vgscan
#vgdisplay
Now
create logical volume:
#lvcreate --name lv1
--size 110M vg01
#lvcreate --name
lv2 --size 170M vg02
To
check status of lv:
#lvscan
#lvdisplay
Now
need to format these newly created logical volume with ext3 filesystem
#mkfs.ext3 /dev/vg01/lv1
#mkfs.ext3 /dev/vg02/lv2
Now
mount the logical volumes to folder:
#mkdir /raidtest1
#mkdir /raidtest2
# mount /dev/vg01/lv1 /raidtest1
#mount /dev/vg02/lv2 /raidtest2
#df –h
Now
we will extend or reduce our volume size: (Unmount
first)
For
extending:
#umount
/raidtest1
#lvextend -L +15M /dev/vg01/lv1
#e2fsck -f
/dev/vg01/lv1
#resize2fs
/dev/vg01/lv1
For
reducing:
#umount /raidtest2
#dumpefs /dev/vg02/lv2 | grep –I ‘Block size’
#e2fsck -f
/dev/vg02/lv2
#resize2fs /dev/vg02/lv2 143360
#lvreduce -L
-140M /dev/vg02/lv2
Other
commands(need to delete associated lv
first to do something on vg, need to
delete associated vg fisrt to do
something on pv):
#lvrename vg01
lv1 lv3
#lvrename vg02
lv2 lv4
#lvremove /dev/vg01/lv3
#lvremove /dev/vg02/lv4
#vgrename vg01
vg03
#vgrename vg02
vg04
#vgremove vg03
#vgremove vg04
#pvremove /dev/hda10
#pvremove /dev/hda11
#pvremove /dev/hda12
#pvremove /dev/hda14
No comments:
Post a Comment