2001-03-08 04:25:46

by Brian Dushaw

[permalink] [raw]
Subject: Linux kernel - and regular sync'ing?

Hey There Kernel-people!
I have a disk accessing question you may be able to help me with,
if I may be so bold....
I have a notebook computer, and in the interests of saving power
I am trying to get its disk to go into suspend mode (hdparm -S 6 /dev/hda,
say...) However, something seems to be continuously accessing the disk
at irregular intervals of 10-30 seconds, most likely calls to sync, so
that the disk never gets to sleep for long. I've followed advice in the
various HOWTO's, e.g. modifying the line "ud::once:/sbin/update" in
/etc/inittab to only sync once an hour, to no avail. Watching "top", it
sure looks as if various kernel-based daemons are responsible...nothing
else is running!
Can you offer me any advice? Any tweeks I can make to tell the system
that sync'ing only once every 5 minutes is o.k.?
I have the 2.4.2 kernel (older kernels behaved the same way) and
the RedHat 6.2 distribution.

Thx!
B.D.

--
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Brian Dushaw
Applied Physics Laboratory
University of Washington
1013 N.E. 40th Street
Seattle, WA 98105-6698
(206) 685-4198 (206) 543-1300
(206) 543-6785 (fax)
[email protected]

Web Page: http://staff.washington.edu/dushaw/index.html


2001-03-08 12:07:52

by Alan

[permalink] [raw]
Subject: Re: Linux kernel - and regular sync'ing?

> at irregular intervals of 10-30 seconds, most likely calls to sync, so
> that the disk never gets to sleep for long. I've followed advice in the
> various HOWTO's, e.g. modifying the line "ud::once:/sbin/update" in
> /etc/inittab to only sync once an hour, to no avail. Watching "top", it

Thats actually I think poor advice - it wont help and its asking to lose data

> Can you offer me any advice? Any tweeks I can make to tell the system
> that sync'ing only once every 5 minutes is o.k.?

You machine can sync continually - providing it isnt writing data. The real
question is not 'why is it syncing' but 'what is it syncing'.

The normal answer is file access times, and you can turn those off with the
noatime mount option.

To quote the linux on palmax page

For startup my /etc/rc.d/rc.local contains the following lines.
mount -o remount,rw,noatime /
/sbin/hdparm -S 15 /dev/hda

The "noatime" setting turns off the writing back of 'last accessed'
times to files. This means reading/opening files does not cause disk
wakeups. The hdparm -S 15 command sets the disk to spin down after 1
minute 15 seconds (you can play with the value).

2001-03-08 22:39:10

by Russell King

[permalink] [raw]
Subject: Re: Linux kernel - and regular sync'ing?

On Thu, Mar 08, 2001 at 12:09:51PM +0000, Alan Cox wrote:
> To quote the linux on palmax page
>
> For startup my /etc/rc.d/rc.local contains the following lines.
> mount -o remount,rw,noatime /
> /sbin/hdparm -S 15 /dev/hda

Or else place "noatime" in /etc/fstab, which is probably the better
place for it.

--
Russell King ([email protected]) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html

2001-03-08 22:55:30

by Brian Dushaw

[permalink] [raw]
Subject: Re: Linux kernel - and regular sync'ing?

In the interests of finishing off this thread:
Thanks to all who replied to my question on how to get a notebook
disk to spin down. The clear consensus is:
- the problem was probably caused by the cron daemon (I have some doubts
about this, but never mind)
- the problem is fixed by adding the "noatime" option when mounting the
root filesystem (I use /etc/fstab to do this)
- there appears to be no harm in not updating the inode access times with
this option.
- I am now using "hdparm -S 6 /dev/hda" to great effect; placed in my
/etc/rc.d/rc.local file.
- Naturally as soon as I learned all this from this e-mail thread, I found
the appropriate paragraph in an out-of-the-way spot on the "Linux on
Notebooks" pages (this must be one of Murphy's Laws... :) )
- I've added this discussion to my notebook web page in the interest of
spreading this gem of information.

B.D.


On Thu, 8 Mar 2001, Russell King wrote:

