Ubuntu

LVEXTEND Command in Linux

“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. In this article, we will be talking about the LVEXTEND command that is used for manipulating the logical storage volumes.”

Why is the LVEXTEND Command Used in Linux?

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).

Example of Using the LVEXTEND Command in Linux

Before going through this example, we will quickly share with you the method with which you can conveniently access the help manual of the LVEXTEND command in Linux. All you need to do is to 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. The help manual of this command is shown in the image below:

Now, we will talk about the example that we wanted to share with you. Suppose you just want to extend a logical partition of your Linux system by 4 GB. For doing so, you can use the LVEXTEND command in the following manner:

$ 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. When you execute this command in this way, it will simply extend your specified logical volume according to the specified number.

Conclusion

This was an introductory article on the purpose of the LVEXTEND command in Linux. This command is used for extending the size of a logical storage volume in Linux. After introducing you to the purpose of this command, we shared a very simple use case of this command with you. Following this use case, you can easily extend the space of any logical volume of your Linux system.

Similar Posts