Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 65783 - hdparm init script should flush disk cache on stop.
Summary: hdparm init script should flush disk cache on stop.
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Heinrich Wendel (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-29 02:07 UTC by Forza
Modified: 2005-02-19 12:38 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Forza 2004-09-29 02:07:34 UTC
The /etc/init.d/hdparm script should disable write cache and then flush the disk when stopping. This is to prevent any data loss during reboots or system shutdown.

Example:
   hdparm -W0 -f /dev/hda

Many modern ATA drives have a large cache enabled and this can cause hidden problems with journaling filesystems if the power is shut off before the write cache is flushed to disk.

Reproducible: Always
Steps to Reproduce:
Comment 1 Forza 2004-09-29 02:09:41 UTC
Maybe it should not only be in the hdparm script, but also when reboot/halt scripts?

For example they could call just before power is turned off:
hdparm -W0 -f /dev/hd?
sync

Comment 2 Heinrich Wendel (RETIRED) gentoo-dev 2004-10-23 15:20:12 UTC
isn't hdparm -f /dev/hdx enough? why do we also need "sync" and "hdparm -W0" ?
Comment 3 Forza 2004-11-01 02:23:50 UTC
Doesn't sync only flush things in the OS/filesystem cache and buffers?

I am not sure if both -f and -W0 is needed. I suggested W0 so no more data would enter the cache after flush and sync.
Comment 4 Heinrich Wendel (RETIRED) gentoo-dev 2004-11-17 05:29:49 UTC
maybe anybody here with more knowledge about this topic?
Comment 5 Forza 2004-11-17 05:36:50 UTC
I checked on various IRC channels such as #kernel etc and I could not get a clear answer.  No one seemed to know how to verify that the harddisk indeed has flushed its caches or not.
Comment 6 Heinrich Wendel (RETIRED) gentoo-dev 2005-02-19 12:07:30 UTC
well, since no other distribution seems to do it, i would go for marking this bug "wontfix", is that ok with you?
Comment 7 Forza 2005-02-19 12:14:35 UTC
Yes of course. It was a suggestion/enhancement question, not really a bug.

However, I do have sometimes noticed (perhaps it is a filesystem problem and not a cache problem) that somtimes there are errors in the filesystem when shutting down or rebooting the computer. That's how I came to test this solution myself. 
Comment 8 Heinrich Wendel (RETIRED) gentoo-dev 2005-02-19 12:38:22 UTC
Ok, maybe you come up with a real explanation/solution one time, then just reopen this one :-)