[SOLVED] hdparm - How to handle hardware 'write cache' properly?
Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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)
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.