Expanding the space of Ubuntu Server/Desktop (LVM)

Tiempo de lectura: < 1 minuto

This tutorial is for when your physical disk is large (e.g. 1 TB), but the operating system only recognizes a part (e.g. 100 GB) due to the default LVM configuration in Ubuntu.

To ensure that your system uses LVM and confirm where the free space is, run:

Bash

lsblk 

Your goal is to identify the name of the logical volume that is mounted at the root (/). By default, it usually is /dev/mapper/ubuntu--vg-ubuntu--lv.

Run the following two commands in the terminal. No require rebooting nor cause data loss.

Bash

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

<

blockquote class=”wp-block-quote is-layout-flow wp-block-quote-is-layout-flow”>

Note: If the disk volume of your machine changes in the future, simply replace /dev/mapper/ubuntu--vg-ubuntu--lv with the correct path.

Bash

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

Step 3: Confirm the changes

To verify that the operating system now has access to all the Terabyte, execute:

Bash

df -h /

In the “Size” column, you should see reflected the new total available space (approximately 920-930 GB usable after format discounts).

Leave a Comment