Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 256
  • Last Modified:

How to search each sector in harddisk with using C

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
preeth
Asked:
preeth
1 Solution
 
sunnycoderCommented:
>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
 
scnCommented:
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

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now