published: 26th of December 2024
Recently, when I installed Ubuntu Server 2404, I somehow only provisioned 100GB logical volume even though the physical disk I installed it on is a 2TB physical disk DOH!.
This post will cover how I found the problem and went about fixing it.
The following software versions were used in this post.
I started getting errors that I was out of disk space. How could that be, I only just installed the OS and I had not done much yet.
Check the disk space.
df -h
# Output
Filesystem Size Used Avail Use% Mounted on
tmpfs 13G 1.8M 13G 1% /run
efivarfs 192K 84K 104K 45% /sys/firmware/efi/efivars
/dev/mapper/ubuntu--vg-ubuntu--lv 😭 98G 😭 94G 0 100% /
tmpfs 63G 0 63G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 63G 0 63G 0% /run/qemu
/dev/sdc2 2.0G 96M 1.7G 6% /boot
/dev/sdc1 1.1G 6.2M 1.1G 1% /boot/efi
tmpfs 13G 32K 13G 1% /run/user/1000
Size of /dev/mapper/ubuntu--vg-ubuntu--lv is 98G and almost full! ?? BRO WTF ??
Confirm the Logical Volume size.
sudo fdisk -l /dev/mapper/ubuntu--vg-ubuntu--lv
# Output
Disk /dev/mapper/ubuntu--vg-ubuntu--lv: 100 GiB, 107374182400 bytes, 209715200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Confirm the Physical Volume size is 2TB.
sudo fdisk -l /dev/sdc
# Output
Disk /dev/sdc: 1.82 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: CT2000BX500SSD1
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: CA040B55-FD8E-4C30-8AB6-C275F46590D7
Device Start End Sectors Size Type
/dev/sdc1 2048 2203647 2201600 1G EFI System
/dev/sdc2 2203648 6397951 4194304 2G Linux filesystem
/dev/sdc3 6397952 3907026943 3900628992 1.8T Linux filesystem
Damn, so the Physical Volume size is 2TB, but the Logical Volume size is 100GB.
Thankfully, the fix was pretty straight forward and outlined very nicely in this post.
First, extend the Logical Volume size to 100% of the Volume Group.
sudo lvextend -l 100%VG ubuntu-vg/ubuntu-lv
# Output
Size of logical volume ubuntu-vg/ubuntu-lv changed from 100.00 GiB (25600 extents) to <1.82 TiB (476146 extents).
Logical volume ubuntu-vg/ubuntu-lv successfully resized.
Now, increase the size of the filesystem to the size Logical Volume.
sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
# Output
resize2fs 1.47.0 (5-Feb-2023)
Filesystem at /dev/mapper/ubuntu--vg-ubuntu--lv is mounted on /; on-line resizing required
old_desc_blocks = 13, new_desc_blocks = 233
The filesystem on /dev/mapper/ubuntu--vg-ubuntu--lv is now 487573504 (4k) blocks long.
Finally, confirm that the /dev/mapper/ubuntu--vg-ubuntu--lv volume is the correct size.
df -h
# Output
Filesystem Size Used Avail Use% Mounted on
tmpfs 13G 1.8M 13G 1% /run
efivarfs 192K 84K 104K 45% /sys/firmware/efi/efivars
/dev/mapper/ubuntu--vg-ubuntu--lv 🥳 1.8T 🥳 94G 1.7T 6% /
tmpfs 63G 0 63G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 63G 0 63G 0% /run/qemu
/dev/sdc2 2.0G 96M 1.7G 6% /boot
/dev/sdc1 1.1G 6.2M 1.1G 1% /boot/efi
tmpfs 13G 32K 13G 1% /run/user/1000
🎊🎉 VICTORY 🎊🎉
That's it! That's the post. Peace out legends ✌️