Layerbeat

Disks

Add storage that keeps its data when a server ends, and move it between servers.

A disk is extra block storage for a server. It keeps its data when it is detached or when its server ends, and can be attached to another server in the same zone.

Choose type and size

curl -sS 'https://layerbeat.com/v1/disk-prices'
curl -sS 'https://layerbeat.com/v1/volume-options?region=sgp&type=premium' \
  -H "Authorization: Bearer $LAYERBEAT_API_KEY"
TypeUse
premiumGeneral storage; the default
ssdFaster storage for databases and busy workloads

min_gb is the smallest size sold, max_gb the largest and step_gb the size increment. in_stock: false means the region is sold out; a purchase then returns 409 out_of_stock. The price is size × price per GB-month × months, for 1, 3 or 12 months.

Buy a disk for a server

Give vm_id and the disk is created in the server's zone, attached and mounted once the server runs.

curl -fsS https://layerbeat.com/v1/volumes \
  -H "Authorization: Bearer $LAYERBEAT_API_KEY" \
  -H 'Content-Type: application/json' \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"name":"data","vm_id":"vm_...","type":"premium","size_gb":50,"term_months":1,"currency":"USD"}'

To buy a disk without a server, give region and zone instead of vm_id. Keep the Idempotency-Key and request body if you need to retry; see safe retries.

Where it is mounted

ServerMount path
Linux/mnt/<name>, formatted ext4 the first time
WindowsC:\mnt\<name>, formatted NTFS the first time

A new disk is formatted only the first time it is mounted. A disk that already holds data is mounted as it is. If it cannot be mounted automatically it stays attached and unmounted, with a note, and its data is not changed.

Attach, detach and renew

  • POST /v1/volumes/{id}/attach with vm_id: the server must be running and in the same zone.
  • POST /v1/volumes/{id}/detach: unmounts first. A disk in use fails with volume_busy and stays attached.
  • POST /v1/volumes/{id}/renew with term_months: extends the term. An expired disk can be renewed only for a short time before its data is erased.
  • PATCH /v1/volumes/{id} with name: renames the disk.
  • DELETE /v1/volumes/{id}: deletes the disk and its data. The remaining term is not refunded.