Create LVM Volume
Creating the Physical Volumes
To use disks in a volume group, you label them as LVM physical volumes.# fdisk /dev/sdb
n => p => 1 =>Start:? => Last:? => t => 8e => w
Creating the Volume Group
The following command creates the volume group VGDATA .
# vgcreate VGDATA /dev/sdb1 /dev/sdb2 ...Creating the Logical Volume
The following command creates the logical volume
new_logical_volume
(DATA) from the volume group new_vol_group(
VGDATA)
. This example creates a logical volume that uses 100% of the volume group.
# lvcreate -l 100%PVS -n DATA VGDATA /dev/sdb1
But if we need 2GB of volume group:
# lvcreate -L2G -n DATA VGDATA
Creating the File System
The following command creates a ext4 file system on the logical volume.
Configure for auto mount LVM with startup OS
add configure below to /etc/fstab
/dev/VGDATA/DATA /DATA ext4 defaults 0 0
Mounting the File System
# mount /dev/VGDATA/DATA /DATAExtend LVM Volume
Creating the new Physical Volumes
To use disks in a volume group, you label them as LVM physical volumes.# fdisk /dev/sdc
n => p => 1 =>Start:? => Last:? => t => 8e => w
Extending a Volume
Add new physical volume# vgextend VGDATA /dev/sdc1
Check VG increased
# vgs
Check free size of VG for increase
# vgdisplay
Free PE / Size 12749 / 49.80 GiB
There are 12749 free PE available = 49.80GB Free space available. So we can expand our logical volume up-to 49.80GB more. Let us use the PE size to extend.
# lvextend -l +12749 /dev/VGDATA/DATA
No comments:
Post a Comment