[comp.sys.3b1] Fast reboot & Disk fragmentation

pb@pipe.cs.wisc.edu (PB Schechter) (04/23/91)

I have a couple of questions that I have seen discussed in the past but
have not (of course) kept track of, and so am reduced to asking them
again.

First, I seem to remember that someone made a simple modification
(somewhere) so that when shutting the system down normally, a key word
is written to a key file, so that, upon subsequent rebooting, fsck need
not be run (greatly speeding up the reboot process).  Rather than
create this myself, I am hoping that someone will mail (or post, if you
think there is sufficient interest) what they did to me.

Second, my disk is getting to the 60-70% full range, and things are
starting to slow down.  Are there any suggestions for defragmentation?
I know that I can copy everything to tape, delete it from my disk, and
copy it back.  However, I'm looking for something easier, if it exists.
(I seem to remember reports of a "defragmentation program" that someone
has run, for example.)

Thanks in advance for any suggestions.

PB Schechter
pb@cs.wisc.edu

dnichols@ceilidh.beartrack.com (DoN Nichols) (04/25/91)

In article <1991Apr23.140925.10180@spool.cs.wisc.edu> pb@pipe.cs.wisc.edu (PB Schechter) writes:

	[ ... ]

>First, I seem to remember that someone made a simple modification
>(somewhere) so that when shutting the system down normally, a key word
>is written to a key file, so that, upon subsequent rebooting, fsck need
>not be run (greatly speeding up the reboot process).  Rather than

	The information you want is at osu-cis under the name 'fsokay'.  I
forget whether it has a .cpio.Z on the end, but I think that it has.  (I'm
away from my machine, so I can't check it out by poping up another window,
and I'm stuck using 1200 baud, so poking around the archives on my system
from within the editor is not fun.  Osu-cis is also known as
'cheops.cis.ohio-state.edu' on Internet.

	[ ... ]


>Second, my disk is getting to the 60-70% full range, and things are
>starting to slow down.  Are there any suggestions for defragmentation?
>I know that I can copy everything to tape, delete it from my disk, and
>copy it back.  However, I'm looking for something easier, if it exists.
>(I seem to remember reports of a "defragmentation program" that someone
>has run, for example.)

	There is such a program, though I haven't run it yet.  (It must be
run while booted from a floppy, or disaster strikes.)

	If you do the back up to tape (Which is a GOOD IDEA anyway), be
warned that the backup utilities under ua WILL NOT back up any file that IT
THINKS came with the foundation set (so if you have replaced a program with
an improved version, same name, same directory - IT WILL NOT BE BACKED
UP!!)  Also, any files which carry a datestamp older than the time the
foundation set was installed on your system (THE MOST RECENT TIME), will
also not be backed up.  Files from a tar or cpio image from another system,
or from a previous install of this one should have their dates modified by
touch(1).  I just do:

	find / -type file -print | xargs touch

to make sure that everything that isn't excluded by the foundation set list
gets backed up.  (I think that it just totally skips anything in /bin and
maybe others.)  It also explicitly avoids the /etc/passwd and /etc/group
files.  You should make a separate cpio backup of the contents of /etc,
restore it in another directory, and mv the necessary files back to /etc.
Some of the files if reloaded from the backup can leave the system in a
strange state, so don't blindly mv everything from the backup into /etc.
(You might be able to get away with it if you do it while booted from a
floppy, so it doesn't touch the actual working files the kernel is currently
using.)

	Good Luck
		DoN.

-- 
Donald Nichols (DoN.)		| Voice (Days):	(703) 664-1585
D&D Data			| Voice (Eves):	(703) 938-4564
Disclaimer: from here - None	| Email:     <dnichols@ceilidh.beartrack.com>
	--- Black Holes are where God is dividing by zero ---

ahh@glyph.kingston.ny.us (Andy Heffernan) (04/25/91)

In article <1991Apr23.140925.10180@spool.cs.wisc.edu> pb@pipe.cs.wisc.edu (PB Schechter) writes:
[...]
>First, I seem to remember that someone made a simple modification
>(somewhere) so that when shutting the system down normally, a key word
>is written to a key file, so that, upon subsequent rebooting, fsck need
>not be run (greatly speeding up the reboot process).  Rather than
>create this myself, I am hoping that someone will mail (or post, if you
>think there is sufficient interest) what they did to me.

This is Lenny Tropiano's fsokay package.  This is on osu-cis, somewhere
under ~/att7300, as fsokay.cpio.Z.  It involves some magic-cookie stuff
on normal shutdown and startup to avoid unnecessary fsck's, various /etc/rc
cleanups courtesy of Gil, and a safer fsck process when it is truly
needed (like when you hit the reset button).

Highly recommended, but be comfortable with changing system scripts
like /etc/rc and /etc/shutdown.

-- 
-------------------------------------------------------------------------
  Andy Heffernan		$BJ8;z(J		uunet!glyph!ahh

john@chance.UUCP (John R. MacMillan) (04/26/91)

|First, I seem to remember that someone made a simple modification
|(somewhere) so that when shutting the system down normally, a key word
|is written to a key file, so that, upon subsequent rebooting, fsck need
|not be run (greatly speeding up the reboot process).

There are a couple of approaches you can take.  Be warned that any of
them have a very small window where the system could crash, and an
fsck would not be done, even though it probably should.

I took a fairly simple approach.  I modified /etc/shutdown so that if
given the -f (fastboot) option, after it thinks the system is
basically down, it touches /etc/fastboot.  On reboot, if this file is
present, it is removed and the fsck is skipped.

Some time ago, Lenny and Gil posted a more thorough set of stuff that
takes a slightly different approach, and is much more useful if you
have multiple partitions.

|Second, my disk is getting to the 60-70% full range, and things are
|starting to slow down.  Are there any suggestions for defragmentation?

The simplest thing to do is fsck -s the disk every now and again.
This will rebuild the freelist, so new things will not be as
fragmented, but will not help with existing fragmentation.

There is a program available, the name of which escapes me, that
claims to defragment a filesystem in place.  I have never tried it so
I can't comment on whether it works.  It's the kind of thing, though,
that I wouldn't want to do without making a backup, which means you
may not save much effort.

What I do involves a program called fsanalyze which reports (among
other things) the top 10 fragmented files.  I have it on a customized
floppy file system.  I boot from floppy, fsck -s, run fsanalyze.  Then
I copy the fragmented executables (all of them), move them all back,
and fsck -s again.  A couple iterations of this does not take long and
will take care of the most fragmented executables.

I tend to do this when I put in big things that I suspect will be
fragmented and are important to me.  For example, gcc is big, and I'm
low enough on disk space that by the time I get it fix-pointed, it's
probably pretty fragmented, and I want it to load as quickly as
possible.

ignatz@chinet.chi.il.us (Dave Ihnat) (04/29/91)

The program that you were thinking of is 'packdisk'.  It *does* work--it
defrags a disk or partition fine.  Just, that it's so (justifiably) paranoid
about trashing anything that it's s..l..o..w.. as molasses in January.  But
it does work; and especially on smaller drives, it could well be a big win.
---
		Dave Ihnat
		ignatz@homebru.chi.il.us (preferred return address)
		ignatz@chinet.chi.il.us