Thread: Help with detecting/finding/accessing a hard disk with C

  1. #1
    Registered User
    Join Date
    Dec 2011

    Help with detecting/finding/accessing a hard disk with C


    I'm new here and just so you know I've been researching for my project for a while now but I still don't have any idea on how to do it. Here it goes...

    I want to create a C program that can find a hard disk/usb (via user input) and access it. That's what I would want to know first. The main idea of this project is to access a hard disk/usb and find deleted files and restore it.

    Any help would be greatly appreciated. :) Thanks!

  2. #2
    Join Date
    Aug 2010
    Ontario Canada
    This is going to be entirely operating system/file system dependent... and it's not going to be a simple task.

    For example...

    DOS and early versions of Windows using the FAT file system simply set bit7 of the first letter of the filename to signal "deleted", it was fast and very easy to undo.

    Later versions delete the directory entry and reset bitfields to signal that space is available, but do not remove the data from the platters. Finding and reconstructing these files, while possible, is not even remotely close to easy.

    File Systems with garbage cans, don't delete anything, they just move the files to a hidden folder.

    Other file systems actually do delete the data from the platters.

    But there is also the question of why someone would want to do this...
    If you're a forensic data analyst with a search warrant, you might have a good reason.
    If you're a technician attempting to fix a "lost data" problem, your reason may be valid.
    However; if your some punk kid trying to steal data, yours isn't even close to a good reason.

    I'm always hesitant to give out too much information on things like this because, even if yours is a valid reason, this is a public forum and the information does become visible to those with less than honorable intent.

    My best suggestion is that you read up on the filesystems, partition management, directory systems etc and suss it out from there.

  3. #3
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    New Zealand
    Right now, although you plan to build a solution in C, you don't actually have a problem that is relevant to this forum until you have some C code.

    I suggest you come back when you have a specific problem with some C code that you have actually written, and post it here.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. hard disk information
    By rehan in forum Windows Programming
    Replies: 12
    Last Post: 08-29-2008, 09:37 PM
  2. interection with hard disk
    By sameer_2k25 in forum C Programming
    Replies: 4
    Last Post: 03-25-2005, 03:00 PM
    By vasanth in forum Tech Board
    Replies: 6
    Last Post: 07-05-2004, 11:59 PM
  4. Get information about the hard disk
    By Sloede in forum C Programming
    Replies: 4
    Last Post: 01-16-2004, 03:17 PM
  5. Strange hard disk
    By GanglyLamb in forum Tech Board
    Replies: 20
    Last Post: 03-01-2003, 04:05 AM

Tags for this Thread