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:
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
isn't hdparm -f /dev/hdx enough? why do we also need "sync" and "hdparm -W0" ?
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.
maybe anybody here with more knowledge about this topic?
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.
well, since no other distribution seems to do it, i would go for marking this bug "wontfix", is that ok with you?
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.
Ok, maybe you come up with a real explanation/solution one time, then just reopen this one :-)