Sleeping volumes
A CSI driver that evicts idle tenants' volumes from replicated NVMe to S3 and lazily brings them back on attach.
Problem #
Every provider selling virtual machines and managed Kubernetes has a graveyard. Dev clusters that get switched on once a week. Test databases everyone forgot about. Paused tenants paying pennies for storage. All of these volumes sit on the same replicated storage as production: two or three copies on NVMe, DRBD or Ceph, space reserved for resync, headroom for growth.
In my experience, on a hosting fleet a noticeable share of provisioned block capacity goes months without a single IO. Anyone can calculate the exact share for their own fleet from the counters in an evening. The provider pays for it: in hardware, in electricity, and in having to make the next NVMe purchase earlier.
Why now #
Almost every provider has S3-compatible storage, and it costs an order of magnitude less than replicated NVMe. ublk has stabilized in the kernel, which lets you build a block device in userspace without your own kernel module. And finally, LINSTOR and DRBD can already add and remove replicas as a standard operation, so “return a volume to the hot tier” comes down to a routine operation, not surgery.
Why it’s cool #
Volumes are never copied in full in either direction. That is the unfair advantage.
- When a volume goes to sleep, it is cut into chunks; zero chunks and chunks already uploaded are skipped, and only the content plus a manifest goes to S3. The NVMe replicas are freed.
- On wake-up (a VM starts, a pod with a PVC gets scheduled) the volume is served immediately through ublk: a chunk that is read gets pulled from S3 on demand, while full hydration into a new DRBD replica runs in the background. Once it catches up, the device quietly switches over to DRBD and the ublk layer goes away.
Essentially, this is tiering at the level of the volume lifecycle rather than blocks. No caches with clever eviction policies, no new distributed storage. Boring at the bottom, new at the edges.
How to build it #
Stack: Go, CSI, ublk, S3 API, LINSTOR.
- Sleep detector. A controller watches the volume’s IO counters and the tenant’s signals (VM powered off, cluster suspended). The policy is set in the StorageClass: “go to sleep after 14 days without IO”.
- Going to sleep. Snapshot, read the snapshot in 4 MB chunks, hash each chunk, upload to S3 with per-tenant deduplication by hash, manifest alongside. Replicas are deleted only after the manifest has been verified. Before deletion we always check that everything is actually in S3.
- Waking up. NodeStage brings up a ublk device that serves reads from a local cache or S3 and writes to a local layer. In the background LINSTOR creates the resource, the hydrator pours in the chunks, and then device-mapper switches the table over to DRBD.
- Observability. Status on the volume object:
Awake,Sleeping,Hydrating 63%.
First working slice in 3–4 weeks without DRBD: sleep to S3 and wake-up into a local LVM volume with lazy reads. Even that is enough to measure what a wake-up costs for a typical VM.
Who has tried #
- s3backer has long exposed an S3 bucket as a block device, with a cache and an NBD mode. It’s a good building block, but it keeps the volume in S3 permanently instead of moving it between tiers.
- ZeroFS exposes S3 over NFS, 9P and NBD. Same class: the volume always lives in S3.
- Ceph can do cache tiering at the pool level, but the project itself has long advised against it for new deployments, and for block volumes it isn’t about this anyway.
The difference is that the hot path stays plain DRBD/LVM, and S3 is used only for sleep.
First customers #
Local cloud providers with a long tail of dev and staging tenants. VPS hosters with lots of powered-off machines whose disks are paid for. Internal platforms at large companies, where every team gets its own cluster and half of them sit idle.
What kills it #
The first wake-up is slow, and if a customer notices that their VM takes noticeably longer to start after two weeks idle, they will complain no matter how much you explain the savings. The second risk is the correctness of the switch from ublk to DRBD under writes: it is easy to lose data here, and this needs more tests than code. And the third: if NVMe keeps getting cheaper, providers will simply lose the motivation to count their graveyard.