LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


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

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


Hello,
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,
Mannu.
 
Old 03-23-2010, 10:31 AM   #2
troop
Member
 
Registered: Feb 2010
Distribution: gentoo, arch, fedora, freebsd
Posts: 379

Rep: Reputation: 97
man hdparm
man sdparm
 
Old 03-23-2010, 10:52 PM   #3
mannu
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
http://www.kernel.org/doc/Documentation/ioctl/hdio.txt
documentation of above ioctls?

Thanks and Regards,
Mannu.
 
  


Reply


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 01:17 PM
Why can I not write to a SAMBA share when read/write is enabled? eric m Linux - General 4 08-21-2006 09:22 PM
How to disable read and write caching in filesystems Kumar Programming 1 11-11-2005 03:36 AM
Should I enable write caching on my raid array? abefroman Linux - Hardware 1 09-26-2005 04:38 PM
hdparm write caching setting nouse66 Linux - Hardware 3 03-10-2003 10:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

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