Resizing a Volume¶
Note: before you start this tutorial, please create a backup of your volume. You can find a tutorial for that here.
Sometimes you find yourself in the situation that the disk you provisioned for your server is not large enough. It can then be really useful to resize the volume.
This works best if your server runs a compatible filesystem and OS. We do not support Windows at this time.
There are generally situations: 1. The volume is a secondary attached volume on your instance. 2. The volume you want to resize is the root-disk of an instance
If the volume is a secondary attached volume¶
In this case you can unmount and detach the volume before resizing. The following steps will describe the process.
-
Unmount the volume Login to the server and find which disk is the one in question
df -h. It will probably be called something like /dev/vdb -
Identify which is the correct volume to detach. Now using the command line on your local machine you can find the details
Look for the section that says: Volumes attached.
Check that this is the correct volume
-
Detach the volume Now you can detach the volume
-
Resize the volume Now you can specify the new size:
-
Re-attach te volume
-
Resize the volume from within the server
Now you should be able to see the disk again from the shell in your server.Depending on the filesystem you have used, the command will be different.
For ext3 (not specifying any parameters will typically grow it to the maximum size):
-
Re-mount the disk on a location of your choice As a last step you need to re-mount you disk
If it was attached before
mount /dev//mnt/ ``` You have now successfully expanded a volume.
If the volume is your bootdisk¶
Open your terminal and enter the following to look up the volume ID
You can use the Cinder API to extend the size of your volume. For the purpose of this tutorial we will extend the volume we created earlier to 20 GB
To use the new space, shut down the instance and start it again
First:
Then start it again:
Note that simply restarting your server won't apply the extension
To make sure the new volume size has been applied, log in through SSH and use the following command
You have now extended the size of your bootable volume