LVM
LOGICAL VOLUME MANAGER
LVM is stands for
Logical Volume Manager. LVM is needed in below scenario:
Suppose, you have
3 HDD connected of 80GB each and remaining space into them are 10 GB, 20 GB
& 20 GB respectively.
Suppose, you want to store
a file having size of 45GB, then you have to add 1 more HDD and save the file.
To overcome such
scenarios, LVM is introduced.
1. Use the FDISK
utility to create the partition into that HDD for LVM.
a. fdisk -l
b. fdisk /dev/sdb
AND
fdisk /dev/sdc
AND
fdisk /dev/sdd
·
Add
new partition (n)
·
Print
Table (p)
·
Write
& Quit (w)
c. Do not format & mount.
2. Create PV
(Physical Volume)
pvdisplay /dev/sdb1 /dev/sdc1
/dev/sdd1
pvdisplay
3. Create VG
(Volume Group)
vgcreate /dev/VolumeGroupName
/dev/sdb1 /dev/sdc1 /dev/sdd1
vgdisplay
4. Create LV
(Logical Volume)
lvcreate --name LogicalVolumeName
--size 50GB /dev/VolumeGroupName
lvdisplay
5. Format the
partition.
mkfs.ext4
/dev/VolumeGroupName/LogicalVolumeName
6. Mount the
partition.
mount
/dev/VolumeGroupName/LogicalVolumeName /mnt/MountPoint
Extend VG
(Volume Group)
1. Create
partition using FDISK utility
2. Extend VG with
vgextend command
a. vgextend /dev/VolumeGroupName
/dev/sde1
b. lvresize -L +200M
/dev/VolumeGroupName/LogicalVolumeName
c. resize2fs
/dev/VolumeGroupName/LogicalVolumeName
Delete
LVM
1. Unmount the
mount point.
Umount /mnt/MountPoint
2. Remove LV.
lvremove
/dev/VolumeGroupName/LogicalVolumeName
3. Remove VG.
vgremove /dev/VolumeGroupName
4. Remove PV
Comments
Post a Comment