{"record":{"id":"c5fa06ff38a978d5","repo":"kubernetes/kops","slug":"failed-to-check-if-device-q-is-mounted-error-w","errorCode":null,"errorMessage":"failed to check if device %q is mounted, error: %w","messagePattern":"failed to check if device %q is mounted, error: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nodeup/pkg/model/volumes.go","lineNumber":59,"sourceCode":"\n\t\treturn nil\n\t}\n\n\t// @step: iterate the volume mounts and attempt to mount the devices\n\tfor _, x := range b.NodeupConfig.VolumeMounts {\n\t\t// @check the directory exists, else create it\n\t\tif err := b.EnsureDirectory(x.Path); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to ensure the directory: %s, error: %w\", x.Path, err)\n\t\t}\n\n\t\tm := &mount.SafeFormatAndMount{\n\t\t\tExec:      utilexec.New(),\n\t\t\tInterface: mount.New(\"\"),\n\t\t}\n\n\t\t// @check if the device is already mounted\n\t\tif found, err := b.IsMounted(m, x.Device, x.Path); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to check if device %q is mounted, error: %w\", x.Device, err)\n\t\t} else if found {\n\t\t\tklog.V(3).Infof(\"Skipping device: %s, path: %s as already mounted\", x.Device, x.Path)\n\t\t\tcontinue\n\t\t}\n\n\t\tklog.Infof(\"Attempting to format and mount device: %s, path: %s\", x.Device, x.Path)\n\n\t\tif err := m.FormatAndMount(x.Device, x.Path, x.Filesystem, x.MountOptions); err != nil {\n\t\t\tklog.Errorf(\"failed to mount the device: %s on: %s, error: %s\", x.Device, x.Path, err)\n\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":41,"sourceCodeEnd":76,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/nodeup/pkg/model/volumes.go#L41-L76","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before: stale device name after instance-type change\nvolumeMounts:\n- device: /dev/xvdb\n  path: /data\n// after: use the device name that exists on the instance\nvolumeMounts:\n- device: /dev/nvme1n1\n  path: /data","handlingStrategy":"validation","validationCode":"// Before nodeup runs, on the node:\n// lsblk -no NAME /dev/nvme1n1 || echo \"device missing\"\nif _, err := os.Stat(device); err != nil {\n\treturn fmt.Errorf(\"volumeMounts device %s not present on instance\", device)\n}\nif _, err := exec.LookPath(\"mount\"); err != nil {\n\treturn fmt.Errorf(\"mount helper binary missing from PATH\")\n}","typeGuard":"func deviceReady(dev string) bool {\n\t_, err := os.Stat(dev)\n\treturn err == nil\n}","tryCatchPattern":"found, err := b.IsMounted(m, x.Device, x.Path)\nif err != nil {\n\tklog.Errorf(\"mount probe failed for %s@%s: %v — check device name and mount helper\", x.Device, x.Path, err)\n\treturn fmt.Errorf(\"failed to check if device %q is mounted, error: %w\", x.Device, err)\n}","preventionTips":["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"],"tags":["volumes","mount","device","nodeup"],"backgroundTag":"mount-check-failed","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}