Solved

How to search each sector in harddisk with using C

Posted on 2003-10-22
4
240 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
Comment Utility
>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
Comment Utility
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 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

12 Experts available now in Live!

Get 1:1 Help Now