Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 03-23-2010, 11:22 AM   #1
LQ Newbie
Registered: Mar 2010
Posts: 2

Rep: Reputation: 0
ioctl know if write caching enabled on disks

Is there an ioctl that tells whether write caching is enabled
on disk? I believe there are many kinds of disks like scsi, ide, sata, pata etc,. And I need to know if whether write caching is enabled for all kinds of disks possible?

On reading scsi document, I found mode sense page code 8 gives whether
write cache is enabled or not. If so we can use SG_IO ioctl. Is my
assumption correct?

For IDE, sata, pata and other possible non scsi disks, how we can get
whether write caching is enabled or not?

Thanks and Regards,
Old 03-23-2010, 11:31 AM   #2
Registered: Feb 2010
Distribution: gentoo, arch, fedora, freebsd
Posts: 379

Rep: Reputation: 97
man hdparm
man sdparm
Old 03-23-2010, 11:52 PM   #3
LQ Newbie
Registered: Mar 2010
Posts: 2

Original Poster
Rep: Reputation: 0
Hello Troop,
Thank you for help.
I wanted to know if write caching enabled from C program
instead of forking sdparm and hdparm.

For scsi disks, scsi standard mentions mode sense page 0x8 gives
whether caching enabled or not. Hence I can use SG_IO ioctl for this.

For IDE, sata, pata and other possible non scsi disks, while googling
around, I found HDIO_GET_WCACHE ioctl in "/usr/include/linux/hdreg.h".
Can I use this ioctl? Is it public and defined on all linuses?
Is there any manual page for this?

The following link provides
documentation of above ioctls?

Thanks and Regards,


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[sda] Write cache: enabled, read cache: enabled, doesn't support DPO seskissinger Linux - Software 3 05-16-2008 02:17 PM
Why can I not write to a SAMBA share when read/write is enabled? eric m Linux - General 4 08-21-2006 10:22 PM
How to disable read and write caching in filesystems Kumar Programming 1 11-11-2005 04:36 AM
Should I enable write caching on my raid array? abefroman Linux - Hardware 1 09-26-2005 05:38 PM
hdparm write caching setting nouse66 Linux - Hardware 3 03-10-2003 11:13 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:57 PM.

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