SWITCH | SWITCHdrive | SWITCHengines |

The system disk on my instance is running full! Can I make its root volume larger?


#1

TL;DR: Yes, you can increase the size of the root volume, but you must re-create your instance. You will not lose the data of your instance, but you will end up with a new instance (new UUID, new static IP address etc.) that will replace the current one.

How to do it depends on what kind of system disk your instance uses. There are two possibilities:

  • Your instance uses an “ephemeral” disk; this will be the case if you used the “boot from image” or “boot from snapshot” option to create the instance.
  • Your instance uses a “real” root volume; this will be the case if you used one of the other options, “boot from volume”, “boot from image (creates new volume)” or “boot from volume snapshot (creates new volume)”.

If you have an existing instance and have forgotten how it was created, you can find out by looking at the “Instance Details” page. This is the page that appears when you click on your instance’s name on the list in the “Instances” section of the Dashboard. Your instance has a “real” root volume if (a) there is a “Volume Attachments” section at the bottom of its Instance Details page, and (b) this section contains an entry for /dev/vda, as in this example screenshot.

If your instance has an ephemeral root disk

You need to create a “snapshot” of your instance. Then you can create a new instance based on that snapshot. You must select the option that creates a new volume; only this option will allow you to specify the desired size (in Gigabytes). The new instance should come up and look just like the old one—assuming that you selected the same flavor, security groups etc.—except it has a new and larger root volume.

As mentioned, it will also have a new IP address. If you used a Floating IP to access the old instance, you can take that away from the old instance and attach it to the new one.

Once you are sure that the new image has everything you need, you can delete the old one. You won’t be able to delete the snapshot, because the new instance’s root volume “depends” on it—our system uses a “copy on write” mechanism to make logical copies without copying all the bits.

If your instance has a “real” volume as root

You can use OpenStack’s volume service (cinder) to resize the existing root volume. The problem is that you cannot do this while the volume is attached to an instance. So you need to terminate (destroy) your instance first. Big caveat here:

IMPORTANT: When creating an instance with a new volume (whether from an existing volume or from a new volume created from an image or snapshot), there is an option “Delete on Terminate”. By default, this option is off. But if you did select this option when creating the instance, then the following instructions will kill everything. In this case, you can either go through a “volume snapshot” (left as an exercise to the reader…) or contact us to fix it.

Now you note the UUID or your instance’s root volume (and possibly of other volumes attached), and then terminate (destroy) your instance.

After you terminated the instance, you can resize the volume. You can use the “volumes” page of the Horizon dashboard: Locate the (former) root volume and select the “Extend Volume” operation from the menu.

If you have the CLI installed, you can also use that to resize the image (cinder extend UUID SIZE).

Next, you create a new instance, select “Boot from volume”, and specify your enlarged root volume. During startup, the system—the “cloud-init” component, to be exact—should discover that the disk has been enlarged, and adapt the partition table and (root) file system to make use of the new space.