Solved

How to search each sector in harddisk with using C

Posted on 2003-10-22
4
245 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
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
GUI development for Ubuntu 8 217
Install Apache on a Mac with Homebrew | Apache Config Issues 1 192
understanding an rpm spec file 5 66
how does yum update work 2 58
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
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…

809 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