How to Increase LVM Disk Space in Ubuntu
Note
The following process has been tested on the server version of the following distros
ubuntu 16.04
ubuntu 18.10
ubuntu 20.04
Step 01
Shut down the VM and increase the volume in VM’s VMware ESXi settings and restart the VM
Step 02
Login into the system via ssh
or web console
. Change user privilege to administrator (sudo
), in other words – become root
Step 03
Run command
cfdisk
This command should invoke configure disk options and the terminal should look similar as below
Step 04
Select the last drive (in my case /dev/sda3
) using up and down arrow key and from the bottom menu select Resize
Step 05
Once Resize
has been selected, the terminal will prompt for the total size of the disk to be resized. Add the free space size with the current size and put the numbers in, if not already provided. In most cases, the system can detect the free space and adds it automatically. Press ENTER
At the bottom of the screen, the terminal will show that partition *x* has been resized
. (change x with the partition number that you just resized)
Step 06
The next step is to write these changes (partition table
) into the disk. Select Write
option from the bottom menu using the left and right arrows.
Danger
This operation might delete data. So make sure that you have taken the appropriate backup of your data.
this will invoke a confirmation dialog, type yes
to confirm the changes and press ENTER
If this writing process did not encounter any problem then the terminal should show that the partition table
has been altered.
Step 07
Quit cfdisk
by selecting Quit
from the bottom menu.
Terminal might show syncing disks.
message as it exits from the cfdisk
.
Step 08
Reboot the system.
reboot now
log back in, change back to root
user.
Step 09
The first thing to do after the restart is to check if the partition has been extended properly, to do that run
fdisk -l /dev/sda
This should show you that the desired partition has been extended.
But df -h
still shows that the root
partition /
mount point is still stuck with nearly 4GB
of space.
Step 10
To increase the size of the logical volume at the mount point /
we would need the file system name
from the command df -h
and then run
resize2fs /dev/mapper/ubuntu--vg-ubuntu-lv
N.B: (change the file system name according to your system)
Step 11
Check the disk size has changed
df -h
Successfully increased LV disk space in the ubuntu system.
Source
Here is the original answer that lead me to this post for my own reference.
Enjoy!