If you clone your VPS to a server with a larger disk, or something goes wrong when expanding your available disk space you may have a situation where your root partition on /dev/vda1 is not taking up all the space available.
For example, here we have a root partition of 10G on a 30G disk (commands entered are shown starting with #, notable parts in bold):
# df -Th / Filesystem Type Size Used Avail Use% Mounted on /dev/vda1 ext4 9.7G 2.6G 7.1G 27% / # fdisk -l /dev/vda | head -1 Disk /dev/vda: 30 GiB, 32212254720 bytes, 62914560 sectors
To expand /dev/vda1 so that it takes up the full 30G available, there are three steps to take:
- Take a backup. While always a good idea, editing the partition table incorrectly will mess up the disk.
- Modify the partition table so that /dev/vda1 is 30G in size
- Resize the ext3/ext4 partition so that it takes up the new, full size of /dev/vda1