Subject: Re: Who's accessing my disk?
To: Ken Hornstein <kenh@cmf.nrl.navy.mil>
From: Jukka Marin <jmarin@pyy.jmp.fi>
List: current-users
Date: 02/08/1999 11:31:03
On Mon, Feb 08, 1999 at 03:08:20AM -0500, Ken Hornstein wrote:
> >Yes, I know what update is and why it does what it does.  What I didn't know
> >was why anything was "flushed to disk" when no data were being written to any
> >file.  The answer is that sync() updates the disk superblock timestamps
> >even when no buffers are actually flushed to disk.  So, as far as I
> >understand, using async mount is currently the only way to keep the disk
> >sleeping.
> 
> Dambit, that's _not_ the behavior I saw when I was working on this.

Maybe I'm doing something wrong, then?  I'm running the 990131 snapshot.
Here's my fstab:

/dev/wd0a       /       ffs     rw,noatime,nodevmtime   1 1
/dev/wd0b       none    swap    sw                      0 0
/dev/wd0e       /usr    ffs     rw,noatime              1 2
/dev/wd0f       /var    ffs     rw,noatime              1 2
/dev/wd0b       /tmp    mfs     rw,nosuid,-N,-s=65536
/dev/wd0g       /home   ffs     rw                      1 2
/dev/wd0h       /dos    msdos   rw,noauto               1 2
/kern           /kern   kernfs  rw

And then I manually run "atactl wd0 setidle 5" and the disk stops after
a while - but it starts again within 30 seconds, stops, starts, stops..
I have kdm running, but nobody has logged on.  I don't think there would
be any processes writing to disk all the time.

> The superblock timestamp only got updated when something else got
> updated.  From my memory (and a quick glance at the code), yes,
> that's right ...  the superblock only gets written back when
> fs->fs_fmod is non-zero.

Then what is it? :-)

> What I did to debug this was to print out the inode number of every
> file that gets updated.  You can put this code in /sys/ufs/ffs/ffs_vfsops.c
> in ffs_sync().  Of course, this will make your kernel log file grow
> :-) When you get the inode number (the appropriate filesystem will
> probably be useful as well) then you can use find (-inum) to find
> the right file, and that should get you going in the right direction.

Hmm.. I'll try killing xdm and see if that helps.. a bit annoying because
top doesn't work and ps seems to print garbage as well.. ;)

> You can also use -async, but that's mainly a big help when doing
> directory updates.

I don't like -async on my laptop (afraid of messing up the disk and
making the system unusable when I'm far away from the backups..

  -jm