Stavane

Add a volume to your server

A volume is an extra disk for one of your servers. You pay per GB for every hour it exists, never more than the monthly price. It belongs to the server you add it to: you can detach it and attach it again, and it is removed together with the server.

Add one

  1. Open Servers in the console and choose your server.
  2. Open the storage tab of the server and choose Add volume. You can also add one under Block storage in the storage section of the menu, where you choose the server.
  3. Give it a name if you like, and a size. You see the price per month before you add it.

It takes a few seconds. The volume shows Adding until it is there, then Attached.

Format and mount it

Inside the server a new volume appears as a new disk, usually /dev/vdb for the first one. It holds no data, but it is not blank: it arrives with one partition, /dev/vdb1, with an ext4 file system on it. That file system uses features that older tools cannot grow (on Oracle Linux 9, resize2fs refuses it), so start clean: remove what is on the disk and format the whole disk yourself.

lsblk
sudo wipefs -a /dev/vdb
sudo mkfs.ext4 /dev/vdb
sudo mkdir -p /mnt/data
sudo mount /dev/vdb /mnt/data

To mount it again after a restart, add it to /etc/fstab by its UUID (sudo blkid /dev/vdb shows it).

Grow it

On the page of the server, choose Grow in the row of the volume; under Block storage in the storage section of the menu, choose Manage and then Expand. Enter the new size. A volume can grow, not shrink. The hour in which it grows counts at the new size. After it has grown, grow the file system inside the server as well. For a disk formatted as above, while it is mounted:

sudo resize2fs /dev/vdb

Detach and attach

Detach takes the disk away from the server; its data stays. Unmount it inside the server first. Attach gives it back. While either runs, the volume shows Changing. A detached volume still costs, because the space stays taken.

Remove it

Remove (Delete under Block storage, Manage) deletes the volume and everything on it for good. You type its name to confirm. Billing for it stops.

A volume is one disk, not a second copy. Keep a copy of important data somewhere else as well.

Through the API

With an API token a script can do the same. Adding a volume needs an Idempotency-Key, so a retry never adds a second one; it answers at once, so ask GET /servers/{id}/volumes until the volume is ready.

Method and path What it does
GET /servers/{id}/volumes The volumes of a server
POST /servers/{id}/volumes Add a volume (size_gb, optional name); needs an Idempotency-Key
POST /servers/{id}/volumes/{volume}/actions/grow Make a volume larger (size_gb)
POST /servers/{id}/volumes/{volume}/actions/detach Detach a volume; it keeps its data and still costs
POST /servers/{id}/volumes/{volume}/actions/attach Attach a detached volume again
DELETE /servers/{id}/volumes/{volume} Remove a volume and its data; billing for it stops