skip to content

A second transcoding worker cannot attach the block volume the first still holds — what is the limit, and how do you get around it?

level: seniorimportance: should knowfreq 55%

answer

  1. the device knows nothing about files
  2. the filesystem lives in one machine's memory
  3. cached metadata and a free-space map
  4. one attachment at a time, by design
  5. share through a key, not a device

basics

~20 s

A block volume attaches to one machine at a time. The filesystem on it — its cache, its free-space map, its journal — is a single-machine structure, so two machines writing would corrupt it. Share through an object store or a shared mount instead.

solid answer

~50 s

A block volume hands out raw blocks; it knows nothing about files. The structure that makes those blocks into files lives entirely in the attaching machine's kernel, along with cached metadata it has not written back yet. Two machines mounting the same volume read-write would each allocate blocks the other thinks are free and each hold stale metadata, so the filesystem is destroyed rather than shared. The platform enforces one attachment at a time precisely to stop that. Your options, in order of how often they are right: publish through an **object store** and give each worker its own volume; use a **shared mount**, where a file service on the other side arbitrates many writers; or hand the volume over by detaching and reattaching, which needs a clean unmount and a way to fence a worker that has stopped responding. Note the volume also lives in one zone, so the second worker must be there.

go deeper

for a junior

Know the rule and one reason for it: a block volume attaches to one machine at a time, because the filesystem that turns blocks into files runs on that machine and keeps state in its memory.

for a middle

Explain the corruption mechanism concretely — two free-space maps, two metadata caches, two journals — and name the alternatives: publish through an object store, or use a shared mount where a service arbitrates.

for a senior

Show that you have handled the handover: a clean unmount before detach, fencing the old holder before the new one mounts, and the zone constraint that makes cross-zone failover a copy rather than a move.

for a principal

The angle is fleet design. A workload that shares state through an attached device has pinned itself to one zone and one machine; deciding that shared state is published through keys is what lets the fleet be disposable.

## What "attached" actually means A block volume is a device. It offers one operation in each direction: read the block at this offset, write the block at this offset. It has no notion of a file, a directory, free space or a lock. All of that is created by the **filesystem**, which is code running in the kernel of the machine the volume is attached to, and which keeps a great deal of state in that machine's memory: - **A cache of metadata** — where files live, how large they are, which blocks belong to which file — read once and reused. - **A free-space map** of which blocks are available to allocate. - **A journal** of changes it intends to make, so a crash can be recovered into a consistent state. - **Dirty page cache**: writes the application has issued that have not reached the device yet. None of that is on the volume at the moment it matters; it is in one machine's RAM. ## Why two machines cannot simply both mount it Give the same volume to two machines read-write and both run that code independently. Machine A allocates blocks its free-space map says are free; machine B's map, read minutes ago, says the same blocks are free and hands them to a different file. Machine A extends a directory; machine B is still working from a cached copy that does not contain the entry. Each journal replays changes the other never saw. The result is not a race with a winner — it is a filesystem eaten from the inside, and it is usually discovered long after the writes, when a read returns another file's bytes. So the platform enforces a single attachment. It is not an arbitrary quota; it is the only honest contract a device with no file semantics can offer. Some providers do offer a multi-attach mode, and it is worth knowing what it is and is not. It lets several machines see the same device — and it is only safe with a **filesystem designed to coordinate**, where the machines talk to each other to agree on allocation and locking. Attaching an ordinary single-machine filesystem in that mode corrupts it exactly as described above. Multi-attach removes the platform's guard rail; it does not remove the problem. ## The ways out, and what each costs | approach | who arbitrates | good for | the cost | |---|---|---|---| | object store for the shared artefact | nobody — keys are independent | publishing finished renders many readers fetch | no in-place edits; each worker needs its own scratch | | shared mount | a file service the machines reach over the network | several workers writing into one tree with file semantics | a network round trip per operation; small files hurt | | detach and reattach | the platform, one holder at a time | handing work over between workers | needs a clean unmount, and fencing if the holder is stuck | | coordinating filesystem on a shared device | the filesystem's own cluster protocol | specialised workloads that need raw block sharing | real operational complexity; rarely worth it | For a transcoding fleet the first line is nearly always the right one. Each worker gets its own volume for scratch, and the finished render is published to a key. The workers never need to see each other's bytes, only each other's outputs, and outputs are exactly what a key-addressed store is for. ## The handover trap When a handover is genuinely needed, detach-and-reattach has a failure mode people discover during an incident rather than a design review. A clean detach requires the holder to unmount, flushing everything still in its page cache. If the holder is wedged — hung kernel, unreachable, paused — it cannot unmount, so you are choosing between waiting and forcing. Forcing a detach abandons whatever had not been flushed, and if the machine later wakes up still believing it owns the volume, it can write stale blocks over the new holder's work. That is the split-brain the fencing step exists to prevent: the old holder must be provably stopped, not merely assumed gone, before the new one mounts. ## The zone constraint that comes with it A block volume lives inside one **availability zone** — one failure domain — and can only be attached by a machine in that zone. So "give it to the other worker" already presumes the other worker is in the same zone, and building a failover that crosses zones means copying the data, not moving the attachment. That is a design constraint on the whole fleet, not a detail of one attach call: if your recovery plan requires another zone, the shared artefact cannot be sitting on a block volume.

  • Some providers offer multi-attach on a block volume. Does that solve the problem?
    Only for a filesystem built to coordinate across machines, which talks to its peers to agree on allocation and locking. Multi-attach removes the platform's guard rail, not the underlying conflict: mounting an ordinary single-machine filesystem that way corrupts it just as surely. It is a specialised tool, not a general sharing mechanism.
  • The first worker is wedged and will not unmount. What is risky about forcing the detach?
    Anything still in its page cache is lost, and worse, if that machine later recovers still believing it holds the volume it can write stale blocks over the new holder's work. That is split brain. You need to fence the old holder — prove it is stopped, by terminating it — before the replacement mounts.
  • Why does moving the workload to another availability zone not fix the sharing problem?
    A block volume lives in one zone and can only be attached from that zone, so a worker elsewhere cannot attach it at all. Crossing zones means copying the data rather than moving the attachment, which is a different operation with its own time and cost. Sharing across zones argues for an object store or a shared mount.
  • When is a shared mount the right answer rather than an object store?
    When several machines genuinely need one tree with filesystem semantics — in-place edits, real directories, paths a tool insists on opening — and the file count is modest. If what you actually need is "somewhere both workers can put a finished file", the object store does it with fewer moving parts and no provisioned size.

saying these in an interview costs you the question

  • Says two machines can mount one volume read-write if both are careful
  • Assumes the volume itself tracks free space and locks
  • Thinks multi-attach makes any filesystem safe to share
  • Assumes a detach is instant even when the holder is unresponsive
  • Expects to attach the volume from a machine in another zone
  • Reaches for a shared mount before considering the object store