You are Here:   FAQ->Dedicated Servers->Dynamic Cloud Server->Linux DCS->Article #1


How do I assign additional disk space on a Linux DCS?


This article explains how to increase a partition's size after increasing the available disk space for your Dynamic Cloud Server. For more information on how to increase the available disk space of your Dynamic Cloud Server, please reference How can I increase/decrease hardware resources on a Dynamic Cloud Server? first.


Step 1 Log into your server via SSH.
Step 2 Use the disk free command with the human-readable option by typing df -h and pressing ENTER.

The output will show you the different partitions of the disk, their size, used space, available space and what folder they are mounted to.

increase1.png
Step 3 Use the format disk command with the list option by typing fdisk -l and pressing ENTER.

The output will show you the total disk size toward the top and all of the primary and extended partitions, the disk cylinders, filesystem ID and additional information underneath.

Warning: If any of the partitions have Linux LVM as the System type, you will need to follow the guide for increasing logical volumes - How can I increase a logical volume?

increase2.png
Step 4 Next, we will use the parted utility to alter the Extended partition size. As you can see in the image from the last step, /dev/hda4 and /dev/hda5 both have the same Start cylinder. Also, /dev/hda4 and /dev/hda6 both have the same end cylinder. This is because both /dev/hda5 and /dev/hda6 are logical partitions held "within" the /dev/hda4 Extended partition. Therefore we must first increase the Extended partition before we are able to increase the size of any logical partitions held "within" it.

Type parted /dev/hda and press ENTER to use the parted utility with the hda disk.

increase3.png
Step 5 At the parted command prompt, type unit gb and press ENTER so that output of parted will be displayed in gigabytes.
Next, type print and press ENTER to print the partition information.

The information displayed will be similar to the last two outputs.

increase4.png
Step 6 This time, type unit s and press ENTER to display output in disk sectors instead of gigabytes.
Type print again and press ENTER to print the partition information again using sectors instead of gigabytes.

The last partition should have an end sector close to the end sector of the extended partition shown in red below. We will increase the extended partition size so that we can later increase one of the logical partitions.

increase5.png
Step 7 To increase the extended partition, we will need the partition Number and the Start sector.

Using the image below as an example, we would type resize 4 23470965s -1 and press ENTER. The partition number and start sector may change depending on your settings.

resize 4 23470965s -1
resize command for the parted utility partition number Start sector of the extended partition End sector of extended partition


increase6.png
Step 8 Type print and press ENTER to list the partitions again. This time you should see that the extended partition has been enlarged and the Size and End sector are now much larger than before the resize. The last partition's End sector will remain the same as before. In the next steps, we will increase the partition size.

increase7.png
Step 9 Type unit gb and press ENTER.
Type print and press ENTER to list the partitions again, this time displayed in gigabytes.

You will see that the extended partition has been increased but the following logical partition sizes have remained the same. Type quit and press ENTER to quit the parted utility and continue with the next steps.

increase8.png
Step 10 Type fdisk /dev/hda and press ENTER to use the format disk utility with the /dev/hda disk.
Type p and press ENTER to print the partition table.

You will see here again that the End sector for the Extended partition is much higher than the End sector of the last partition.

increase9.png
Step 11 We will now increase the last partition to use all of the available space from the disk increase. To do this we must delete the partition and then re-create it. Deleting the partition and creating a new, larger partition in its place will not delete the data on the disk. We must delete and recreate the partition since it is not possible to resize.

Type d at the command prompt to delete a partition.
Type 6 to delete the last partition (The 6th partition is /dev/hda6 which is mounted to the /var folder as can be seen using the command df -h as in step one).

increase10.png
Step 12 Type n and press ENTER to create a new partition in its place.
Type l and press ENTER to create a new logical partition.
Type the default value for the First cylinder and press ENTER.
Type the default value for the Last cylinder and press ENTER to use the full amount of available space for this partition.

increase11.png
Step 13 Type p and press ENTER to print the partition table once again.

This time you will notice that the End cylinder of the last partition is now the same as the End cylinder for the Extended partition using the full amount of space.

Type w and press ENTER to write and save the changes you have made.

increase12.png
Step 14 Take the time to reboot your machine now by typing the command shutdown -r now and pressing ENTER

increase13.png
Step 15 Log back into the server via SSH after a minute or two and then use the df -h command again. You will see that the /dev/hda6 partition has still not increased. This is because we must still increase the filesystem on this partition in the next steps.

increase14.png
Step 16 Since we plan to increase the space of the /var folder (or /dev/hda6 partition), we will use the command xfs_growfs /var/ command and press ENTER to grow the xfs file system.

increase15.png
Step 17 Type df -h and press ENTER once again to check the disk freespace. This time we can see that the partition size has now been increased successfully and the process is complete.

increase15.png


Print Article
How useful was this article?
(From 5 = Very Useful to 1 = Not Very Useful at all):
1 2 3 4 5