I'm working on a lvm csi, which can create logic volume(lvm) in a container.
It succeeds when I run lvcreate
command in a Alpine base image, but it fails when I use other base images(such as CentOS, Ubuntu, etc ...).
As needed, hostpath /dev is mounted to container, and the container is set privileged.
The error message:
# lvcreate -y -L 4M lvmvg -n test4
/dev/lvmvg/test4: not found: device not cleared
Aborting. Failed to wipe start of new LV
I add -vvv to the lvcreate command, the detail log shows that udev is not running. As a result, I get two method to create lv in CentOS base image.
udev
command in container, then I can create a lv.However, I'm not sure whether these two methods have any potential risks.
My question is:
Udev it not running in Alpine container, udev_sync and udev_rules is also set to 1, why lv can be created successfully?
Finally, I got the answer I want.
In Alpine container, the lvm was built with parameter "disable-udev_sync". So, although 'udev_sync' in lvm.conf is set to 1, lvm won't use udev to synchronize.
In other container(such as CentOS), the lvm was built with parameter "enable-udev_sync". If 'udev_sync' in lvm.conf is set to 1, lvm will use udev to synchronize, but udev service is not running. As a result, lvcreate
will get an error.