hashicorp/nomad · error
failed to determine disk space for %s: %v
Error message
failed to determine disk space for %s: %v
What it means
The storage fingerprinter could not determine total disk space for the storage directory. It calls f.diskInfo(storageDir) (which shells out to `df` on Unix) and wraps any diskInfo failure with the directory path in this message.
Source
Thrown at client/fingerprint/storage.go:44
return fp
}
func (f *StorageFingerprint) Fingerprint(req *FingerprintRequest, resp *FingerprintResponse) error {
cfg := req.Config
// Guard against unset AllocDir
storageDir := cfg.AllocDir
if storageDir == "" {
var err error
storageDir, err = os.Getwd()
if err != nil {
return fmt.Errorf("unable to get CWD from filesystem: %s", err)
}
}
volume, total, err := f.diskInfo(storageDir)
if err != nil {
return fmt.Errorf("failed to determine disk space for %s: %v", storageDir, err)
}
if cfg.DiskTotalMB > 0 {
total = uint64(cfg.DiskTotalMB) * bytesPerMegabyte
}
resp.AddAttribute("unique.storage.volume", volume)
resp.AddAttribute("unique.storage.bytestotal", strconv.FormatUint(total, 10))
// set the disk size for the response
resp.NodeResources = &structs.NodeResources{
Disk: structs.NodeDiskResources{
DiskMB: int64(total / bytesPerMegabyte),
},
}
resp.Detected = true
return nilView on GitHub (pinned to 482b49bf1a)
Solutions
- Check the wrapped %v error to see which underlying diskInfo step failed.
- Ensure the storage/alloc directory exists and is accessible.
- Verify `df` is installed and works manually: df -k <storageDir>.
- Set DiskTotalMB in the fingerprint config to override auto-detection.
Example fix
// before
# alloc_dir = "/nonexistent/path"
// after
client {
alloc_dir = "/opt/nomad/data/alloc"
} Defensive patterns
Strategy: validation
Validate before calling
info, err := os.Stat(storageDir)
if err != nil || !info.IsDir() {
return fmt.Errorf("storage dir %s must exist before fingerprinting", storageDir)
} Try / catch
if err := fp.Fingerprint(req); err != nil {
if strings.Contains(err.Error(), "failed to determine disk space for") {
log.Printf("disk fingerprint skipped: %v", err)
return nil
}
return err
} Prevention
- Ensure the alloc/storage directory exists and is readable before client start.
- Verify `df -k <dir>` works on the target host image.
- Set DiskTotalMB override when df-based detection is unreliable.
- Include coreutils/df in container images used for Nomad clients.
When it happens
Trigger: Fingerprint on the storage fingerprinter where diskInfo fails: the path cannot be made absolute, the `df` command fails, or `df` output cannot be parsed (see storage_unix.go errors 905-909).
Common situations: AllocDir points at a nonexistent path; `df` missing from PATH or non-executable; exotic filesystems whose df output breaks parsing; paths with unusual characters.
Related errors
- failed to get free disk space for %s: %v
- unable to get CWD from filesystem: %s
- failed to determine absolute path for %s
- failed to determine mount point for %s
- failed to parse `df` output; expected at least 2 lines
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/4df8a99431ca05ca.
Report an issue: GitHub.