Changing the partition layout of your VPS after installation
Sometimes, it is necessary to change your partition layout in order to create new partitions or extend an existing partition, for example after a VPS upgrade.
This tutorial shows how to easily change your partition layout on your VPS.
Please be advised to perform a backup of all important data before proceeding ! Changes to the partition table always bear the risk of complete data loss.
Boot your VPS into the rescue-system, this can be done within your customer control panel.
You will need to connect through VNC.
After you have established a connection login as "root".
To perform changes on the partition easily we are going to use gparted.
If you want to boot your system straight up into your regular OS after repartitioning, you should execute "exitrescue" now on the commandline before proceeding.
To start the GUI type "startx" within your VNC console and wait a few seconds until the graphical interface appears.
On the upper left side you will see "Applications", open it and select "Run Program".
Now type "gparted" within the application finder and the app should start immediately.
You should find an overview of all existing partitions on your hard disk drive.
In case there is no unused space left, we need to shrink one existing partition first, otherwise we will not be able to create a new one.
After a right click on the corresponding partition and choosing "Resize/Move", the partition can be either shrunk or extended.
Please note that LVM partitions (which are used with CentOS by default) cannot be shrunk!
In case you only wanted to extend your existing partition, please proceed with step 5.
Creating new partitions on the recently freed up/already free storage.
In this case I did it twice to create two additional partitions.
So far, no actual changes have been made on your hard drive. If you want to restart the partitioning just rerun the gparted tool.
To write the changes to the HDD hit the green tick symbol.
After hitting the tick, a warning will appear saying that you can lose all data - you should have a backup, so no worries.
The application should start performing several tasks, just wait until it has finished.
Depending on the size of the partition and the data stored on it, this will take its time.
You are done, just boot up your VPS into the regular OS and check if everything is as expected:
[email protected]:~# fdisk -l
Connect to your server using RDP.
Open the "Disk Management", this can be done with a right click on the Windows Icon on the lower left side.
You could also start it by opening the "run" prompt, which can be done via "Start" -> "Execute" -> "diskmgmt.msc", alternately the "Execute" dialogue can be opened by hitting "Windows-Logo-Key +R"
After the Windows "Disk Management" utility was started you will see an overview of all installed harddrives.
On a VPS you will usually have one drive, on a dedicated Server you will probably have more than one sparse disk.
Search for the disk you want to repartition and perform a right click on the partition you want to resize.
You can shrink and also extend a Volume, sometimes when upgrading your VPS to a bigger plan you can either create a second partition or just extend the existing partition.
For now we want to shrink the existing partition, so we hit "Shrink Volume".
After some time passed you will see a popup, just fill out the field with the amount of space you want to free up and hit "shrink".
After shrinking you will have unallocated space, now you are ready to create a new partition, e.g. a FAT32 filesystem etc.