Solved

How to search each sector in harddisk with using C

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
null coming in rpm name 3 61
Linux CentOs 6.7 : i can't start service 8 71
Openwrt vnstat 9 155
Linux: disable vim auto-comment 7 96
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 fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

910 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now