Tools for hard drive diagnostics, repair, and data recovery
February 28th, 2009, 16:35
Alright, so I can read the first 100 sectors of a drive with this script which was included with mhdd 4.5.
- Code:
regs = 00 100 00 00 00 $e0 $20
waitnbsy
checkerr
checkdrq
sectorsto = lba0-99.bin
How would I go about modifying this script to read an arbitrary amount of data to a file? Would I have to read 256 sectors from start position 0, then read 256 from start position 256, and so on?
February 28th, 2009, 16:52
Let me amend that by saying... I know it is possible that way, but is there a better way? Also, how can I get it to append the file instead of making a new one every time?
May 20th, 2009, 15:29
Any chance of a follow up about writing data with MHDD scripts
Bth to normal sectors and especially to selected SA blocks
eg block 42 as per the opposite of the following read script
; rm modul id 42
reset
waitnbsy
regs = $57 $44 $43 $00 $00 $a0 $8a
waitnbsy
regs = $00 $02 $00 $00 $0F $E0 $21
waitnbsy
checkdrq
sectorsto = 42.bin
; End.
Thanks
May 20th, 2009, 16:29
ok, yes I appreciate that
and wasnt expecting to get any complete list
just some hints
But would be interested in how to script whdd to write normal sectors
eg the opposite of the read first 100 sectors script mentioned at the top of this topic, and reprinted here
regs = 00 100 00 00 00 $e0 $20
waitnbsy
checkerr
checkdrq
sectorsto = lba0-99.bin
obviously need to specify the data file first (how?)
then do some regs command that specifies the loaction and the write
maybe sectorsfrom = xxx.bin
And yes, I know it would be easier to use a normal disk editor for the normal sectors
May 20th, 2009, 17:32
Hi Spildit,
I think you overglorify some DR companies, they often just buy vendor commands.
Except for a few recent drives you could, with time and trust get just about all
the commands needed to produce your own DR bundle.
Maybe BlackST will pm you some nice code

for free I would hope.
May 20th, 2009, 18:47
ok
I wasnt asking for the special write commands to SA areas [yet

and know they specify to particular drives and models]
I was just asking if mhdd has a way of writing normal sectors
to do the opposite of the normal read
eg the opposite of the read first 100 sectors script mentioned at the top of this topic, and reprinted here
regs = 00 100 00 00 00 $e0 $20
waitnbsy
checkerr
checkdrq
sectorsto = lba0-99.bin
May 20th, 2009, 19:08
The script I posted isn't anything secret... its just a standard ATA command.
May 20th, 2009, 19:29
$20 is ATA read sectors (pio mode)
the equivalent write sectors is $30
$e0 is STANDBY IMMEDIATE
So we just need to know if mhdd has a way to fill its internal buffer first with specified data
(something like sectorsfrom ==xxx.bin)
then presumably
regs = 00 100 00 00 00 $e0 $30
waitnbsy
checkerr
checkdrq
May 21st, 2009, 4:45
Looks like mhdd does have a SECTORSFROM command
so I'll try it out (probably tomorrow)
May 26th, 2009, 14:32
Just to confirm you can write (to normal sectors)(the first 100 sectors here) with
regs = 00 100 00 00 00 $e0 $30
waitnbsy
checkerr
checkdrq
sectorsfrom = lba0-99.bin
The sectorsfrom has to be *after* the checkdrq
It uses sector numbering starting from 0 (ie LBA)
If want to write 2 sectors at LBA 1, the regs command is
regs = 00 02 01 00 00 $e0 $30
Not sure what the first 00 is, maybe some lead-in meaning normal cmds not special ones
But when I put the 01 there initially as a test it 'ignored' it and still worked
May 26th, 2009, 15:21
regs fields for normal read/write
1st - 00 ? (to be determined)
2nd - size in sectors (use 00 for 256 sectors)
3rd - LBA (lowest byte, 0- 255 decimal)
4th - LBA second lowest byte
5th - LBA third lowest bytes
6th - $E0 standby immediate
7th - $20 read, $30 write
can only do 24bit LBA addressing ie max 16million sectors = 8GB
Looks like there is also a regs48 command, which presumably can do 48 bit LBA's
May 26th, 2009, 16:14
PDFs outlining the whole of standard ATA command use are freely available out there on the 'net.
May 27th, 2009, 12:37
Indeed, the ATA command spec and codes is available on the Web
But few new vistors to this site know how to apply them the MHDD scripts, until now
The seven bytes of the regs are as follows
(and their names are derived from the orgininal CHS terminology)
F (or FR) Features
SC Sector Count (0=256 sectors)
SN (or LL) Sector Number (or LBA low byte)
CL (or LM) Cylinder Low
CH (or LH) Cylinder High
DH Device/Head
CMD
(nb some terminology writes them in the opposite order, with CMD first)
I was wrong about the DH one ($E0 in my examples)
It contains the bit specifying LBA mode, and also contains the highest LBA bits 27:24
for the full 28 bit LBA addressing = 128GB aka '137GigaBytes'
Powered by phpBB © phpBB Group.