Solved

How to search each sector in harddisk with using C

Posted on 2003-10-22
4
246 Views
Last Modified: 2010-04-22
Hi all,
i have some problem with blocks/sectors in harddisk, i need to rectify some bad sectors in disk.how can read each sector/block with using the C?
if u knw, could u pls send the procedure for this problem ...

cheers
preeth
0
Comment
Question by:preeth
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 45

Expert Comment

by:sunnycoder
ID: 9597488
>i have some problem with blocks/sectors in harddisk, i need to rectify some bad sectors in disk.
I suggest that you use fsck instead
0
 
LVL 3

Accepted Solution

by:
scn earned 50 total points
ID: 9597546
To read sector sectorNo of an hard disk called /dev/hda and having sectors of 512 bytes (e.g. ide disks) :
 
fd = open("/dev/hda", O_RDONLY);
lseek(fd, sectorNo * 512, SEEK_SET);
read(fd, buffer, 512);
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question