From: Low Level on
Hi

I'm looking to write a partition cloning utility,
much like Norton Ghost in the sense of being able
to copy only the USED sectors from one partition
to another.

I'd like for that utility to be able to work
mostly with FAT32 formats, even though NTFS
and/or EXT2 or EXT3 (f/Linux) would be nice too :-)



1. Programming background:

- I've had a bit of C/C++ programming experience,
but my Pascal skills are better.

- I'm not exactly familiar with Assembly language,
but if some Assembly code were to find its way
into a C/C++/Pascal wrapped function, using a
technique called 'inline Assembly' (I think) and
all parameters and/or function results were to be
passed in or returned in the hosting high level
language, that'll work :-)



2. Problems:

- how do I read a hard drive's FAT, in order to find out
which sectors are used and which ones aren't?

+ My idea for my utility is to be able to tell that, right
upon startup - much like what Microsoft's MSDOS Scandisk
does when it's ready to do its surface scan - where
there's a nice form (or window) appearing on screen,
and a whole bunch of differently colored columns are
in it, representing the examined disk's data layout.

+ Obviously it has to be done very quickly; I know I
could scan sector by sector, but the downside is
that it may take forever if there's a large partition
that is mostly empty.

- Another problem is an option that I'd like to add in,
which would have to do with displaying, and perhaps
catalogging all filenames and pathnames that get
read along the way, during a clone. If I were to refer
to Norton Ghost again, then it has a command line switch
allowing the user to generate some sort of a filename list.


3. Available source codes:

- I've checked out FreeDOS Defrag and Scandisk,
where both utilities were written in C or C++
plus another Scandisk version written in Turbo Pascal.

- Unfortunately, the two C/C++ utilities didn't even compile;
The Pascal version, however, did.

- I booted the PC via some BootCD with Win98 system files
and attempted to run FreeDOS Scandisk on pure MSDOS mode,
but, unfortunately it would report my either FAT32 partitions
as non-DOS disks.


Any ideas on how clone USED sectors only?
Thanks in advance
LL

From: Francis Glassborow on
Low Level wrote:
> Hi
>
> I'm looking to write a partition cloning utility,
> much like Norton Ghost in the sense of being able
> to copy only the USED sectors from one partition
> to another.
>
I doubt that you will get enaswers to your current questions here. They
are neither about C not C++ but about facilities provided at OS level.

You can, if you wish, do all that you want to do in either C or C++ but
the exact code will depend on the OS you are writing for and that takes
it away from the topics we cover here.