In a previous post we created an Ubuntu 18.04 template that only has a 16GB disk. The template is fairly lean, without many packages installed, but the root filesystem is already at 21% full. For many applications this will be enough space, but some will require more. In this post, we will grow that file system by extending the disk from 16GB to 50GB.
- Check existing free space with the command df -h.
- Use the vSphere client to increase the size of Hard Disk 1.
- Rescan the devices to find the new space with the command: echo 1 > /sys/class/block/sda/device/rescan
- Run lsblk to list available blocks.
- Grow the partition by running growpart /dev/sda 1 (that’s the disk, a space, and the partition number)
- Grow the filesystem with the command resize2fs /dev/sda1
- Confirm the disk has grown with df -h
We now have 93% free on the root filesystem instead of the previous 79%.
Pingback: Photon OS 3.0 Grow Filesystem | EnterpriseAdmins.org