> On Thu, Mar 08, 2001 at 12:09:51PM +0000, Alan Cox wrote:
> > To quote the linux on palmax page
> >
> > For startup my /etc/rc.d/rc.local contains the following lines.
> > mount -o remount,rw,noatime /
> > /sbin/hdparm -S 15 /dev/hda
>
> Or else place "noatime" in /etc/fstab, which is probably the better
> place for it.
>
> --
> Russell King ([email protected]) The developer of ARM Linux
> http://www.arm.linux.org.uk/personal/aboutme.html
>

--
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Brian Dushaw
Applied Physics Laboratory
University of Washington
1013 N.E. 40th Street
Seattle, WA 98105-6698
(206) 685-4198 (206) 543-1300
(206) 543-6785 (fax)
[email protected]

Web Page: http://staff.washington.edu/dushaw/index.html

2001-03-10 15:25:24

by Pavel Machek

[permalink] [raw]
Subject: Re: Linux kernel - and regular sync'ing?

Hi!

> > at irregular intervals of 10-30 seconds, most likely calls to sync, so
> > that the disk never gets to sleep for long. I've followed advice in the
> > various HOWTO's, e.g. modifying the line "ud::once:/sbin/update" in
> > /etc/inittab to only sync once an hour, to no avail. Watching "top", it
>
> Thats actually I think poor advice - it wont help and its asking to
> lose data

Get noflushd. (It is _also_ asking for data loose, if you write and
disk is spinned down, it will *not* bother spinning it up; you can
leave atimes on.)
Pavel
--
I'm [email protected]. "In my country we have almost anarchy and I don't care."
Panos Katsaloulis describing me w.r.t. patents at [email protected]

2001-03-12 19:29:23

by Mark Shewmaker

[permalink] [raw]
Subject: Re: Linux kernel - and regular sync'ing?

On Thu, Mar 08, 2001 at 02:50:46PM -0800, Brian Dushaw wrote:
> - the problem is fixed by adding the "noatime" option when mounting the
> root filesystem (I use /etc/fstab to do this)
> - there appears to be no harm in not updating the inode access times with
> this option.

As an aside, you may want to keep in mind the fact that you've edited
the /etc/fstab in this way, in case random oddities show up in the future.

Short story:

Once after a system upgrade, some of the user accounts developed a problem
in which the message "You have new mail" would be printed on the screen
at every login. The message would be printed whether or not the user
actually had new mail. The problem was independent of the login shell
used, but it would only happen for some users.

It turned out that the "problem" was a few lines in the login program
itself. login was comparing the atime and mtime timestamps of $MAIL.
If mtime>atime, then it figured you had new mail and would print that
message.

That makes sense--if your mailbox had been written to (modified) since
it was last read (accessed), then that's as as good a definition as any
of having new mail. But, I had put "noatime" in /etc/fstab during the
upgrade for the line for the filesystem that /var/spool/mail was in,
and no one's mail spool had had its atime updated since the upgrade, hence
"You have new mail" messages were printed during some users' logins.

(It turned out that the folks who were not getting the message at all
were sorting all their mail into separate folders, leaving $MAIL
empty all the time.)

We decided that the slight performance advantages of the noatime option
weren't worth it and quickly removed the option. (-o remount is great!)

It's probably very much worth it for you to keep your /etc/fstab as you've
edited it, but I did want to warn you that the noatime option can
still unexpectedly break programs that make quite reasonable assumptions.

-Mark Shewmaker
[email protected]

2001-03-13 21:37:58

by Russell King

[permalink] [raw]
Subject: Re: Linux kernel - and regular sync'ing?

On Mon, Mar 12, 2001 at 02:27:02PM -0500, Mark Shewmaker wrote:
> It's probably very much worth it for you to keep your /etc/fstab as you've
> edited it, but I did want to warn you that the noatime option can
> still unexpectedly break programs that make quite reasonable assumptions.

Easy workaround - place your /home and /var trees on separate filesystems
and mount /home normally. Make /var "nodiratime" so accessing directories
doesn't update their atime. Make / "noatime".

This is basically what I've been running here for the past couple of years
and it seems fine for me. Your milage may vary though (depending on what
software you run).

--
Russell King ([email protected]) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html