Hard Disk Image creation

Hi,
I wanted to know what is the method to create a .img out of a partition in the disk (I mean a bit level copy of the whole disk) and later copying data back into another partition from the .img file.
Bharath
[223 byte] By [bharath_neo] at [2007-11-20 9:45:10]
# 1 Re: Hard Disk Image creation
You're at the beginning of a substantial study.

If by method you were thinking some .NET component, I don't know of one.

One of the problems with this type of application is that you must lock the drive in order to perform the image creation, and one of the most important drives to backup can't be locked unless you boot an alternate OS instance.

These issue can be (and have been) solved, usually by some curious means involving some simple OS (like, say, FreeDOS, or some tiny linux).

The exact means of reading the raw drive will be, therefore, dependent on what environment you choose in which to run the application. Obviously you can elect to unmount a drive in a running Windows machine, but that would still leave the boot drive, and it assumes the user doesn't put the OS paging file or other OS component files on other drives, meaning the drive couldn't be locked.

Once you're settled on how you like to get around all of that, the drive itself has a partition table you'll need to read (assuming you'll be generous enough to allow the user to elect partitions within the drive, and it hardly seems friendly not to). Past that, it's a matter of reading in sectors and storing in some block format. The .img format is one of several others, like the .iso format, you should look into. They're fairly simple layouts, but you'll have to understand how to confirm to that construction.

Restoring has a bit of a minor problem. Obviously you could restore a drive that was, say, 50 Gbytes that only contained 10 Gbytes of data, onto a 30 or 40Gbyte drive, but how would you know? When you copy by sectors, you copy empty and data filled sections alike. You are not processing the disk using the file system, unless of course you've decided to try that.

In which case you're reduced to something more akin to a RAR or ZIP archive - that is, if you're just reading in file oriented data and making an archive, you might as well do that.

But then, what about all the various operating system and file standards you might encounter? I suppose you could choose just to support one OS.

Conceptually there's a simple start, but it does get down to a few details to map out.
JVene at 2007-11-9 13:31:32 >