(stupid?) bind mounting tricks

phil-news-nospam_at_ipal.net
Date: 02/20/05


Date: 19 Feb 2005 23:16:56 GMT

I'm wondering if anything is doing anything like this, or thinks it
might be stupid (for some reason that could be clearly explained,
like an impact on common or major software).

What I want to do at system initialization type (probably in an rc
script) is mount all the partition filesystems at special mount points
designated for them, the remount using the "bind" mounting option
specific subdirectories in those filesystems at specific mount points
to construct the traditional standard filesystem tree.

One reason I am looking at doing this is that I would like to mount
all of the following from the _same_ filesystem, in read only mode:
    /bin /dev /lib /mnt /opt /sbin /usr

I'm even considering a more radical approach as follows. Mount or
leave the root filesystem in read-only mode. It may or may not even
contain the above directories already. Then create a tmpfs or ramfs
at a temporary mount point, extract a tarball into it, then mount it
(bind mount again), at /etc (hiding the original read-only etc). To
make changes in such a system, the tarball would have to be rebuilt
and the filesystem it lives on temporarily remounted writeable to
store the new tarball.

BTW, don't worry about single user mode. I've already depricated it
on my systems in favor of using a completely separate filesystem as
a "rescue partition".

Something else I am looking into is that I note that the kernel does
mount a "rootfs" which is a specially named ramfs at "/" before it
mounts the intended root filesystem. What I am thinking about is to
make some tweaks in the kernel somehow (I haven't put enough thought
into the best steps yet) so I can end up using that ramfs as is as
the "/" mount point, and mount other filesystems at mount points
other than "/" (possibly configured through the kernel command line).

I'll put on my asbestos suit now.

-- 
-----------------------------------------------------------------------------
| Phil Howard KA9WGN       | http://linuxhomepage.com/      http://ham.org/ |
| (first name) at ipal.net | http://phil.ipal.org/   http://ka9wgn.ham.org/ |
-----------------------------------------------------------------------------


Relevant Pages

  • Re: silent semantic changes with reiser4
    ... It is not the kernel which decides. ... The filesystem containing ... Userspace helps by either mounting ... It would mount it if the kernel supports the fs, ...
    (Linux-Kernel)
  • Re: mount() function problem !
    ... mount() attaches the filesystem specified by source (which is often a device name, ... point within a file system. ... details of the options available for each filesystem type. ... Specifies the journalling mode for file data. ...
    (comp.lang.c)
  • Kernel panic while mounting local filesystem
    ... mount it local filesystem. ... PowerPC Linux Kernel Image ... io scheduler anticipatory registered ... Mounted root (nfs filesystem) readonly. ...
    (comp.os.linux.embedded)
  • Re: removing external usb hdd without unmounting causes reboot?
    ... >>> mount it for you. ... >> Isn't the kernel STILL involved in all this? ... What is then the reason for the kernel not being able to unmount a filesystem ... What in the process of unmounting denies ...
    (freebsd-stable)
  • Re: removing external usb hdd without unmounting causes reboot?
    ... to mount the file system either -- Simply plug the USB ... Isn't the kernel STILL involved in all this? ... What is then the reason for the kernel not being able to unmount a filesystem ... What in the process of unmounting denies ...
    (freebsd-stable)