LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-10-2004, 01:11 AM   #1
villie
Member
 
Registered: Apr 2004
Location: Pakistan
Distribution: RedHat
Posts: 46

Rep: Reputation: 15
Reading raw hard disk sectors


Hi I want to read raw hard disk sectors without going through file system calls. How can I do that ?? I am ofcourse programming in C++.
 
Old 05-10-2004, 11:13 AM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
I suppose you can do that by just reading the bytes in /dev/hda or /dev/hdb or /dev/sda....
 
Old 05-12-2004, 06:57 AM   #3
villie
Member
 
Registered: Apr 2004
Location: Pakistan
Distribution: RedHat
Posts: 46

Original Poster
Rep: Reputation: 15
Thanx .. after searching for two days .. learning about device drivers and looking at kernel source . that is exactly what i found . Just read in bytes from the /dev entry of the device.
:-) . But i still dont know by using this method whether

.. the request goes to operating system and it queues it ..and then copies the data .. first to its buffer and then to address space of user process.
or
whether it is 'raw' IO that is data is just read from the disk to the user process's address space?
 
Old 05-12-2004, 11:32 AM   #4
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
They are the actual raw bytes on the disk.
Why does it matter how the kernel exactly gives them to your process?
 
Old 05-13-2004, 12:18 AM   #5
villie
Member
 
Registered: Apr 2004
Location: Pakistan
Distribution: RedHat
Posts: 46

Original Poster
Rep: Reputation: 15
Well we are developing a hard disk backup application. The efficiency is a very big concern there. I am not sure whether getting the Bytes directly into user space from the hard disk would increase the efficiency, but we have to know what is the actual mechanism. and what are alternatives, so that we can decide what is the most efficient and best option.
Thanx Anyways
 
  


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
reading raw data in to memory whizbit Programming 77 07-07-2005 10:20 AM
How to access raw sectors on HDD with no file system? prasanthpooyath Programming 4 01-08-2005 10:53 AM
How to remove bad sectors on hard disk ? emailssent General 4 10-13-2004 09:35 AM
Reading audio sectors still slow even with DMA enabled nukkel Linux - Hardware 0 08-19-2004 06:15 AM
Hard Disk Starting Sectors robhargreaves Linux - Hardware 1 05-20-2004 03:58 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:17 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