Resizing Logical Volumes on Ubuntu Server: How to Allocate Full Disk Capacity

Ubuntu Server is a popular choice for hosting web applications, databases, and other server applications. By default, Ubuntu Server only allocates around 200GB of storage to the ubuntu--vg-ubuntu--lv logical volume during installation. If you need more storage for your server, you can easily resize the logical volume to take advantage of the full capacity of the disk. Here’s how you can do it:

1. Check the Current Size of the Logical Volume

Before resizing the logical volume, it’s important to see the current size. You can do this by running the command df -hT /dev/mapper/ubuntu--vg-ubuntu--lv.

2. Run a Test

Before actually resizing the logical volume, it’s a good idea to run a test to ensure everything will work as expected. You can do this by running the command sudo lvresize -tvl +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv. This command will show you what the result will look like without actually resizing the volume.

3. Resize the Logical Volume

Once you’ve verified that everything looks good, you can resize the logical volume by running the command sudo lvresize -vl +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv. This will resize the logical volume to take advantage of all available free space.

4. Resize the Filesystem

After resizing the logical volume, you need to resize the filesystem to take advantage of the additional space. You can do this by running the command sudo resize2fs -p /dev/mapper/ubuntu--vg-ubuntu--lv.

5. Verify the New Size of the Logical Volume

Finally, you can verify that everything went smoothly by running the command df -hT /dev/mapper/ubuntu--vg-ubuntu--lv. This command will show you the new size of the logical volume.

By following these steps, you can easily resize the logical volume on your Ubuntu Server to take advantage of all available disk space. It’s important to note that resizing a logical volume can be a risky operation, so it’s always a good idea to back up any important data before making any changes to the logical volume.

https://askubuntu.com/questions/1337406/just-200-gb-of-my-1tb-disk-can-be-found-on-ubuntu-server-20-04