linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Mark Hahn <hahn@physics.mcmaster.ca>
Cc: Ric Wheeler <ric@emc.com>,
	David.Ronis@McGill.CA, linux-ide@vger.kernel.org
Subject: Re: Problem with disk
Date: Sun, 07 May 2006 07:56:33 +0900	[thread overview]
Message-ID: <445D29A1.5000402@gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0605061420340.5626-100000@coffee.psychology.mcmaster.ca>

Mark Hahn wrote:
[--snip--]
> I assume that the disk will indeed do writeback if left idle for a little
> while.  on machines where this is a  real problem, I would start out by
> waving relevant chickens like the following to give the best chance of
> shutting down cleanly: 
> 	sync
> 	blockdev --flushbufs
> 	hdparm -W 0
> 	sleep 2
> 	hdparm -y
> 	sleep 5
> 	halt -hp
> 
> rather than _always_ suffering the penalty of disabled write cache, 
> especially on a single slow laptop drive...

This is slightly OT as this thread is talking about normal power down 
but disabling writeback cache has its advantages.  When you have power 
fluctation (e.g. power source fluctation or new device hot plugged and 
crappy PSU can't hold the voltage), the harddisk could briefly power 
down while other parts of system keep running.  If the disk was under 
active FS writes, this ends up in inconsistencies between what the OS 
thinks the disk has and the disk actually has.

Unfortunately, this can result in *massive* destruction of the 
filesystem.  I lost my RAID-1 array earlier this year this way.  The FS 
code systematically destroyed metadata of the filesystem and, on the 
following reboot, fsck did the final blow, I think.  I ended up with 
100+Gbytes of unorganized data and I had to recover data by grep + bvi.

This is an extreme case but it shows turning off writeback has its 
advantages.  After the initial stress & panic attack subsided, I tried 
to think about how to prevent such catastrophes, but there doesn't seem 
to be a good way.  There's no way to tell 1. if the harddrive actually 
lost the writeback cache content 2. if so, how much it has lost.  So, 
unless the OS halts the system everytime something seems weird with the 
disk, turning off writeback cache seems to be the only solution.

-- 
tejun

  reply	other threads:[~2006-05-06 22:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-03 20:01 Problem with disk David Ronis
2006-05-03 20:08 ` Ric Wheeler
2006-05-05 23:49   ` Mark Hahn
2006-05-06  0:51     ` Ric Wheeler
2006-05-06 17:11       ` Mark Hahn
2006-05-06 18:17         ` Ric Wheeler
2006-05-06 18:34           ` Mark Hahn
2006-05-06 22:56             ` Tejun Heo [this message]
2006-05-07 13:21               ` Ric Wheeler
2006-05-07 13:41                 ` Tejun Heo
2006-05-08 14:33                   ` Ric Wheeler
2006-05-10 22:21                     ` Tejun Heo
2006-05-13 19:31                       ` Ric Wheeler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=445D29A1.5000402@gmail.com \
    --to=htejun@gmail.com \
    --cc=David.Ronis@McGill.CA \
    --cc=hahn@physics.mcmaster.ca \
    --cc=linux-ide@vger.kernel.org \
    --cc=ric@emc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).