[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Fast shutdown without filesystemcheck on next boot?



> > One of the things that I have found out (at least on
> > desktop systems) is that it can slide.
> 
> what do you mean with "slide"?
> 
> >I have a MSDOS partition that routinely is "busy" when
> >the system is powering down and what the debian script >claims
> it's doing
> >during the shutdown is that it will umount the drive and >then
> remount it read only.
> 
> The problem is, you cant't umount a fs which is busy.
> At least I don't how to do that.
> 
> >Also you can edit the content of /etc/fstab or it's related
> >files and make sure that you specifically not check the >partition
> in question.
> 
> I know, but that's not a very good idea. Your fs is in 
> a bad state? Well, don't check it.
 
Asking for trouble, you are.  
At this point, we're beyond the scope of it being a laptop issue.
This will be my last comment on this thread unless I see something
laptop-ish in it.

> Here is my "off" script. Maybe you have an idea to improve it:

<disclaimer>I still think that this superfast shutdown idea is stupid
	and pretty much should be reserved to situations where things
	are severely broken already - for which you should INSIST on
	a fsck, not avoid it. If you break your system files into 14+ 
	shards it's your own fault.

	System I am reading this from is a pre-frozen potato, approximately
	December/January.
</disclaimer>

<belief modifier="grain of salt">I assume that you are showing off some
	cool kernel hack, thus you have a real need to reboot several
	times, and further it is hardware specific, so shoving it into
	a VMware environment and having a few of it run side-by-side is 
	not enough.</belief>

Why not cook up a runlevel 7 that acts just like 6 except that it takes
a shortcut approach.  I've combined my four rc6.d S scripts into one to
cut the shell invocations:

S10yankrug

--- snip here ----------------------------------------------------------
#! /bin/sh
# forget this path stuff, use explicit paths so no dir traversal!
# delete most echo's
/bin/echo -n "Fast Shutdown... "
# code mostly stolen from # miquels@cistron.nl

/sbin/killall5 -15
/bin/sleep 3
/sbin/killall5 -9

[ -c /dev/urandom ] && 
{ umask 077; /bin/dd if=/dev/urandom of=/var/run/random-seed count=1 \
                        >/dev/null 2>&1 || /bin/echo "urandom stop: failed."
}

# Update who's logged in: /var/log/wtmp # /sbin/halt -w
/sbin/swapoff -a
# /bin/sync
/bin/umount -a -r
/bin/mount -n -o remount,ro /

	/sbin/lilo -R hackdemo
# not # /sbin/reboot -d -f -i
/sbin/shutdown -r now -f "seeya on the flipside."
----------------------------------------------------------------------

That { trick I added, you should check that it works.  If it doesn't maybe
randomness won't be saved and the bootup will make things that should get
randomness slow, or be fairly non-random.  But the normal urandom script
had all that decision level I tossed.

unmount just like debian does already and you'll be fine. sync if you want
to but it doesn't normally bother.

The -f will prevent you getting an ordinary fsck merely for losing the 
mountcount lottery.  You want this instead of calling reboot like runlevel
6 does, because reboot won't prevent the fsck.  Don't leave out the now.
In *theory* this syncs everything, in practice, you'd better read the code.

hackdemo is a stanza to your /etc/lilo.conf which is also setup to be fast,
run your new hackish kernel, whatever.

Abuse also runlevel 8 for "userland minima" - if your demo is sufficiently
compatible with real life, it could have its last S script decide whether
conditions are right to telinit onward to "normal" runlevel 2.

In the Solaris world, 2 would have been this userland minima, usually "stuff
that doesn't need the network" and 3 would be normal - and would not declare
repeats of 2, since 2 would have already gone.  In Linux they aren't tied
like that, every runlevel is seperate.  Who cares what the numbers are, as 
long as you leave 0 and 6 alone.  point is, you have more runlevels to play 
with and an already structured init system.  use it.

If not terribly compatible, then slip a decision script in as 
/etc/rc2.d/S00faststart which, if it sees the decision circumstances (may or 
may not include var set by hackdemo), telinit 8.  Maybe runlevel 8 also 
spawns the environment the rest of your demo needs, so you don't have to
retype that either.

If your normal running environment is complex I hope you have a bunch of 4
leaf clovers to use up, since the big apps can only bail so fast.

-* Heather Stern * star@starshine.org *-


Reply to: