Increase Ubuntu Server Logical volume disc storage space

PHOTO EMBED

Fri Jul 21 2023 10:20:53 GMT+0000 (Coordinated Universal Time)

Saved by @Shuhab #bash

# To extend the logical volume, use the lvextend command. But first, get the mount point of the logical volume using the lvdisplay command:

sudo lvdisplay

# logical volumes info output on linux From the lvdisplay output, you can see that the disk is mounted on the path /dev/ubuntu-vg/ubuntu-lv.

# Next, increase the logical volume space using the following command:

sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv

# 100% means using up the entire space, so assign the required percentage according to your needs, e.g. 50%, 60%, etc.

# For the changes to take effect you also need to resize the file system comprising the logical volume. Get the file system path from the df -h command; in this case, it is /dev/mapper/ubuntu--vg-ubuntu--lv.

sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv

# Now if you run the df -h command again, you will see that your root drive has increased in size.
content_copyCOPY