kubernetes/kops · error
failed to check if device %q is mounted, error: %w
Error message
failed to check if device %q is mounted, error: %w
What it means
Before formatting and mounting each configured volume, nodeup calls b.IsMounted(m, device, path) using the k8s mount utility to check whether the device is already mounted at the target path. If that check itself fails (rather than returning found=false), Build() wraps the error as 'failed to check if device is mounted'. This is a pre-mount safety check failure, not a mount failure.
Source
Thrown at nodeup/pkg/model/volumes.go:59
return nil
}
// @step: iterate the volume mounts and attempt to mount the devices
for _, x := range b.NodeupConfig.VolumeMounts {
// @check the directory exists, else create it
if err := b.EnsureDirectory(x.Path); err != nil {
return fmt.Errorf("failed to ensure the directory: %s, error: %w", x.Path, err)
}
m := &mount.SafeFormatAndMount{
Exec: utilexec.New(),
Interface: mount.New(""),
}
// @check if the device is already mounted
if found, err := b.IsMounted(m, x.Device, x.Path); err != nil {
return fmt.Errorf("failed to check if device %q is mounted, error: %w", x.Device, err)
} else if found {
klog.V(3).Infof("Skipping device: %s, path: %s as already mounted", x.Device, x.Path)
continue
}
klog.Infof("Attempting to format and mount device: %s, path: %s", x.Device, x.Path)
if err := m.FormatAndMount(x.Device, x.Path, x.Filesystem, x.MountOptions); err != nil {
klog.Errorf("failed to mount the device: %s on: %s, error: %s", x.Device, x.Path, err)
return err
}
}
return nil
}
View on GitHub (pinned to 4c8573c808)
Solutions
- Read the wrapped inner error in nodeup logs to see whether it is an exec failure (missing `mount`/`findmnt`) or a device-path problem.
- Verify the device exists on the instance: `lsblk`; if the device name changed (e.g. nvme0n1 vs nvme1n1), update volumeMounts.device in the cluster spec.
- Ensure the node image includes util-linux/mount binaries in PATH, since SafeFormatAndMount shells out to them.
- If the device is in a transitional state (udev settle), reboot or re-run nodeup once the device is stable.
Example fix
// before: stale device name after instance-type change volumeMounts: - device: /dev/xvdb path: /data // after: use the device name that exists on the instance volumeMounts: - device: /dev/nvme1n1 path: /data
Defensive patterns
Strategy: validation
Validate before calling
// Before nodeup runs, on the node:
// lsblk -no NAME /dev/nvme1n1 || echo "device missing"
if _, err := os.Stat(device); err != nil {
return fmt.Errorf("volumeMounts device %s not present on instance", device)
}
if _, err := exec.LookPath("mount"); err != nil {
return fmt.Errorf("mount helper binary missing from PATH")
} Type guard
func deviceReady(dev string) bool {
_, err := os.Stat(dev)
return err == nil
} Try / catch
found, err := b.IsMounted(m, x.Device, x.Path)
if err != nil {
klog.Errorf("mount probe failed for %s@%s: %v — check device name and mount helper", x.Device, x.Path, err)
return fmt.Errorf("failed to check if device %q is mounted, error: %w", x.Device, err)
} Prevention
- Confirm device names with `lsblk` on the actual instance type (nvme vs xvdb naming differs)
- Ensure node images include util-linux (mount/findmnt) in PATH
- Avoid changing instance types without reviewing volumeMounts device mappings
- Retry nodeup only after udev has settled and the device is stable
When it happens
Trigger: The mount.IsMounted probe fails while iterating NodeupConfig.VolumeMounts: e.g. the helper executing `findmnt`/`proc mounts` parsing errors, the device path being malformed/nonexistent in a way the probe rejects, or exec of the mount helper binary failing.
Common situations: Device path typo in volumeMounts (e.g. wrong /dev/nvme device name that changed between instance types); mount helper (`mount`) binary missing from the node image; corrupted /proc/mounts or exec permission issues inside a minimal container-based bootstrap; stale udev entries after device re-enumeration.
Related errors
- failed to ensure the directory: %s, error: %w
- failed to create bpf mount unit: %w
- failed to create cgroupv2 mount unit: %w
- unknown option: %q
- error doing mount %q: %v: %s
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/c5fa06ff38a978d5.
Report an issue: GitHub.