LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-31-2013, 02:06 PM   #1
BeachHead
LQ Newbie
 
Registered: May 2012
Location: Germany
Distribution: Arch, AOSP
Posts: 24

Rep: Reputation: 2
Cool hdparm - How to handle hardware 'write cache' properly?


Hallo,
i'm running a debian based system on a CompactFlash card. I've enabled hardware write cache with 'hdparm -W1 /dev/sda' in 'rc.local'.

Do i have to manually handle the device write cache at shutdown as well? Something like 'hdparm -f -F -W0 /dev/sda' in shutdown script or is it already covered by something else ('ATA reset' or something...).

I'm not 100% sure but i don't think it's covered by 'sync'.

hdparm -iI /dev/sda
Code:
/dev/sda:

 Model=TS16GCF133, FwRev=20110407, SerialNo=2011xxxx    CF13xxxx
 Config={ HardSect NotMFM Removeable DTR>10Mbs nonMagnetic }
 RawCHS=16383/15/63, TrkSize=0, SectSize=576, ECCbytes=4
 BuffType=DualPort, BuffSize=1kB, MaxMultSect=1, MultSect=off
 CurCHS=16383/15/63, CurSects=15481935, LBA=yes, LBAsects=31326208
 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio1 pio2 pio3 pio4 
 DMA modes:  mdma0 mdma1 mdma2 
 UDMA modes: udma0 udma1 *udma2 udma3 udma4 
 AdvancedPM=yes: disabled (255) WriteCache=enabled
 Drive conforms to: Unspecified:  ATA/ATAPI-7

 * signifies the current active mode


CompactFlash ATA device
	Model Number:       TS16GCF133                              
	Serial Number:      2011xxxx    CF13xxxx
	Firmware Revision:  20110407
Standards:
	Supported: 7 
	Likely used: 7
Configuration:
	Logical		max	current
	cylinders	16383	16383
	heads		15	15
	sectors/track	63	63
	--
	CHS current addressable sectors:   15481935
	LBA    user addressable sectors:   31326208
	Logical/Physical Sector size:           512 bytes
	device size with M = 1024*1024:       15296 MBytes
	device size with M = 1000*1000:       16039 MBytes (16 GB)
	cache/buffer size  = 1 KBytes (type=DualPort)
Capabilities:
	LBA, IORDY(can be disabled)
	Standby timer values: spec'd by Vendor
	R/W multiple sector transfer: Max = 1	Current = 0
	Advanced power management level: disabled
	DMA: mdma0 mdma1 mdma2 udma0 udma1 *udma2 udma3 udma4 
	     Cycle time: min=120ns recommended=120ns
	PIO: pio0 pio1 pio2 pio3 pio4 
	     Cycle time: no flow control=120ns  IORDY flow control=120ns
Commands/features:
	Enabled	Supported:
	   *	SMART feature set
	    	Security Mode feature set
	    	Power Management feature set
	   *	Write cache
	    	WRITE_BUFFER command
	    	READ_BUFFER command
	    	NOP cmd
	   *	CFA feature set
	    	Advanced Power Management feature set
	    	Mandatory FLUSH_CACHE
	   *	SMART self-test
	   *	CFA advanced modes: pio5 pio6 mdma3 mdma4 
	   *	CFA Power Level 1  (max 500mA)
Security: 
	Master password revision code = 65534
		supported
	not	enabled
	not	locked
	not	frozen
	not	expired: security count
	not	supported: enhanced erase
	2min for SECURITY ERASE UNIT. 
HW reset results:
	CBLID- above Vih
	Device num = 0
Integrity word not set (found 0x0000, expected 0xbba5)

Last edited by BeachHead; 08-01-2013 at 05:11 PM.
 
Old 07-31-2013, 02:44 PM   #2
mlslk31
Member
 
Registered: Mar 2013
Location: Florida, USA
Distribution: Slackware, FreeBSD
Posts: 210

Rep: Reputation: 77
Sure. Go ahead. While debugging, get a sense of whether the drive is actually sync'ed before the PC shuts off or reboots. On Slackware, there's a section in /etc/rc.d/rc.6 where there's a sync followed by a sleep command. I tuck an `/sbin/hdparm -F /dev/sda` between those two statements. It's worked well for years, but that's for a spinning drive where it's 100% obvious when the `hdparm -F /dev/sda` is taking effect (rattling sound, drive light on, etc.). You'll be looking for similar statements in your shutdown scripts.
 
Old 07-31-2013, 03:34 PM   #3
BeachHead
LQ Newbie
 
Registered: May 2012
Location: Germany
Distribution: Arch, AOSP
Posts: 24

Original Poster
Rep: Reputation: 2
Yep, i'm on identical environment (rc0/shutdown, rc6/restart). I will place the command there. Shouldn't harm.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
kernel parameter for disabling write-cache as like "hdparm -W0 /dev/sda" adridav Linux - Kernel 0 05-08-2011 07:29 AM
what is difference between hardware cache and slab cache? saurin Linux - Newbie 2 11-23-2010 11:53 AM
[sda] Write cache: enabled, read cache: enabled, doesn't support DPO seskissinger Linux - Software 3 05-16-2008 01:17 PM
hdparm write caching setting nouse66 Linux - Hardware 3 03-10-2003 10:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration