If the disk is 100% full, apt cannot download the tools required to fix the problem.
Clear the package cache and old logs to gain immediate breathing room:
sudo apt-get clean sudo apt-get autoremove -y sudo journalctl --vacuum-size=50M
If cleanup isn't enough, mount 50MB of RAM over the apt archives folder to allow package downloads:
sudo mount -t tmpfs -o size=50m tmpfs /var/cache/apt/archives
Use growpart to expand a partition within an existing disk (e.g., after increasing a virtual disk size in your hypervisor).
sudo apt update sudo apt install cloud-guest-utils -y
lsblk to check your disk (e.g., /dev/sda) and partition number (e.g., 1).# Note the space between device and partition number sudo growpart /dev/sda 1
Use this workflow to add a new partition or unallocated space from /dev/sda into an existing Volume Group.
If you aren't growing an existing one, create a new one for LVM use:
sudo fdisk /dev/sda.n (new), p (primary), then Enter for defaults.t (type), select the partition number, then enter 8e (Linux LVM).w (write) and exit.sudo partprobe /dev/sda to refresh.sudo pvcreate /dev/sdaX # Replace X with your partition number
Find your VG name first using vgs.
sudo vgextend <your-vg-name> /dev/sdaX
Find your LV path using lvs (e.g., /dev/ubuntu-vg/ubuntu-lv).
# Add all available free space from the VG to the LV sudo lvextend -l +100%FREE /dev/mapper/your--lv--path
The partition and LVM are now larger, but the filesystem must be "stretched" to see the space.
| Filesystem Type | Command |
|---|---|
| ext4 | sudo resize2fs /dev/mapper/your--lv--path |
| XFS | sudo xfs_growfs / (or the mount point) |
lsblk: View disk/partition structure.pvs / vgs / lvs: View LVM status.df -h: Check available disk space and filesystem types.tune2fs -m 1 /dev/sda1: (Emergency) Reduce root reserved space to 1% to free up space.