Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

How to prevent overlayroot from mounting all filesystems?


Asked by Izaiah Guevara on Dec 03, 2021 FAQ



By default, overlayroot will mount all filesystems under / in the specified mode. This can be prevented by adding another option to the configuration: Note that swap=1 and recurse=0 are separated by a comma, not a colon. (The default value for recurse is 1).
Furthermore,
To mount an overlay use the following mount options: # mount -t overlay overlay -o lowerdir= /lower,upperdir= /upper,workdir= /work /merged Note: The working directory (workdir) needs to be an empty directory on the same filesystem mount as the upper directory. The lower directory can be read-only or could be an overlay itself.
In addition, This can be prevented by adding another option to the configuration: Note that swap=1 and recurse=0 are separated by a comma, not a colon. (The default value for recurse is 1). This will prevent overlayroot from overlaying a read-write tmpfs on top of a read-only /data filesystem.
In this manner,
To make your root filesystem is mounted readonly you must edit your /etc/fstab and set the mount option ro. # /etc/fstab: static file system information. # # <file system> <mount point> <type> <options> <dump> <pass> /dev/hda1 / ext2 defaults,noatime,ro,errors=remount-ro 0 1 /dev/hda4 /var ext3 defaults 0 2
In fact,
While the root filesystem will not be affected, the view presented by OverlayFS will include any changes stored in the upper filesystem. For our embedded Linux device, we are not interested in preserving any changes to the root filesystem. Any data that we want to preserve will be stored on a separate filesystem dedicated to data storage.