Few months ago I installed Ubuntu on my MAC M1 apple Silicon to practice with a K8s LAB. I proceeded with a simple installation (for beginner) leaving any options set by default, choosing to use the entire disk (30 GB). I made up my configuration, set up minikube, realized some YAML file (just to test some environment in K8s), than weeks later upgraded the kernel .... and now a warnig telling me that I have terminated the space .... what the hell ... how i did?
During the initial installation phase I didn't pay to much attention on how the disk was really partitioned.
Let's perform a couple of commands to be sure on the real size of the disk.
lorenzo@ubuntu:~$ sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL
lorenzo@ubuntu:~$ sudo fdisk -l
Verified that we have the original 30GB disk and space not allocated, what we have to do is to extend or resize the LVM partition to the available free space with the lvextend command.
Let's proceed by steps:
- Locate the partition to extend running the "df -h" command. We have seen that in our case is the root "/" (93% Used).
With the following command, let's check in the volume group where are the free space:
Let's run the below lvextend command to extend the file system.
root@ubuntu:~# lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
With previous lvextend command we have extended the file system to use 100% of the free space availabe, but still the file system is not updated untill we execute the following resize2fs command:
root@ubuntu:~# resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
- Last but not least, check that the space has been expanded as desired, performing "df -h" command again.