I have an embedded system that has an (always) read-only root filesystem
   with a writeable filesystem overlayed on top of it. However, I'm having
   problems on system shutdown unmounting or remounting it as a read-only
   filesystem (which results in things like orphan i-nodes and such when it's
   checked on the next boot).



   # mount -o remount,ro /initrd/root-overlay/

   mount: mounting /dev/mmcblk0p7 on /initrd/root-overlay failed: Device or
   resource busy


   The  system boots up with an initrd image that performs the filesystem
   mounting, before continuing on with the boot. We do this in the initrd's
   linuxrc file because sometimes we want to select another partition as the
   root filesystem.

   Here is the linuxrc script that's setting up the root partition and its
   overlay:


   echo "Mounting /proc..."

   mount -t proc none /proc


   echo "Mounting /dev/mmcblk0p5 on /ro-root..."

   mkdir -p /ro-root

   mount -o ro -t ext4 /dev/mmcblk0p5 /ro-root


   echo "Mounting /dev/mmcblk0p7 on /root-overlay..."

   mkdir -p /root-overlay

   mount -o rw -t ext4 /dev/mmcblk0p7 /root-overlay


   echo "Creating union of /ro-root and /root-overlay on /realroot..."

   mkdir -p /real-root

   mount -t aufs -o br:/root-overlay=rw:/ro-root=ro none /real-root


   echo "Pivoting to /real-root... initrd will be at /initrd."

   cd /real-root

   mkdir -p initrd

   pivot_root . initrd


   echo "Unmounting /proc..."

   umount /initrd/proc

   echo "Unmounting /dev..."

   umount /initrd/dev


   echo "Executing real init..."

   exec /sbin/init


   I'm guessing that there might be special syntax that I can use with the
   mount command (passed via the -o option) to accomplish this, but I don't
   know what that is.


   I'm  open  to alternate ways of performing the initial mounting of the
   filesystems, if it's necessary.


   Thanks,

   Steve
------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF

Reply via email to