Re: How to read the data from the first sector of HDD




Michael Schnell wrote:

Hi Steve,

good to see you here :)

-Michael


Hello Michael & Steve,

Thanks a lot for ur kind support!!!!!!!!!!!

Be sure (a) to unmount any(!!) filesystem, otherwise you would probably
destroy it.

Can u please clarify on this??

I can program neither in C nor am I able to write shell scripts (only
"batch" files), but I would try something like this:
(1) i=0
(2) dd if=/dev/hdx of=/tmp/oldsector bs=512 count=1 skip=i
if this fails, your disk is defective or end of disk is reached (6)
(3) dd if=/tmp/newsector of=/dev/hdx bs=512 count=1 skip=i
(4) dd if=/dev/hdx of=/tmp/readsector bs=512 count=1 skip=i
(5) dd if=/tmp/oldsector of=/dev/hdx bs=512 count=1 skip=i
(6) increment i; jump to (2)

I understand ur point and thanks for the routine but can I use the dd
command in my C program, if yes then how to use that??


It is up to you to decode the MBR-boot sector, partition tables etc. People
doing embedded tend to build a file as a "disk image" which then is
somehow copied to the embedded "disk" as a means of mastering embedded
disk drives.

Steve , can u please clarify this???

Please guide me!!!!!!!!

Thanks & Regards,
Nutty

.