Enlarge disk size


If you initially didn’t set the sufficient size of the disk and it’s being overflown, its size can be increased.


Any actions with partitions are potentially dangerous for your data. Always create backup copies!

In case with a real server the disk size is enlarged by buying a new one. In case with a virtual disk, if there is enough space on the physical disk - by means of configuring.

The procedure of disk enlarging consists of the following:

  1. Create backup copies. OS, database, intercepted files.

  2. Download live cd and stop the virtual machine.

  3. Enlarge disk size in the settings of the virtual machine (refer the guides for your virtualization environment).

  4. Enlarge the disk size with the help of parted. As free space is added to the end of the disk, if having the standard partitioning scheme (sdal - root, sda2 - extended partition with sda5 - swap) you have to remove sda2


Check that this is the swap-partition!

parted /dev/sdX
rm 5
rm 2

Extend the disk size to the full size of the partition

resizepart 1 100%
  1. Resize the filesystem

sudo resize2fs -f /dev/sdX
  1. Check the filesystem

sudo fsck -f /dev/sdX
  1. Boot from the hard disk