Very low level Hard Disk diagnostic tool.

Documentation rewritted 01/10/09 by Dennis German again and again..

About the MHDD project

MHDD is the small and powerful freeware tool to work with hard drives at the lowest possible level. The first version was released in 2000 by Dmitry Postrigan whose main objective was to develop well-known and trusted HDD diagnostic tool. It was able to make surface scan of an IDE drive in CHS (Cylindar, Head,Sector) mode.

MHDD now includes features to access raw sectors, view S.M.A.R.T. (SMART) and other drive parameters such as acoustic management, security, Host Protected Area. You can issue a sequence of commands using simple scripting.

How it works

When DOS needs to read a sector from a drive , it asks the BIOS to do it. The BIOS looks into its tables to find where that drive is attached, checks ranges and then starts sending commands to the drive. After everything is done BIOS returns result to DOS.

This diagram shows how a DOS program talks to the drive.

    program  <--->  MSDOS  <--->  BIOS  <--->  IDE/SATA controller  <---> Hard disk

This is how MHDD works:

    MHDD  <-------------------------------->  IDE/SATA controller  <---> Hard disk 
The main difference: MHDD does not use DOS or BIOS functions or interrupts and works even if the BIOS does not detect the drive. You can turn on your drive after DOS boots (A small risk of drive damage exists if you are not careful)
. MHDD works directly with IDE or Serial ATA controller so it does not know about partitions, file systems, BIOS (motherboard) limitations, etc.
For SCSI drives MHDD uses DOS ASPI driver (incuded).

WARNING: Do not run MHDD from the hard drive that is on the same physical IDE channel (cable) you are going to use to diagnose drives! DOS (SMARTDRV.EXE, for example) may access any drive at the same moment as MHDD.
This will cause data loss on both devices on that channel! There is no way to block or trace MSDOS or BIOS read/write attempts. That is why, by default, MHDD does not work with Primary IDE as it usually used to boot DOS and run MHDD.

If the drive under test is on the Primary IDE interface use /ENABLEPRIMARY switch. (this is included in the CD image)

Platform and supported hardware

Hard disk drives

Getting MHDD

Please use website.
MHDD is available as CD image, as self-extracting floppy image or as an archive.

Preparing the package

MHDD package contents

mhdd.exe Main executable
mhdd.hlp used by MAN to describe commands
batch/ Sample batch script to run tests without intervention
scripts/test Sample script for sending commands
cfg/mhdd.cfg configuration

The bootable CD image creates a

The CD is removable and you can insert a different CD having an editor or other programs.

First run. Some important information

MHDD is very easy to use.

Knowing what to have MHDD do is not easy!
If you   don't  have in depth knowledge of how disk drives work, read the (very old version of the ) ATA/ATAPI standard: ATA8-ACS PDF.
If you already have in depth knowledge of how disk drives work, read the (very old version of the ) ATA/ATAPI standard: ATA8-ACS PDF.

It is very important to understand that you have to spend several hours (minimum) before you will start using MHDD.

I strongly recommend trying a couple of good SPARE drives, with MHDD before you start working with bad drives.

Before you start,
IDE drive to be tested MUST be configured as master (i.e. set the jumpers on the drive), no other devices should be attached.

MHDD uses cfg/mhdd.cfg for program configuration information.
Primary IDE channel is disabled. To enable it, first read read this warning message, then edit MHDD.CFG and include:

If you booted from the CD, MHDD runs from a RAM drive, so this is not problem and AUTOEXEC.BAT starts MHDD with the /enableprimary command line option.

Have a DOS formatted floppy ready for saving logs, screenshots and config files.
( Adding a tiny editor like vi.exe and pkzip would also be a good idea. Remember floppy is B: if you booted from the CD.)

MHHD logs all activity in log/mhdd.log.

  31.07.2007  17:22:14   
  31.07.2007  17:22:14    | MHDD 4.6 (c) Dmitry Postrigan | FREEWARE
  31.07.2007  17:22:14   Changing mode to: IDE
  31.07.2007  17:22:30   Changing mode to: IDE
  31.07.2007  17:22:30   Device selected: 3
  31.07.2007  17:22:32   
  31.07.2007  17:22:32   MHDD<QUIT 
  31.07.2007  17:22:32   MHDD: Exit

