Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 800361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:16:51+00:00 2026-05-14T23:16:51+00:00

I needed to recover the partition table I deleted accidentally. I used an application

  • 0

I needed to recover the partition table I deleted accidentally. I used an application named TestDisk. Its simply mind blowing. I reads each cylinder from the disk. I’ve seen similar such applications which work with MBR & partitioning.

I’m curious.

How do they read
clusters/cylinders/sectors from the
disk? Is there some kind of API for this?

Is it again OS dependent? If so whats the way to for Linux & for windows?

EDIT:
Well, I’m not just curious I want a hands on experience. I want to write a simple application which displays each LBA.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T23:16:52+00:00Added an answer on May 14, 2026 at 11:16 pm

    I’m the OP. I’m combining Eric Seppanen’s & Matteo Italia’s answers to make it complete.

    *NIX Platforms:

    It’s easy due to the magic of *nix special device files. You can open and read /dev/sda the same way you’d read any other file.

    Just use open, lseek, read, write (or pread, pwrite). If you want to make sure you’re physically fetching data from a drive and not from kernel buffers you can open with the flag O_DIRECT (though you must perform aligned reads/writes of 512 byte chunks for this to work).

    Windows Platform

    For Windows, there are the special objects \\.\PhisicalDriveX, with X as the number of the drive, which can be opened using the normal CreateFile API. To perform reads or writes simply call ReadFile and WriteFile (buffer must be aligned on sector size).

    More info can be found in “Physical Disks and Volumes” section of the CreateFile API documentation.

    Alternatively you can also you DeviceIoControl function which sends a control code directly to a specified device driver, causing the corresponding device to perform the corresponding operation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Needed Finfo but deleted msi package, so uninstalled php 5.3.0, downloaded 5.3.2 and installed.
Features needed: A framework, allowing me to build tab-based application with custom design (like
When recovering a MyISAM table the only file that is strictly needed is the
I needed to test a mobile application that runs on Windows CE .NET Emulator.
Is it possible to recover an R session if R needed to close due
I recently accidentally called rm -rf * on a directory an deleted some files
I had this function that deleted historical data that was no longer needed from
Needed to write a server text file as the output of a business process
I needed to store various strings in a map but I wanted to keep
I needed a background image for a searchbar, something similar to fotolia.com. so I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.