4.3.11. Increasing the size of partitions on a VPS
Attention!
Before proceeding, be sure to create backup copy of the server, as well as independently save copies of all important data from the server to your PC.Changing the size of partitions may be necessary in case plan change VPS for a tariff with a large amount of available disk space.
Partitions can be resized both with the help of specialized programs with a graphical interface, and with the help of console utilities.
- Make sure that you created backup copy of the server, as well as saved copies of all important data from the server to your PC.
- Connect image System Rescue CD the latest available version — the server will be automatically rebooted.
- Connect to the server via VNC.
- Disable mounted image.
- After server reboot connect to it over SSH and check the size information:
df -h
Attention!
Resize2fs only supports ext2-ext4 file systems. If the server uses a different file system, use Gparted or in another way.- Make sure that you created backup copy of the server, as well as saved copies of all important data from the server to your PC.
- Connect image System Rescue CD the latest available version — the server will be automatically rebooted.
- Connect to the server via VNC.
- Check the current disk layout:
fdisk -l
- Run fdisk interactively:
fdisk /dev/xvda
- In fdisk interactive mode, run the commands:
- List the current sections:
p
- Delete the section you want to enlarge (only the markup is removed, the data itself is not affected):
d 3
Instead
3
specify the number of the partition to be deleted. The numbers can be seen in the list of current sections. - Create a new partition instead of the deleted one:
n p 3
p
— primary section (primary).
Instead3
specify the number of the partition to be created (it will be the same as that of the deleted one).
When prompted for the start and end sectors, just press Enter.
⚠️ Answer the request to remove the signaturen
. - Check out the resulting markup:
p
- Save changes:
w
- Check the file system of the created partition:
e2fsck -f /dev/xvda3
Instead
3
specify the number of the created section. - Resize the file system of the created partition:
resize2fs /dev/xvda3
Instead
3
specify the number of the created section. - Exit the console:
exit
- Disable mounted image.
- After server reboot connect to it over SSH and check the size information:
df -h