I want do some device initiation by using Daemonset(K8s resource).
Actually the deivce has been formated(inside container) and mounted(inside container) successfully to a container path /hostmnt/lvpmem/
which is mapped of /mnt/
which is a host path.
mountpoint
works fine in container
[root@driver-hm4ll /]
#mountpoint /hostmnt/lvpmem/
/hostmnt/lvpmem/ is a mountpoint
but mountpoint
works wrong in host env
[root@host ~]# mountpoint /mnt/lvpmem/
/mnt/lvpmem/ is not a mountpoint
Also the data I write in container under /hostmnt/lvpmem/
can’t been seen under /mnt/lvpmem/
in host env.
How can I mount the device so that both host and container can see it ?
Also, if container is destroyed does the mount relation also be destroyed ? I have no idea about umounting the device in host env if mount relation can’t be seen.
Some opensource project use nsenter
in container to run such format/mount command does it help ?
2
Answers
Mount point seen in container is just the snapshot when container start. My solution:
nsenter
to mount on hostexit
then the mount point can be seen in new container