Skip to content

How-to

Boot from a volume

Every instance on Breqwatr Cloud boots from a volume: flavours have no local disk. This page covers the two ways to give an instance its boot volume, a new one made from an image, or one you already have.

Boot from When Tools
A new volume, made from an image Most launches Portal, CLI, OpenTofu
An existing volume Bringing back a root volume you kept, or a volume made from a snapshot CLI, OpenTofu

Before you start

  • A network, a security group and, for Linux, a key pair, as in Launch your first instances.
  • For an existing volume: a bootable volume in the same region, not attached to another instance.

A new volume from an image

The Breqwatr Cloud Portal (Strata) always boots a new instance this way. On New instance, the Image and Disk size (GB) fields set the new boot volume. Deleting the instance in the portal deletes its boot volume too.

openstack --os-cloud <cloud-name> server create app-01 \
  --flavor v1.c1r2 --network app-net --key-name <key-name> \
  --block-device source_type=image,uuid=<image-id>,destination_type=volume,volume_size=20,boot_index=0,delete_on_termination=true \
  --wait

volume_size is the boot volume's size in GB, at least the image's minimum. delete_on_termination=true deletes the volume with the instance; use false to keep it.

block_device {
  uuid                  = data.openstack_images_image_v2.ubuntu.id
  source_type           = "image"
  destination_type      = "volume"
  volume_size           = 20
  boot_index            = 0
  delete_on_termination = true
}

This block goes in the openstack_compute_instance_v2 resource, as in Launch your first instances.

An existing volume

The portal can't boot from an existing volume, so use the CLI or OpenTofu.

To make a bootable volume from an image first:

openstack --os-cloud <cloud-name> volume create app-01-root --image "<image-name>" --size 20 --bootable

Then boot from it:

openstack --os-cloud <cloud-name> server create app-01 \
  --volume app-01-root --flavor v1.c1r2 --network app-net --key-name <key-name> \
  --wait

An instance booted with --volume keeps the volume when it's deleted.

Manage the volume as its own resource, and point the instance at it:

resource "openstack_blockstorage_volume_v3" "app_01_root" {
  name     = "app-01-root"
  size     = 20
  image_id = data.openstack_images_image_v2.ubuntu.id
}

resource "openstack_compute_instance_v2" "app_01" {
  name        = "app-01"
  flavor_name = "v1.c1r2"
  key_pair    = "<key-name>"

  block_device {
    uuid                  = openstack_blockstorage_volume_v3.app_01_root.id
    source_type           = "volume"
    destination_type      = "volume"
    boot_index            = 0
    delete_on_termination = false
  }

  network {
    name = "app-net"
  }
}

Replacing the instance, with tofu apply -replace=openstack_compute_instance_v2.app_01, keeps the volume: only the instance is destroyed and created again. tofu destroy deletes both.

Check it worked

  • openstack --os-cloud <cloud-name> server show app-01 -c status -c volumes_attached shows ACTIVE and the boot volume.
  • For an instance booted from an existing volume, -c image shows no image: it booted from the volume.
  • After deleting an instance whose volume you kept, openstack --os-cloud <cloud-name> volume show app-01-root -c status shows available.