After starting MHDD you will see drive selection menu.
This can be displayed later by pressing SHIFT+F3.

    Drive parameters - PRESS F2 to DETECT           Current position

 Created directory: "CFG"
 Autodetect disabled. To Enable see MMHDD.CFG

  PORT 1F0h (Primary controller)                      
  1. [

  PORT 170h (Secondary controller)                    
 3.  [
  PORT 100h (PC-3000 board)                           
 5.  [

  PCI controllers)                                    
 6.  [
 8.  [
Enter HDD Number [3]:

| MHDD 4.6 (c) Dimitry Postrigan | FREEWARE                           |  hh:mm:ss 

Be extremely careful when running MHDD the first time.

[F1] displays the commands.
MAN EN command or
MAN RU command
describes what the command does.

Some have shortcuts, for example F4 for SCAN.

SCREENSHOT or [F10] will do a print screen to file LOG\SCRSHOT.LOG.

Using MHDD

Device identify commands

Retrieve information from the drive.

ID and EID display detailed information about the drive.
See ATA/ATAPI standard

ID or shift[F2]

 Maxtor 5T030H3  LBA: 60,030,432 BIOS: 80H
 SN: T3D3N8WC  FW: TAH71DP0 CACHE:512KN  Size = 8063MB
EID adds
 SMART: Enabled EID
PORT or shift[F3] detects disks and presents the drive selection menu.

CX seek read test measures access times

 Init drive: Done
 Seel&Read test
 Press <>ESC> to finish...
 Start: hh:mm:ss
 Average Access Time:
This is continueously averaged and updated until you press [ESC].
 Maximun: 35.03
 Done: hh:mm:ss

SMART attributes

SMART ATT or [F8].

Different manufactures and different models provide different information.

see ATA/ATAPI standard (PDF) for more information about SMART ATT display smart attributes to screen and smart.log
Each drive model may present different attributes

 HDD: Maxtor 5T030H3; FW: TAH71DP0; SN: T3D3N8WC
             Name                        Val Worst Raw
 Att #   1 : Read error rate           : 253  252  94
 Att #   3 : Spin up time              : 210  208  16970
 Att #   4 : Number of spin-up times   : 240  240  27451  
 Att #   5 : Reallocated sectors count : 253  253  0  
 Att #   6 : Read channel margin       : 253  253  0  
 Att #   7 : Seek error rate           : 253  252  0  
 Att #   8 : Seek time performance     : 252  245  53387  
 Att #   9 : Power-on time             : 216  216  64096  
 Att #  10 : Spin-up retries           : 253  252  0  
 Att #  11 : Calibration retries       : 253  252  0  
 Att #  12 : Start/stop count          : 252  252  432  
 Att # 187 : Unknown                   :  35   46  35  
 Att # 189 : Unknown                   :  35   46  35  
 Att # 190 : Unknown                   :  35   46  35  
 Att # 194 : HDA Temperature           :  35   46  35  
 Att # 195 : Hardware ECC recovered    : 253  252  731 
 Att # 196 : Reallocate event count    : 253  253  0  
 Att # 197 : Current pending sectors   : 253  253  0  
 Att # 198 : Offline scan UNC sectors  : 253  253  0  
 Att # 199 : Ultra ATA CRC Error Rate  : 199  199  0  
 Att # 200 : Write error rate          : 253  252  0  
 Att # 201 : Unknown                   : 253  172  794 
 Att # 202 : Unknown                   : 100  253  0

SMART commands

SMART off | on Start with this!

SMART AAS enable | disable attribute autosave

Auto Attribute save
<1>Enable, <0>disable, <ESC>=Cancel:…

SMART DATA read data
If this does not display in about 50 seconds the drive may not be responding (or you forgot to smart on)
No error is displayed by MHHD if the command timesout.

 off-line data collection statue: CODE:130

 Self-test execution status: nn%*, and was aborted by the HOST
Never started
and the previous self-test completed having the read element of the test failed.
Completed, and previous test
Completed without error or no test has ever been run.
nn%, and IN PROGRESS  ( percent remaining)
 Total time in seconds to complete off-line 
   data collection activity: 430
 Off-line data collection capability (bit-mapped): 91
 Error logging capability: supported
 Short self-test routine polling time (minutes): 1   (don't believe it)
 Extended self-test routine polling time (minutes): 54
 Conveyance self-test routine polling time (minutes): 2
 CheckSum: OK
 CheckSum:  FAIL, 1    -or- 109
 subsequent queries return increasing values up to 255

SMART ErLog dumps the error log to a file (this takes a minute or two)
The ERR and ABRT indicators will blink as MHDD queries log entries.

 * Smart ->  ERLOG
Filename to save the ErrorLog:                              

 Log #01 found.
 Log #EE found.
 Log #EF found.
 Log #F0 found.
 Log #FF found.

Log saved to file: "xxxxx"

Sample Error Log with failing LBAs

SMART TEST executes internal tests

-=- -=- SMART Execut OFF-Line immediate (tests) -=- -=- ------------------------------------------------------------ 0 Execute SMART off-line routine (off-line)           off-line tests run asynchronsly, i.e. without waiting) 1 Execute SMART Short self-test routine (off-line) 2 Execute SMART Ext. self-test routine (off-line) 3 Execute SMART Conveyance s.t. routine (off-line) 4 Execute SMART Selective s.t. routine (off-line) 5-63 Reserved 64-126 Vendor specific 127 Abort off-line mode self-test routine 128 Reserved 129 Execute SMART Short self-test routine (captive)           Captive tests wait for completion 130 Execute SMART Ext. self-test routine (captive) 131 Execute SMART Conveyance s.t. routine (captive) 132 Execute SMART Selective s.t. routine (captive) 133-191 Reserved 192-255 vendor specific ------------------------------------------------------ Select a test (0-255, blank or any symbol for cancel): Starting routine n, press "Y" to process:

captive tests wait until the test completes before MHDD regains control
off-line tests return control immediately and the drive continues the test.
This would permit switching to another drive and starting an off-line test on multiple drives.

Test 127 will abort an "in-progres" off-line test.

After pressing Y, the BUSY indicator will light up until the test completes .

smart data will return the remaining % of the test when running off-line tests.

Start with 129 since it's really quick.
Use smart data to see the results. It has been know to return an error the first time, issue it again.

Scanning a drive

Scanning is possible after the drive was detected by ID or EID commands.

MAKELOG scans the surface of the drive and creates a detailed log file.
If you booted from the CD there will, most likely, be insufficient space for the log file on the RAM drive.

If the target drive is less than 10GB the log will fit on a floppy.

To create the log on a hard drive :
(this means there must be one with a FAT partition which you are willing and able to write to).
(Here's a use for those old < 1GB drives you have laying around.)

  • mkdir C:\MHDD or on another partition
  • COPY MHDD\*.* C:\MHDD to copy files from the RAM drive (or CD) to the hard drive
  • C:
  • CD C:\MHDD to that directory and start MHDD
SCAN or [F4] no logfile will be created

A menu is presented to adjust Start and End LBA,
Remap bad spots( Safe to data if there are less then 100 bad blocks.)
change the Timeout for a single operaton
DGG: I suggest you change Timeout to 5
loop (useful when small range is specified)
Erase Delays(danger data will be lost).

  Scan Parameters: SPACE or ENTER to change 
   Start LBA:                        0      
   End LBA :                  12656477
   Remap :                         OFF
   Timeout (sec) :                 240
   Spindown after scan :           OFF
   Loop test/repair :              OFF
   Erase Delays *DESTRUCTIVE* :    OFF
  [A,D,S,W]-move; [CTRL+ENTER,F4]-finish    
Defaults are shown.

Press [F4] again to start the scan .

    How scan works:
  1. MHDD issues a VERIFY SECTORS command with LBA number and number of sectors to verify
  2. drive raises BUSY flag
  3. MHDD starts a timer
  4. After drive executes VERIFY, it drops BUSY
  5. MHDD measures the time and puts the corresponding block on the screen

[drive mfg model                           ] [ nnn,nnn,nnn] [   nn,nnn,nnn]  
[  EST:   mm:ss ]

AVG [ nnnnn kb/s]
ACT [ nnnnn kb/s]
. <3ms   : nnnnnnn
x <10ms  : nnnnn
X <50ms  : nnn
* <150ms : n
* <500ms :
* >500ms :
? TIME :
x UNC  :
! ABRT :
0 TONF :
* BBK  :
[ nn.n% ] [ nn.n%]

The AVG (average) transfer rate in kilobytes per second is displayed, as well as the percentge complete.

One block is 255 sectors (130,560 bytes).
During the scan you can have MHDD jump around.
left arrow ⇐ backs up 10,000 sectors up arrow ⇑ backs up 250,000 sectors
down arrow ⇓ advances 10,000 sectors right arrow ⇒ advances 250,000 sectors

The log of scan is log/mhdd.log which is nice to save like to a floppy ( or maybe c:\driveSN.LOG.

Drive registers are displayed at the top of the screen.
Drive should report DRive Seek Complete and Drive ReaDY so you will see DRSC and DRDY flags colored in blue.
Data REquest (DREQ) flag is on when drive is ready to receive or send some data from/to the PC.
BUSY appears when drive is executing (read or write command, or executing an online test).
Some flags such as WRite FaulT and Track 0 Not Found are obsolete, they never should appear.
INDeX flag is also obsolete, but sometimes blinks.

When you see ERRor flag (ERR) you can look at the error register where you can see what kind of error happened. ATA/ATAPI standard has more information about registers and commands. ?

The brightness of the blocks reflects the length of time to read the sectors .
Longer times are most likely do to the firmware performing a retry of a marginal spot.
It is normal for a checker board like pattern to scroll across the screen.

A table on the right shows the number of blocks in each time range.
If an error occurs a letter describing the type is shown

VERIFY command did NOT complete
within the timeout
data is uncorrectable.
command was aborted
Bad Block
sector ID cannot be read or not as expected
Data Address Mark Not Found
Track 0 was not found
during drive recalibration

Now that the scan showed some UNC errors, what to do?
Save the scan log! A blue block indicates remapping in progress.

smart att

Of special interest are:

  • #5 Reallocated sectors count: 144 139 1109 this should be zero!
  • #194 HDA Temperature perhaps there's an answer here!
  • #195 Hardware ECC recovered 253 252 731 Watch for astronomical number
  • #196 Reallocate event count 1 1 982 This looks bad!
  • #197 Current pending sectors 144 139 1109 Not good either!
  • #198 Offline scan UNC Sectors 1 1 11090 Looks like offline selftesting found errors too (same ones??)
  • #199 Ultra ATA CRC error rate 199.198 1 THis has to be BAD!


smart errlog

Maybe now is a good time to do a file based backup! ( but you already did that I'm sure!)

Reruning the scan most likely will show the same errors since the hardware (firmware) has already done multiple attempts to read the data.

MAKELOG creates advlog.bin to a floppy as well, it will be rather large (example: 800KB for a 6GB drive), to be used by another program to further analyze the condition of the drive surface.
Example file:

9A 00 00 00 hex header
DEVICE: Maxtor 90648D3
F/W: GAS54112
SECTORS: 12,656,448
SECTOR SIZE: 512 bytes
SCAN BLOCK SIZE: 255 sectors
              address    milli seconds           
0000 0000 0000 0000 0000 0000 0000 302a 
0000 0000 0000 ff00 0000 0000 0000 694c 
0000 0000 0000 fe01 0000 0000 0000 5a1f 
0000 0000 0000 fd02 0000 0000 0000 2b1f 
0000 0000 0000 fc03 0000 0000 0000 6122 
0000 0000 0000 fb04 0000 0000 0000 8c1c 
0000 0000 0000 1f1f c100 0000  0000 c80b 

0000 0000 0000 0a            
49,633 blocks of 16 bytes for a 6GB drive

If your drive has errors, first thing to do is to make full back up.
Then VERIFY that the backup you made is readable and complete!!

You can WIPE OUT all the DATA using the
ERASE which erases every sector
Then SCAN with REMAP on.

If you see all blocks as errors STOP. You are dealing with service-area error which cannot be fixed by MHDD .
The best option contact the manufacturer for a Return Materials Authorztion, or discard the drive.

Writing sectors to a file

TOF writes sectors To a File.
You can write several sectors or the whole drive to a file or to set of files.
ATOF (automatic file splitting) command will get more than 1 GB and to create several files.

MHDD skips bad sectors

Writing sectors from file to the drive

FF to write sectors From a File to the drive. input the LBA of the first sector to write and how many sectors to write.

Acoustic Management

AAM adjusts the Acoustic Management parameter. Note: decreasing the sound level is done by increasing the seek time!

Device Configuration

CONFIG views or set the maximum UDMA mode, Security , SMART , LBA48 mode , AAM and HPA support, etc. You can also cut or uncut the drive by using this command. Some manufacturers are using Device Configuration to artifically reduce the size of a disk.

Display all PCI devices

PCISCAN Scan PCI and save map to MHDD_PCI.log Example:

NAME-----------------------CLASS--SUBCLASS--VENDOR--DEVICE--IO PORTS---------------------
Intel                       06     00        8086    7190    0008 0000 0000 0000 0000 0000 
Intel                       06     04        8086    7191    0000 0000 0100 D0D0 FCA0 F480 
Intel                       06     01        8086    7110    0000 0000 0000 0000 0000 0000 
Intel PIIX4 EIDE Controller 01     01        8086    7111    0000 0000 0000 0000 FFA1 0000 
Intel                       0C     03        8086    7112    0000 0000 0000 0000 EF81 0000 
Intel                       06     80        8086    7113    0000 0000 0000 0000 0000 0000 
                            04     01        12EB    0001    0000 EFA1 EF69 0000 0000 0000 
VIA                         0C     00        1106    3044    F800 EC01 0000 0000 0000 0000 
                            0C     03        1045    C861    E000 0000 0000 0000 0000 0000 
PROMISE FastTrak100         01     80        105A    4D30    EFF1 EFE5 EFA9 EFE1 EE81 0000 
                            02     00        10EC    8139    E801 F700 0000 0000 0000 0000 
ATI                         03     00        1002    4C42    0000 D801 F000 0000 0000 0000 

Erasing sectors or whole drive


If your drive is recognized by the BIOS, MHDD will use BIOS functions to erase the contents of the drive. Use /DISABLEBIOS command line switch to prohibit this.

First MHDD shows the disk ID, then invokes Fast Disk Eraser

Fast Disk Eraser v4.4 (LBA28/48/BIOS/ASPI) Type start sector to write [0]: Type end sector [16514063]: tart : 1785 End :1786 [] Continue? (y/N) Start: 23:40:02 Sectors done: 2, 0Mbytes completed End :23:40:02
HDDerase from or on the Ultimate Boot CD, will ERASE the contents of the entire drive at once using the internal SECURE ERASE command. This is the fastest erase and cannot be stopped.
If the drive is powered off after accepting the SECURE ERASE command, on power up it will be locked.
In this state the drive will continue the erase unless it is unlocked (after being partially erased) if the internal password is known.
Notes at, ATA/ATAPI standard.

Cutting the drive (size change)

RHPA display factory size
HPA limits the size of a drive. Enter the new MaxLBA number, in sectors.
NHPA returns to factory size

Power cycle the drive before using NHPA .
According to ATA/ATAPI standard, you can use HPA functions only once per drive's power cycle.

Security commands

Before using Security passwords, look in the BIOS setup for options to provide the password. If there is no way to provide a password at boot time, the only way to access the drive once setting the password, is to use MHDD to disable the password.

PWD command locks a drive with defined user password. According to ATA/ATAPI standard , Power cycle the drive to make password setting active.

There are two commands to unlock drives: UNLOCK and DISPWD.
UNLOCK unlocks a drive until the next power cycle.
To disable password, UNLOCK the drive, then use DISPWD command.
You must know the password to use UNLOCK or disable password commands.
UNLOCK and DISPWD can change the master or user passwords. For example, PWD command sets USER password.


An example is in the BATCH directory.
Press [F5] to run a batch.
Comments begin with a ; but are not displayed as batch runs.
First (non comment) line must match program version number
ASK_ON/ASK_OFF ask for permission to execute every command
  default is ASK_OFF
HALT_ON / HALT_OFF on error
PAUSE seconds

  next line n times.
  [ESC] can be used to stop looping.

DEV_SELECT (from menu),

 (use 1 for Primary Master... 3 for Secondary Master, 6 for first PCI channel
(see output from SHIFT+[F3]),
DRV_SCAN {startLBA | MIN } { endLBA | MAX } {0 | 1 | 2 }
(where 0 is for scan, 1 scan and remap, 2 scan + Erase Delays)
DRV_WAIT wiat for drive to be ready
recover Native Drive size (Host Protected Area)
DRV_SEEK seconds of testing
DRV_ERASE {startLBA | MIN } {endLBA | MAX }

A comment can be added after some commands with a numeric argument, example

DRV_SEEK 10 ; expect 13.9 ms average
Use MAN EN BATCH to see the commands
;version - do not change
;confirmations: on
;terminate batch on error
;make sound after each line
beep 1 ;;;;; Please select drive with SN=Y2VSJQHE
;select a drive from the displayed list
;ATA reset
;Seek Test for 10 seconds
; scan a little
DRV_SCAN 0 200 0  
;repeat NEXT command 2 times
;scan whole drive without repair

;stop spindle
;announce completion
beep 10

Other MHDD commands

  • WAIT until drive is no longer BUSY then beep
  • PORT shift+F3,
  • INIT
  • RST or [F3]
  • STOP the spindle shift+F4
  • RX Receive data from buffer ( internal porgram debuging use only)
  • RPM Calculate Rotation speed of disk
  • SWITCHMBR i.e. toggle active | inactive
  • FDISK Write MBR with one partition containing the entire disk.

    Init Drive: Done
    Advanced (slow) Disk BADer (makes BADs) V2.2 (LBA28)
    []Continue? (y/N)

    Init Drive: Done
    Advanced Random Disk BADer (makes RANDOM BADs, LBA28)

    Command line switches

    If you booted from a CD with the MHDD command in the AUTOEXEC.BAT you will need to exit and issue the MHDD command to include switches.

    /NOPINGPONG Disable some sounds
    /DISABLEBIOS Disable ERASE through BIOS
    /DISABLESCSI Disable SCSI engine
    /ENABLEPRIMARY Enable Pimary IDE/SATA channel
    /RO (disable logging and temp files creation)

    Environment Variables

    RAMD drive letter of RAM drive

    CFG/mhhd.cfg file

    as observed

    N.B. # is NOT a comment but is included in every(?) line.


    Frequently Asked Questions

    FAQ is available here:

    original Editor: Maya Postrigan

    rewritted by Dennis German

    Copyright and Disclaimer

    This manual cannot be sold or published anywhere. As I am trying to make it useful, it is much better to give a link to this page instead of copying something from here.

    You may distribute MHDD without any limitations while you preserve copyrights. You can disassemble (reverse-engineer) MHDD for educational purposes. You cannot sell MHDD program or any its parts.

    © 2005 Dmitry Postrigan

    DISCLAIMER: Use this software as is. MHDD is powerful, but very dangerous program and nobody is responsible for any damage or data loss made by MHDD.

    © 2005 — your source of information about Hard Drives

    Click here to retrieve a very old D1699r6a-ATA8-ACS.pdf.gz 1.8MB,
    originally from:

    Documentation revised 7/31/07© by Dennis German