Disabling Hard Disk caches on individual drives?

Daniel Fussell dfussell at byu.edu
Mon Apr 1 12:07:02 MDT 2013

On 04/01/2013 02:20 AM, Dan Egli wrote:
> *Hey folks,*
> * *
> *Something that was mentioned a week or two back and I meant to follow up
> but never did was changing cache mode for Linux's disk writes. How does one
> accomplish that and can it be done on an individual drive basis? I.e.
> Suppose I am using a set of hard disks in USB3 or eSATA enclosures to
> backup my home system. If I backup the entire raid (i.e. dd if=/dev/md0
> of=/dev/md1) then how do I make sure that all the data was properly written
> to the drives in md1 before I disconnect the drives and turn them off
> (since they're in enclosures I can simply turn the enclosures off)? I don't
> want to write that way, only to assume that everything is OK and find out
> later that something didn't get written right. And yes, I know I could
> simply do an individual file backup, and that's on the agenda too. But even
> then, unless unmounting the md1 would force all cached data to be written
> immediately anyway. But I am considering both options.  So I would
> appreciate it if someone could explain to me (since I've never tried
> before) how you can go about disabling write caching to an individual drive.
> *
> * *
> *Thanks!*
> *--- Dan*

hdparm -W will let you read and set the drive's write-cache enable flag 
(assuming the drive actually obeys it, I've heard rumor some don't).  As 
I recall, you will need to turn off the write-cache each time you boot.

;-Daniel Fussell

More information about the PLUG mailing list