DISKBUG for MS-DOS is a program that uses the BIOS Interrupt 13h to interface with IDE hard drives and with floppy drives.
DISKBUG for Linux is a program that uses standard file I/O on IDE devices. (Browsers that are not told about .gz files may not transfer properly - here is an InfoZIP'd version: diskbugl.zip) Latest version fixes a few really stupid errors.
DISKBUG sources are currently only compatible with the 16-bit Microsoft and Watcom compilers, and with DJGPP for MS_DOS.
DISKBUG for Linux has only been (briefly) tested with Linux 2.0.36
as "root" and has sector writing disabled. I will be updating the Linux
version to handle drives > ULONG_MAX in capacity and to write sectors to
the disk (and update the read cache) RSNtm.
DISKBUG is not for the faint of heart -- it can fill an entire HDD with zeros -- it can write a file over several tracks -- it can do really bad things.
DISKBUG can save your ass -- use it to save and restore partition
and boot tracks -- use it to recover from idiot programs that can ruin
a drive -- use it to do really cool things.
TEST DISKBUG CAREFULLY BEFORE USING ITS SECTOR WRITING COMMANDS
I CAN NOT OFFER ANY WARRANTY or GUARANTEE FOR DISKBUG
DISKBUG sources are currently only compatible with the 16-bit
Microsoft and Watcom compilers, and with DJGPP for MS_DOS.
DISKBUG has only been (briefly) tested with Linux 2.0.36 as "root".
|bios <ax cx dx>||perform BIOS INT 13h call (MS-DOS only)|
|drive <n>||drive to use; 0 1st, 1 2nd, etc.|
|set <d,c,h,s>||set drive, cylinders, heads and sectors|
|size <n>||set sector size to `n' if not 512|
|read [file]||read sector; or read (secsiz bytes of) `file'|
|save <file> [n]||save sector (or `n' sectors) to `file'|
|write [enable]||write sector ("enable" to allow writes)|
|Write <n file>||write `file' over `n' sectors|
|disp||display drive geometry|
|seek <c,h,s>||seek to cylinder,head,sector|
|tell||tell current position|
|edit||edit sector data|
|zero||zero fill sector buffer|
|Zero <n> [b]||zero fill & write `n' sectors (fill byte `b')|
|part||display drive partition info|
|next||read & dump next sector|
|prev||read & dump previous sector|
|quit [n]||quit (return `n' to system)|
|help||display command summary|
|! [command]||exec shell or command|
|? [command]||command help|
Multiple commands may be separated by ';'.
DISKBUG is in read-only mode until you type "write enable".
Use the "bios" command very, very carefully.
The "drive" command can access FDDs as drives -2 and -1 (for A: and B:).
Commands are case sensitive. Commands which write raw sectors will always ask for confirmation.
All commands that write to the disk will always ask for confirmation.
Look for unused sectors on HDDs and experiment there first before editing
used sectors. (If you have a spare HDD then you can mess around all you
want.) Of course you can always mess around with floppies first.
CHECK THE SOURCE CODE
DISKBUG commands can be given on the command line; for example:
DISKBUG drive 0; save track.0 63; quitwill save track 0 of drive 0 to the file track.0 (assuming that there are 63 sectors per cylinder).
The "part" command will recursively display all partitions on the drive. Here is the output from the command
DISKBUG drive 0; part; quit >part.txton my system:
start end start number ofThere are two partitions; it's a Seagate 3.2GB with a 2GB primary partition and a 1GB extended partition.
entry type C H S C H S sector sectors
Cyl: 0, Head: 0, Sec: 1
0 06 * 0 1 1 519 127 63 63 4193217
1 05 520 0 1 779 127 63 4193280 2096640
2 00 0 0 0 0 0 0 0 0
3 00 0 0 0 0 0 0 0 0
Cyl: 520, Head: 0, Sec: 1
0 06 520 1 1 779 127 63 63 2096577
1 00 0 0 0 0 0 0 0 0
2 00 0 0 0 0 0 0 0 0
3 00 0 0 0 0 0 0 0 0
Note that the partition display may be non-sensical for non-FDISKed partitions.
For more information about partitions get allhiw.zip, all of Hale Landis' How It Works articles.
Do not confuse the BOOT RECORD with the BOOT SECTOR.
The BOOT RECORD is really the MASTER BOOT RECORD (MBR) of a HDD that resides on the first sector of the first track of a HDD, and is loaded by the BIOS during the boot process.
The BOOT SECTOR is on the first sector of the second track of a HDD, and is loaded by the BOOT RECORD code to boot the Operating System on the HDD.
A program like FDISK creates a BOOT RECORD. A program like FORMAT creates a BOOT SECTOR.
BE CAREFUL! Spend the time to really understand BOOT RECORDS and BOOT SECTORS before you run programs that modify these sectors.
I hope that DISKBUG will be of use to you and to others. I ask nothing in return for its "being", and that no others ask for anything for its "being" either.
Also, if DISKBUG is compiled to use a color prompt and is running in a Windows DOS-BOX, the text can sometimes get "stuck" in the prompt color. I do not know why.
See DISKBUG.TXT in the archive for a more up to date BUG LIST.