Skip to content

Volume

Source: src/Hetzner/Volume.ts

A Hetzner Cloud Volume — a network block device that can be attached to a Server in the same Location. Unattached Volumes are valid; pass server to attach at create time.

Size can grow in place (min 10 GB). Format and location are immutable (changing either replaces the Volume). Hetzner cannot shrink a Volume.

Unattached Volume

const volume = yield* Hetzner.Volume("data", {
size: 10,
format: "ext4",
location: "nbg1",
});

Named Volume with labels

const volume = yield* Hetzner.Volume("data", {
name: "app-data",
size: 20,
format: "xfs",
location: "nbg1",
labels: { role: "db" },
});
const server = yield* Hetzner.Server("web", {
serverType: "cx22",
image: "ubuntu-24.04",
location: "nbg1",
});
const volume = yield* Hetzner.Volume("data", {
size: 10,
format: "ext4",
server,
automount: true,
});