Mount Extension of a partition on a VPS

How Mount Extension partition on VPS Server

After you upgrade your VPS resources, the RAM and the CPU will be automatically upgraded following a simple reboot.
However, even though a reboot upgrade the amount of disk space available, the partition on it is not automatically extended.

This part can be done manually. It is highly recommended to extend the partition while in Rescue Mode.
This guide will assume the VPS has been rebooted in this mode and there is only one partition on your VPS in ext3 or ext4. Please note that the output of the commands may slightly differ than yours. Also, if you reinstall your VPS, the partition will be automatically updated.

Connect to your VPS in Rescue Mode, enter the following command:


This will give you the current mounted partitions on your VPS, the one for the Rescue Mode and the one actually containing your data. The output will look like this:


sda 254:0 0 10G 0 disk
└─sda1 254:1 0 10G 0 part /
vdb 254:16 0 30G 0 disk
└─sdb1 254:17 0 30G 0 part /mnt/sdb1

consuming that your VPS partition /dev/sdb1 mounted. It needs to be unmounted. The command to do so is:

umount /dev/sdb1

Next, it is hight recommended that a filesystem check is made on the partition to correct any error currently present. run the command :

e2fsck -yf /dev/sdb1

e2fsck 1.42.9 (4-Feb-2014)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sdb1: 37870/1310720 files (0.2% non-contiguous), 313949/5242462 blocks


If you see a “bad magic superblock” error, do not continue further. If you can’t diagnose or fix this issue, it would be best to reinstall the VPS.

After that, open the fdisk application by excute the following command:

fdisk -u /dev/sdb

you can see the commands available for this application by pass m parameter :

Command (m for help): m

Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition’s system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

now we run the command to retrieve the partition start sector. Keep this number with you for later. It is indicated under “Start”.

Command (m for help): p

Disk /dev/sdb: 30 GB, 21474836480 bytes
54 heads, 49 sectors/track, 15851 cylinders, total 41943040 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: 0x000132ff
Device Boot Start End Blocks Id System
/dev/vdb1 * *2048* 41941745 20969849 83 Linux

Then, we will remove the partition table and create a new point using the same starting point:

Command (m for help): d

Selected partition 1

The sole partition on the disk is automatically deleted. Then, create a new one.

Command (m for help): n

Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-41943039, default 2048): 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): 41943039

On the line First sector, this is where you must enter the number showed earlier. In the line Last sector, you should enter the default value.

Then, you should make that partition bootable. If not, your VPS will no longer be functioning.

Command (m for help): a

Partition number (1-4): 1

Save your changes and exit the application as following:

Command (m for help): w

The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.

Now, we have to extend the partition by running the following :

resize2fs /dev/sdb1

resize2fs 1.42.9 (4-Feb-2014)
Resizing the filesystem on /dev/sdb1 to 5242624 (4k) blocks.
The filesystem on /dev/vdb1 is now 5242624 blocks long.

now you have to mount the created partion again

mount /dev/sdb1 /mnt

Finally you can check your result :

df -h

Filesystem Size Used Avail Use% Mounted on
/dev/sda1 2GB 1GB 1GB 50% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 1.9G 12K 1.9G 1% /dev
tmpfs 386M 360K 386M 1% /run
/dev/sdb1 20G 512M 19G 2.5% /mnt
Share on facebook
Share on twitter
Share on linkedin
Share on telegram
Share on whatsapp

Related Posts