Disk geometry checking utility
Warning:
I do not test fresh code long before I do release the DISKUS code. So
it can be considered beta code and may contain bugs. This especially
is true for recent versions.
DISKUS is a system diagnostic tool. IMPROPER USE CERTAINLY WILL
DESTROY DATA! Diskus must overwrite complete partitions to do the
job, so this is no bug.
Testing this tool shall be safe as long as you never use -write.
That's what this option is for. If you try out -write, then be sure
never to use it on files, partitions or disks/devices which contain
valuable data. Also double check the device name. Better triple
check it before you add -write on the command line.
When you try it with option -write, be sure to only run it on drives
or partitions which do not contain any data which is important.
If you ever accidentally destroy data with DISKUS then you are
responsible for this yourself, you cannot blame anybody else for it,
as you have been warned.
Compile:
To compile just do:
make
To run it try something like:
diskus -help
diskus -dump /dev/sda
Examples:
Following command needs the write option and therefor does nothing:
./diskus -gen -bs 1M /dev/sdb
This checks the previous contents written to the drive using -gen:
./diskus -bs 1M -check /dev/sdb
This "freshens" (rewrites) sectors 100G to 105G on a drive (this
usually will have modern drives remap weak sectors). Note that this,
again, needs the -write option (which has been left out of the
commandline for safety purpose):
./diskus -freshen -bs 1M -start 100G -to -5G /dev/sdb
Notes:
Diskus is just for test purpose. Debian (apt-get install gddrescue)
and CygWin come with ddrescue, this is good in recovering data,
however it is a little bit difficult to use. For example under
Linux always use -d with ddrescue, else Linux buffering may invent
bogus data instead of errors while reading externally attached drives.
Under CygWin you can use Diskus as well, for example:
./diskus -read -jump -expand '\.\C:' > c-drive.log
Rationale:
Why I created DISKUS:
Some harddisks are failing. They do not just work or do not work.
They do completely unpredictable things. Things, you perhaps never
think harddisk will do. Here are the examples what I have observed
myself:
-
Read errors are not reported. Instead arbitrary random data is
transmitted to the computer. This may be bit errors or complete
garbled sector data. This bug may be permanent, that is, the sector
reliably tells wrong data, or it may be sporadic, that is, this
happens only sometimes or at different sectors. -
Sectors are written to the wrong place. This even can happen a
single sector within bigger write batches, so it's not a wrong sector
number transmitted by the computer. The bad thing on such a situation
is, that not only the sector is not there, it also destroys data
somewhere else on the same hard drive. -
Drives start to behave erratic but this problem vanishes after a
power cycle of the drive. I even could observe that drives start to
fill up their relocated sector list erroneously. After a power cycle
you cannot observe any error. -
Some drives suddenly die on a power cycle. Before they worked fine.
This usually means, that the drives BIOS became unreadable, such that
the drive cannot boot up. -
The drive's geometry is not supported by the underlying hardware.
For example, if you put in a 2 GB flash card into your card reader,
the uppermost bit is not supported and silently discarded, such that
you overwrite the first GB with the second GB. -
Drives start to become slow. Extremely slow. And some strange
bus reset messages start filling your syslog. However after rewriting
the sectors (-freshen option), all this problems suddenly vanish.
DISKUS can help a little bit in all these cases (sporadic problems are
very difficult to spot). However it is not a bit pattern nor a
harddrive stress testing tool. But without a tool like DISKUS it is
not easy to diagnose or repair problems like those noted above.
I wrote it, because I needed it. How much I needed it I realized when
I started to use it to test my hard drives before I start to rely upon
them. I have several dozen harddrives, mostly external USB drives,
connected to my computer, and when something unusal happens, I now can
take the drive offline and test it using DISKUS.
Note that you can observe similar problems on failing computer
hardware. So errors reported by DISKUS need not show that a hard
drive is defective. However you then will observe similar problems
with other drives on the same computer. So if in doubt, try to
reproduce the outcome of the test on another computer, too.
Bugs:
-
Writing to a drive might stop with an error. This is because I did
not find a reliable way to detect the drive size. For example, CD-ROM
drives report wrong sizes on certain CD-ROMs. -
On certain errors a re-seek would be needed, such that the -check
option can recover to the correct position. This is not yet fully
implemented. -
DISKUS cannot skip past some type of errors. This is by design and
will never be fixed. -
The screen output is suboptimal. Sometimes you will see garbled
lines on screen because the output was printed over some progress
meter text. In this case use IO redirection and an editor.
Contact:
To contact me you can use my pager at
http://hydra.geht.net/pager.php
Note that I am no harddrive repair center, I am just a programmer with
no idea about how to build or repair drives myself. So please use it
wisely. (Note that you have to solve a little riddle to contact me to
protect the pager against SPAM.)
-Tino webmaster@scylla-charybdis.com
http://www.scylla-charybdis.com/tool.php/diskus
Revision 1.4 2011-06-03 11:20:34 tino
Notes (CygWin) added
Revision 1.3 2009-02-16 05:07:05 tino
Documentation improved very little
Revision 1.2 2008-12-15 00:58:30 tino
Prominent note of freshen option