apache/cassandra · critical · IOException
Insufficient disk space to store %s
Error message
Insufficient disk space to store %s
What it means
RangeAwareSSTableWriter's constructor consults Directories.DataDirectory positions to decide where to place the new SSTable; when no data directory has enough free space for the estimated totalSize, getWriteableLocation returns null and the constructor throws IOException 'Insufficient disk space to store <pretty-printed size>'. This is the disk-space guard on the write path before any file is created.
Source
Thrown at src/java/org/apache/cassandra/io/sstable/RangeAwareSSTableWriter.java:74
public RangeAwareSSTableWriter(ColumnFamilyStore cfs, long estimatedKeys, long repairedAt, TimeUUID pendingRepair, boolean isTransient, SSTableFormat<?, ?> format, int sstableLevel, long totalSize, ILifecycleTransaction txn, SerializationHeader header) throws IOException
{
DiskBoundaries db = cfs.getDiskBoundaries();
directories = db.directories;
this.sstableLevel = sstableLevel;
this.cfs = cfs;
this.estimatedKeys = estimatedKeys / directories.size();
this.repairedAt = repairedAt;
this.pendingRepair = pendingRepair;
this.isTransient = isTransient;
this.format = format;
this.txn = txn;
this.header = header;
boundaries = db.positions;
if (boundaries == null)
{
Directories.DataDirectory localDir = cfs.getDirectories().getWriteableLocation(totalSize);
if (localDir == null)
throw new IOException(String.format("Insufficient disk space to store %s",
FBUtilities.prettyPrintMemory(totalSize)));
Descriptor desc = cfs.newSSTableDescriptor(cfs.getDirectories().getLocationForDisk(localDir), format);
currentWriter = cfs.createSSTableMultiWriter(desc, estimatedKeys, repairedAt, pendingRepair, isTransient, null, sstableLevel, header, txn);
}
}
private void maybeSwitchWriter(DecoratedKey key)
{
if (boundaries == null)
return;
boolean switched = false;
while (currentIndex < 0 || key.compareTo(boundaries.get(currentIndex)) > 0)
{
switched = true;
currentIndex++;
}
View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Free disk space or expand the data volumes on the target node, then retry the operation
- Lower the data footprint (reduce replication, drop unnecessary snapshots, run cleanup/gc) before re-running streaming/repair
- Add or rebalance data directories in cassandra.yaml so getWriteableLocation can find a volume with sufficient space
- Check the disk failure policy configuration; a misconfigured policy can mark healthy disks unavailable
Example fix
// mitigation is operational; caller-side guard:
// before
RangeAwareSSTableWriter w = new RangeAwareSSTableWriter(cfs, header, totalSize, ...); // throws
// after
if (cfs.getDirectories().getWriteableLocation(totalSize) == null)
throw new IOException("Aborting: not enough disk space for " + FBUtilities.prettyPrintMemory(totalSize));
RangeAwareSSTableWriter w = new RangeAwareSSTableWriter(cfs, header, totalSize, ...); Defensive patterns
Strategy: try-catch
Validate before calling
if (cfs.getDirectories().getWriteableLocation(totalSize) == null)
throw new IOException("Insufficient disk space for " + FBUtilities.prettyPrintMemory(totalSize)); Try / catch
try { writer = new RangeAwareSSTableWriter(cfs, header, totalSize, ...); }
catch (IOException e) {
if (e.getMessage().startsWith("Insufficient disk space"))
// free space, then retry or fail the stream gracefully
} Prevention
- Monitor disk utilization with alerts well below capacity
- Account for estimated SSTable size before streaming/repair
- Keep multiple data directories with headroom; rotate snapshots and run cleanup regularly
When it happens
Trigger: Creating a RangeAwareSSTableWriter (streaming, repair, or compaction-adjacent writers) when every configured data directory's usable space is below the estimated totalSize, or disk failure policy has blacklisted all volumes.
Common situations: Full disks during streaming/repair in large clusters; undersized test volumes; badly distributed data dirs where all candidate mounts are full.
Understand the failure class
Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.
Related errors
- Not enough disk space for stream %s), summaries=%s
- Checksum didn't match (expected: %d, actual: %d)
- FSWriteError (wraps IOException writing sstable component)
- This output stream is in an unsafe state after an asynchrono
- Only {} free across all data volumes. Consider adding more c
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/98b85f2ea1167218.
Report an issue: GitHub.