Follow the steps below to increase the size of the logical volume and allocate additional space on one of your partitions.
|df||The disk free command to show hard disk freespace|
|-h||Command option to display the output in human-readable format (KB, MB or GB)|
Next, type fdisk -l to view the total hard disk(s) size and partitions on the disk. It can also be noticed here that the physical partition /dev/sda3 is using Linux LVM.
Note for Cloud Servers: The PSize value listed will often be bit smaller than the value listed by the fdisk command output. If the difference in size between the fdisk output and PSize is more than 100GB, please reference What if my physical volume size has not changed after increasing disk space? before continuing.
|pvs||Physical Volume Show command|
|PV||Physical Volume path|
|VG||Volume Group name|
|Attr||Physical volume attributes. The a means that the physical volume is allocatable and not read-only.|
|PSize||Physical Size of the physical volume|
|PFree||Physical Free space left on the physical volume|
The format for the lvextend command is as follows:
lvextend -L +6G /dev/mapper/vg00-var
|lvextend||The logical volume extend command used to increase logical volumes|
|-L +6G||Command option to increase a Logical volume by 6 Gigabytes|
|/dev/mapper/vg00-var||The path for the logical volume to increase|
Type df -h to display the disk free space once again. The lvextend operation finished successfully in the last step however the /dev/mapper/vg00-var size is still only showing 4.0G. This is because, while the logical volume was increased successfully, the file system needs to be extended to take advantage of the full space of the logical volume.
Type lvs to show the logical volume information once again. Here, we can confirm that the logical volume has successfully been extended to 10 gigabytes. In the next steps, we will increase the file system to match the logical volume size.
Type mount and press ENTER to display the mounted file systems. From the output, we find that the /dev/mapper/vg00-var logical volume is using xfs (with the introduction of CentOS 6, the default filesystem is ext4).
Typing xfs_growfs /var or resize2fs /dev/mapper/vg00-var (depending on which filesystem is used on your system) will extend the file system to the 10 gigabyte limit of the logical volume.
Type df -h to display the disk free space to confirm that the file system has been extended.