LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Reading raw hard disk sectors (https://www.linuxquestions.org/questions/programming-9/reading-raw-hard-disk-sectors-179833/)

villie 05-10-2004 01:11 AM

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++.

Hko 05-10-2004 11:13 AM

I suppose you can do that by just reading the bytes in /dev/hda or /dev/hdb or /dev/sda....

villie 05-12-2004 06:57 AM

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?

Hko 05-12-2004 11:32 AM

They are the actual raw bytes on the disk.
Why does it matter how the kernel exactly gives them to your process?

villie 05-13-2004 12:18 AM

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


All times are GMT -5. The time now is 05:55 PM.