Skip to content

setup-storage: wait for LV device node before using it#139

Open
insatomcat wants to merge 1 commit into
faiproject:masterfrom
insatomcat:fixudevlvm
Open

setup-storage: wait for LV device node before using it#139
insatomcat wants to merge 1 commit into
faiproject:masterfrom
insatomcat:fixudevlvm

Conversation

@insatomcat

@insatomcat insatomcat commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

After lvcreate returns, the kernel has created the underlying /dev/dm-N device, but the friendly-name symlinks /dev/<vg>/<lv> (and /dev/mapper/<vg>-<lv>) are only created asynchronously once udev processes the corresponding uevent. setup-storage already calls "udevadm settle" before every command, but that relies on a reachable, responsive udev daemon and can return prematurely or be a no-op when udev is slow or unreachable -- e.g. in privileged containers sharing the host's /dev (see rancher/os#838) -- which leads to intermittent "mkfs.ext4: No such file or directory" failures.

Add wait_for_device(), a small bounded poll loop for the device node itself, and slot it into the LV creation command chain between lvcreate and anything that consumes /dev/<vg>/<lv> (mkfs, resize, ...). This is environment-agnostic and catches the case where udevadm settle alone is not sufficient.

After lvcreate returns, the kernel has created the underlying /dev/dm-N
device, but the friendly-name symlinks /dev/<vg>/<lv> (and
/dev/mapper/<vg>-<lv>) are only created asynchronously once udev
processes the corresponding uevent. setup-storage already calls
"udevadm settle" before every command, but that relies on a reachable,
responsive udev daemon and can return prematurely or be a no-op when
udev is slow or unreachable -- e.g. in privileged containers sharing
the host's /dev (see rancher/os#838) -- which
leads to intermittent "mkfs.ext4: No such file or directory" failures.

Add wait_for_device(), a small bounded poll loop for the device node
itself, and slot it into the LV creation command chain between
lvcreate and anything that consumes /dev/<vg>/<lv> (mkfs, resize, ...).
This is environment-agnostic and catches the case where udevadm settle
alone is not sufficient.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant