Cloud VPS [Ubuntu]: How to Extend an Ubuntu VPS Disk

Note: This procedure provides a basic explanation in how to extend a single partition EXT4 formatted disk; other partitioning layouts are out of the scope of this procedure (do not use if LVM based).  Any variation in this procedure could result in data loss.  If you need to extend existing partitions and are not comfortable with performing this procedure, please contact support.

Alternative Methods:  Another way to achieve this goal would be to add an additional disk, transfer the contents and replace your smaller disk

Example scenario: You used ‘configure-disks’ to partition and mount an additional 20GB disk and you now wish to extend that disk to 40GB, expanding both the partition and the storage space (EXT4) to the new 40GB size.

1. In your WebControlCenter -> Server -> VPS Management page, click ‘Disk Management’ to view your disks.  You need to identify the disk and its device name in the Linux operating system (/dev/sdb, /dev/sdc, etc).  If the disk is in use, you should be able to identify its device name from the information given in the ‘Details’ column of the disk list (remove the number from the end).
a. Another way of identifying your disk’s device name is to examine the output of ‘sudo fdisk –l’ when logged into your server via SSH.
2. Once you know the device name, select the disk in the list and use ‘Change’ to increase it’s size.  Your VPS will be shut down temporarily to perform the size increase.

3. Log into your server via SSH (Note: the rest of this procedure will use the disk device name of ‘/dev/sdb’; change this to the device name of the disk you are extending).

4. (WARNING: This step must be performed) Before making any changes to the partitioning layout, you must unmount the disk.
a. sudo umount /dev/sdb
5. Update the partition layout (text in parenthesis are informational and should not be entered as commands).
a. sudo fdisk /dev/sdb
b. d (to delete the existing primary partition)
c. n (to create a new partition)
d. p (primary partition)
e. 1 (partition 1)
f. <enter> (default starting cylinder of 1)
g. <enter> (default ending last cylinder)
h. w (write new partition layout)
6. Check the /dev/sdb1 filesystem.
a. sudo e2fsck –f /dev/sdb1
7. Resize the EXT4 filesystem.
a. sudo resize2fs /dev/sdb1
8. Re-mount the partition.
a. sudo mount –a
9. At this point your filesystem should be back online with the increased disk size available for use.

Add Feedback