While using any operating system, there are generally two different types of storage volumes, i.e., physical and logical. The storage space of the former storage volume is fixed, which means that you cannot extend or shorten the space of a physical storage volume, and it stays as it was manufactured in the first place. On the other hand, you can conveniently change the storage space of a logical storage volume by using different means.
Here at LinuxAPT, we shall look into the LVEXTEND command which is used for manipulating the logical storage volumes.
The basic purpose of the LVEXTEND command is to increase the size of a logical storage volume of a Linux system. For example, a random logical storage volume of your Linux system has a total space of 4 GB.
However, you have completely utilized this storage space, and you want more space for this logical volume.
In this case, you can use the LVEXTEND command to extend the size of this logical volume (say, by 2GB).
To access the help manual of the LVEXTEND command in Linux, simply run the following command:
$ lvextend --help
When you access this command, you will be able to see all the options and flags that you can pair up with the LVEXTEND command in Linux to serve the desired purposes.
Suppose you just want to extend a logical partition of your Linux system by 4 GB , you can use the LVEXTEND command:
$ lvextend –L +4G /dev/sda5
Here, you can replace "4" with any other number depending upon the extent to which you want to extend your logical volume.
You can also replace "G" with "M" if you wish to extend the partition in MBs instead of GBs. Moreover, you need to replace "/dev/sda5" with the exact path of the logical volume whose space you wish to extend.
This will simply extend your specified logical volume according to the specified number.
This article covers how to extend LVM partition on the fly using lvextend command. In fact, LVM(Logical Volume Manager) provides the facility to increase and reduce the file system size.