[ale] Shutdown process

Byron A Jeff byron at cc.gatech.edu
Wed Jan 3 09:55:49 EST 2001


> Why can I not run a filesystem in RO mode and not worry about the user
> powering it off?  The use will never shutdown the device properly.  I just
> need files on the FS to load programs in memory.  

You can to a point. The problem is that several areas of the the root FS
require RW access (/var,/dev and /tmp for example). I had the same problem with
my mobile MP3 player because it didn't have a KB or monitor attached. Here's
how I solved it.

1) Configure LILO to boot an initial ramdisk.
2) The initial ramdisk does the following (in /linuxrc of the initial RD):
   A) Mount the HD root FS RO
   B) Build a second ramdisk.
   C) Load that ramdisk with a filesystem that will act as the root FS. For
      the most part it simply has links into the HD root FS. The variable 
      parts (/var, /tmp) are actually in the ramdisk.
   D) Boot to the new root FS which is in the ramdisk.

So you have a RW filesystem, but it's in a ramdisk, so if you power off, all
of the HD FS are untouched because they are mounted RO.

It works like a champ. Boot time is about 15-20 second and you can power cycle
it all day with no ill effects. Before it would take several minutes to boot
because it would fsck every time.

BTW you need the second ramdisk because be default the initial ramdisk system
will not run /linuxrc if the target root FS is the initial ramdisk. The
initial ramdisk needs little more that the required devices, somewhere to hook
the RO HD FS, and a shell. I'm using a modified version of sash so that I
don't have to carry any libraries.

> 
> I believed that if I just remounted the FS in RO mode, that would take care
> of the dirty FS problem.  Am I mistaken?

Yes. A full blown multiuser powerup occupies certain files (log etc) in the
filesystem. So even remounting it RO doesn't make it clean. Note that the
shutdown sequence kills all the processes before it does it's remount to RO.

> 
> Can I do the following:
> 
> 1. Load kernel
> 2. Mount / in RO
> 3. remount in RW for loading and configuraiton and storage of settings
> 4. remount in RO so user can take control.
> 5. Users turns power off when finised.

Maybe. There are a couple of issues. The first as noted above is that certain
areas of the root FS must be available RW. Secondly if any process attaches
to an open file, remounting RO will not make it clean.

Another thought is to use a second partition for the config settings, since
it's not root, it's unlikely any standard processes will hook their grubby
little filehandles into it.

My suggestion is to use the Ramdisk Luke, use the ramdisk. It gives you exactly
the functionality you need without all the hassle. You can power cycle ramdisks
all day long and keep them read/write. They only cost is the RAM itself. That's
the reason my MP3 player has 64MB of ram in it.

Hope this helps,

BAJ
--
To unsubscribe: mail majordomo at ale.org with "unsubscribe ale" in message body.





More information about the Ale mailing list