LVM
(Logical Volume Manager)
LVM
is a tool for logical volume management which includes allocating disks,
striping, mirroring and resizing logical volumes. With LVM, a hard drive or set
of hard drives is allocated to one or more physical
volumes.
LVM physical volumes can be placed on other block devices which might span two
or more disks.
The
physical volumes are combined into logical
volumes,
with the exception of the /boot/ partition.
The/boot/ partition cannot be on a logical volume group because the boot
loader cannot read it. If the root (/)
partition is on a logical volume, create a separate /boot/ partition which is not a part of a volume group.
Since
a physical volume cannot span over multiple drives, to span over more than one
drive, create one or more physical volumes per drive.
The
volume groups can be divided into logical
volumes,
which are assigned mount points, such as /homeand / and
file system types, such as ext2 or ext3. When "partitions" reach
their full capacity, free space from the volume group can be added to the
logical volume to increase the size of the partition. When a new hard drive is
added to the system, it can be added to the volume group, and partitions that
are logical volumes can be increased in size.
On
the other hand, if a system is partitioned with the ext3 file system, the hard
drive is divided into partitions of defined sizes. If a partition becomes full,
it is not easy to expand the size of the partition. Even if the partition is
moved to another hard drive, the original hard drive space has to be
reallocated as a different partition or not used.
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/sda6 /dev/sda7 /dev/sda8
# pvdisplay
#vgcreate vg /dev/sda6 /dev/sda7 /dev/sda8
#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/sda6 /dev/sda7 /dev/sda8
#pvdisplay
No comments:
Post a Comment