Reputation: 179
I work on an embedded system which boots from a SquashFS image located on a UBIFS formatted SPI flash. I added OverlayFS over / (root) support so that we can change all the files around but get them reset after reboot. All the OverlayFS magic is performed in initramfs. When setting up all the mountpoints, I mount --move
/run
and the UBIFS flash partition. I want to know whether I should mount --move
the upper/lower/workdir of the OverlayFS to the new root too before switch_root
. It does seem to work without it, but once in a while I get spontaneous reboots and a bus error on a manual reboot.
Upvotes: 0
Views: 2170
Reputation: 811
What tools do you have in your initramfs? Why not use busybox's switch_root or klibc's run-init, which does all the needed moving (from what I gather [0] [1])?
So to answer your question, by using the right tool, you not need to worry about using mount --move at all. If you insist however on manually doing it, do what these tools do.
[0] http://man7.org/linux/man-pages/man8/switch_root.8.html
[1] https://git.busybox.net/busybox/tree/klibc-utils/run-init.c
Upvotes: 0