Increase the partition size in Linux VMs created before 2018
On older Linux VMs, the partition needs to be manually expanded.
This maneuver is performed at your own risk; make a backup before modifying partition tables and file systems.
After you expand the disk by dragging the slider in the control panel, the server will restart. Once the server has rebooted, log in as root and run the following:
fdisk /dev/sdaYou are now inside the fdisk utility. Print the current partitions with p.
Command (m for help): p
Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders, total 62914560 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
Disk identifier: 0x00026e2c
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 391167 194560 83 Linux
/dev/sda2 391168 2344959 976896 82 Linux swap / Solaris
/dev/sda3 2344960 62914559 30284800 83 LinuxRemove the partition you wish to expand using d. In this case, it's the last partition, number 3.
Create a new partition with n. Then, press Enter to accept the defaults (but double-check everything so it makes sense).
Finally, you write the partition table to the disk with w.
Now that the partition has been expanded, reboot the server so the operating system reads the new partition table. After the server has restarted, log in as root again and run:
This will output something similar to this:
If you now run df -h, you should see that the filesystem has been expanded and more disk space is available.
Last updated
Was this helpful?