MHDD Documentation
MHDD Documentation
MHDD Documentation
html
MHDD Documentation
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 part.
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.
Contents
Welcome to MHDD
About the MHDD project
Getting MHDD
What is inside of MHDD package
How it works
Platform requirements and supported hardware
Obtaining installation package
First run. Some important information
Now MHDD is much more than just diagnostic. You can do anything with MHDD: diagnose your drive,
access raw sectors, manage S.M.A.R.T. (SMART) and other drive parameters such as acoustic
management, security, Host Protected Area. You can even send your own commands to a drive using very
simple linear scripting engine.
Getting MHDD
When you need fresh copy of MHDD, please always use http://mhdd.com website. You can get MHDD as
CD image, as self-extracting floppy image or as archive.
After the first run log/mhdd.log file will be created automatically. This is the main log file, everything is
logged there.
If you download and extract a boot floppy or CD image you will have DR-DOS system files too.
How it works
Let's imagine how MSDOS works when it needs to read a sector from a drive — it simply asks the BIOS
to do that. Then 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 it returns result to MSDOS.
Just look at this. This is a typical diagram how generic DOS program talks to the drive.
PROGRAM <---> MSDOS <---> BIOS <---> IDE/SATA controller <---> Hard disk
The main difference: MHDD does not use BIOS functions and interrupts. So, you even do not need to
detect your drive in BIOS. You can even turn on your drive after MSDOS boots. MHDD works directly
with IDE or Serial ATA controller so it does not care about partitions, file systems, BIOS (motherboard)
limitations, etc.
WARNING: Do not run MHDD from the hard drive which is on the same physical IDE channel (cable)
which you are going to use to diagnose drives! MSDOS (SMARTDRV.EXE, for example) may decide to
access any drive at the same moment when MHDD is using it, you will have some 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 MSDOS, to run
MHDD, etc. To unblock Primary IDE please run MHDD once, then exit, and then modify MHDD.CFG or
use /ENABLEPRIMARY switch.
For SCSI drives MHDD uses DOS ASPI driver. If you are not planning to use MHDD on SCSI drives then
you do not need any drivers.
IDE/SATA Controllers:
Any integrated into motherboard north bridge (addresses: 0x1Fx for primary channel, 0x17x for
secondary channel)
AHCI controllers, however, not all - if yours is not recognized, try switching it to the IDE mode
(sometimes also called Legacy Mode). This can be done in BIOS Setup.
PCI UDMA boards (detected automatically): HPT, Silicon Image, Promise, ITE, ATI and so on.
Even some RAID boards are supported. In this case MHDD works with each physical drive
separately
UDMA/RAID controllers integrated into motherboard as additional chip
Any IDE or Serial-ATA drive with size bigger than 600Mbytes, in other words, LBA mode is
supported in full. This is because I have removed whole CHS code since version 2.9
Any IDE or Serial-ATA drive with size lower than 8388607 TBytes, in other words, LBA48 mode is
supported in full
Any SCSI drive with sector size 512—528 bytes
IDE drive should operate in master mode, and no slave devices should be attached. Please configure all
drives you are planning to work with as master devices.
Other devices
Any SCSI removable media such as tape, CDROM. Maximum sector size for such devices is 4096
bytes
You can burn CD image with any CD burning software. Your CD will be bootable.
You may also decide to obtain just executables. You will have to extract MHDD files somewhere.
It is very important to understand that you have to spend several hours (minimum) before you will start
understanding results made by MHDD. I strongly recommend trying a couple of good drives with MHDD
before you start working with bad drives.
On the first run MHDD creates a new ./cfg/mhdd.cfg file. Primary IDE channel is disabled by default. If
you really want to enable it, please read this (look for warning message).
You will see drive selection menu. Please select any device you want. You can always call this menu by
pressing SHIFT+F3.
Now you can press F1 and use whatever commands you want. Please be extremely careful when running
MHDD first times.
Best commands to try first are EID, SCAN, STOP, CX and TOF. Some of them have shortcuts, for
example F4 for SCAN.
Please also take a look at the registers. Any IDE/SATA drive should report DRIVE READY and DRIVE
SEEK COMPLETE, so you will see DRDY and DRSC flags colored in blue. BUSY appears when drive
has something to execute (read or write command, for example). Some flags such as WRITE FAULT and
TRACK 0 NOT FOUND are obsolete, they never should appear. INDEX flag is obsolete too, but
sometimes it can blink. DATA REQUEST (DREQ) flag is on when drive wants to receive or to send some
data from/to the PC.
When you see ERROR flag (ERR) you can look at the error register where you can see what kind of error
happened. See ATA/ATAPI standard for more information about registers and commands.
Scanning a drive
Scanning of any device is possible only if it can be detected by ID/EID commands (or F2 key). To scan a
drive type SCAN and press ENTER or use F4 key. You will see menu where you can adjust some settings.
By default, start LBA is zero and end LBA is maximum possible value (last sector of the drive). All
Press F4 again to start the scan. MHDD scans drives by blocks. For IDE/SATA drives one block is 255
sectors (130560 bytes).
MHDD repeats steps 1—5 till the end sector. If you need the log of scan please check out log/mhdd.log
file — everything is there.
If your drive has errors, first thing to do is to make full back up. Then you have to run ERASE command
which erases every sector on your drive, and drive recalculates ECC fields of each sector. This helps to
get rid of «software bad blocks». If that do not help, you have to run SCAN with REMAP option switched
on.
If you see all blocks as errors, do not try to erase or remap sectors on your drive. You deal with
service-area error which cannot be fixed by standard MHDD commands. If you need your data — the
best option is to use a data recovery company.
The most important thing is the raw value of «Reallocated Sectors Count» attribute, which says how many
remaps are on the drive. Normally, you should always have zero there. If it is more than 50 — you have a
problem. That means you have bad power supply, vibration, overheating or just broken hard disk drive.
Take a look at the temperature. The best values are between 20 and 40 degrees centigrade, but some
drives do not report their temperature.
UDMA CRC error rate attribute means how many errors have happened during transferring data through
IDE/SATA cable. You should normally have zero there. If it is not zero, you have to change your cable
immediately. Also overclocking may result in increased error rate.
Other attributes usually are not so important. Please see ATA/ATAPI standard for more information about
SMART attributes.
Please see ATA/ATAPI standard for more information about HDD features and modes.
You can use ERASE command to do this. If your drive is recognized by BIOS, MHDD will try to use
BIOS functions to erase the drive. If you don't want MHDD to use BIOS to erase drives then use
/DISABLEBIOS command line switch.
Security commands
Use PWD command to lock a drive with defined user password. According to ATA/ATAPI standard, you
have to repower the drive to make password setting active.
There are two commands to unlock drives: UNLOCK and DISPWD. UNLOCK just unlocks a drive till the
next power cycle. To disable password you have to UNLOCK drive first, then use DISPWD command to
disable the password. You have to know the password to use unlock or disable password commands.
UNLOCK and DISPWD will ask you which kind of password you will enter: master or user. For example,
PWD command sets USER password.
Acoustic Management
Almost all modern drives support Acoustic Management. You can decrease noise produced by heads by
increasing seek time. Use AAM command to adjust the noise.
Device Configuration
You can view and change current drive configuration by using CONFIG command. It will allow you to
view or set the maximum UDMA mode, Security support, SMART support, LBA48 mode support, AAM
and HPA support etc. You can also cut or uncut the drive by using this command. Some manufacturers are
Batches
You can write a simple batch file (see an example in BATCH directory) where you can describe «what to
do». Press F5 to run a batch.