hashicorp/nomad · error

unable to check available disk space: %w

Error message

unable to check available disk space: %w

What it means

Fires in the WAL migration preflightChecks when the disk-usage query on the raft directory fails; despite the adjacent comment saying the check is advisory, the error is returned and migration aborts.

Source

Thrown at helper/raftutil/migrate.go:207

	// Verify the WAL directory does not already exist.
	if _, err := os.Stat(walDir); err == nil {
		return fmt.Errorf(
			"WAL directory already exists at %s; remove it before retrying migration",
			walDir)
	}

	// Check write permissions on raft directory.
	testFile := filepath.Join(raftDir, ".permission-test")
	if err := os.WriteFile(testFile, []byte("test"), 0o600); err != nil {
		return fmt.Errorf("insufficient write permissions in %s: %w", raftDir, err)
	}
	os.Remove(testFile)

	// Check available disk space.
	usage, err := disk.Usage(raftDir)
	if err != nil {
		// Log warning but don't fail migration - disk space check is advisory.
		return fmt.Errorf("unable to check available disk space: %w", err)
	}
	availableSpace := usage.Free

	boltSize := uint64(boltInfo.Size())

	// Require at least the BoltDB size + minimum free space buffer.
	// WAL format is typically similar in size to BoltDB, but we add a buffer.
	requiredSpace := boltSize + minRequiredSpace
	if availableSpace < requiredSpace {
		return fmt.Errorf(
			"insufficient disk space: have %d bytes available, need at least %d bytes (BoltDB size %d + %d buffer)",
			availableSpace, requiredSpace, boltSize, minRequiredSpace)
	}

	return nil
}

// cleanupWAL removes the WAL directory, retrying on Windows to handle

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Check that the raft data directory exists and is readable by the nomad process
  2. Run df or equivalent on the raft directory to confirm the filesystem is accessible and not unmounted
  3. Fix any NFS/FUSE or device errors on the underlying storage, then retry nomad server migrate
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at helper/raftutil/migrate.go:207 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/d5aeae8a3305e22c. Report an issue: GitHub.