Cloning MFM HDD with mTCP

134 views
Skip to first unread message

Jakub Boehm

unread,
Feb 13, 2023, 11:51:32 AM2/13/23
to mTCP
Hello to all DOS networking enthusiasts!

I'm trying to clone old MFM ST-225 HDD that currently sits in turbo XT system, originally my plan was to put it some newer comuter with ISA slots and run Linux/BSD with ddrescue and clone it that way, but that didn't work out. I've successfully copied entire contents of it using ftpsrv which has worked wonderfully, but file timestamps were not preserved and there might be some interesting deleted data left behind.

So I've searched for better ways and found old post on vogons mentioning special version of mTCP's netcat that has support for HDD cloning, was this ever released publicly?
I think that would be really useful tool for everyone trying to preserve their old MFM drives which are not that easy to clone compared to IDE drives, and even better would be if such version of netcat also supported writing to HDDs over the network so that for example DOS system could be prepared in emulator and then copied to real system.

Thank you Mr. Brutman for all your great work.

Jakub

Michael Brutman

unread,
Feb 13, 2023, 1:28:52 PM2/13/23
to mTCP
I wrote and used the code once in 2014 to rescue a hard drive on a card for somebody.  It still compiles and probably works, but I'd want to do some testing first.

Here is how it works:
  • You need to provide the CHS (Cylinders, Heads and Sectors) of the hard drive - it does not try to auto detect them.
  • It reads one track at a time for performance reasons.  It will drop temporarily to one sector at a time to do retries on bad reads, similar to what m DskImage program does.
  • It's one way only - read a hard drive to save it elsewhere.  For now; adding write capability is easy.
I'm not ready to productionize the code or share it, but I would be willing to test it and get an EXE ready for you if you tell me the make and model of the hard drive.

(Hard drive BIOSes vary wildly, so it needs *much* more testing before I would want to share it.  Reading and writing sectors is fairly easy, but error reporting varies greatly.)


-Mike

Jakub Boehm

unread,
Feb 13, 2023, 1:54:08 PM2/13/23
to mTCP
I'll be glad to test it, the hard drive in question is Seagate ST-225 MFM drive, so: 615 cylinders, 4 heads, 17 sectors/track (https://stason.org/TULARC/pc/hard-drives-hdd/seagate/ST225-21MB-5-25-HH-MFM-ST412.html).
It is currently installed as a C drive and I have EtherLink III ISA card with packet driver at 0x60.

Jakub

Dne pondělí 13. února 2023 v 19:28:52 UTC+1 uživatel mbbr...@gmail.com napsal:

Michael Brutman

unread,
Feb 19, 2023, 12:45:38 AM2/19/23
to mTCP
Hi Jakub,

  • The options are similar to netcat - either set it up to listen on a port, or set it up to connect to something else.
  • As soon as a connection is made it is going to start reading the hard drive and sending it over the connection.  Use netcat on Linux (or mtcp!) and pipe the results directly to a file.  It's binary data.  The ending file size should be exactly 21411840 bytes if all of the sectors make it over. (615*4*512*17)
  • It automatically closes the socket when it is done.
  • It tries to read a full track at a time.  If it hits a read error it will drop to one sector at a time.
  • Bad sectors are retried 5 times.  After that, you just have a hole in the data.  If you see this, note the sector numbers and figure out how you want to handle it.  (Hint: on the  drive you can run disk utilities to figure out if that sector was even in use.  Norton Utilities can do this.)
  • The resulting image file on the target side can be converted into something that VirtualBox can read.  I would do that just to ensure the data looks reasonable.  If the resulting virtual hard drive can't be mounted then something went wrong.  You should also be able to loop back mount the file under Linux and examine it.  (Use mount -o loop, ro ... to use loopback in read only mode for forensics.)
Let me know if you have questions.  I know it's a little rough.

-Mike

Michael Brutman

unread,
Feb 19, 2023, 1:50:11 AM2/19/23
to mTCP
A small correction - you can't mount the resulting file directly from within Linux.  A partition can be mounted using the loopback option, but that's a hard drive image, not just a partition.  You'll need to figure out the starting CHS for the partition and remove all of the bytes before that, and then it will be mountable under Linux using the loopback option.


-Mike

Jakub Boehm

unread,
Feb 19, 2023, 4:47:51 PM2/19/23
to mTCP
Hello Mike,

thank you for the tool, it worked perfectly! I've tried it both as a listener and as a server and the resulting images were identical. Booting it directly with QEMU works and mounting it using kpartx works too.
My MFM drive (surprisingly) has 0 bad sectors so I wasn't able to test the retry feature. For completeness my setup was Linux with GNU netcat, 10MHz turbo XT, MS-DOS 3.3 and 3Com EtherLink III NIC.

Thank you once again and I hope you'll consider including version with adjustable drive geometry in the future releases of mTCP.

-Jakub

Dne neděle 19. února 2023 v 7:50:11 UTC+1 uživatel mbbr...@gmail.com napsal:

Michael Brutman

unread,
Feb 19, 2023, 6:33:18 PM2/19/23
to mTCP
I'm glad it worked.   Those old ST-225s are amazing.  They are crude devices, but if they are low level formatted once a decade they are fairly reliable.

Do you remember how long it took to read the 20MB and transfer it?

Releasing it is on the todo list, but I can't get enough testing on the code to ensure it is reliable, which is why I don't work on it.  I'd need to get a variety of drives, including some with errors, so that I could do proper testing.  Anything that involves data integrity needs that kind of testing - hard drives can be flaky enough, I don't want the tools contributing to problems.  (Making the parameters flexible is the easy part.)

Sadly, I can't rely on people to send me bug reports.  It is very rare when I get one, and all too often I'll see people complaining about something in a forum but they won't send an email.  It's irritating, but that's human nature.


Mike

Jakub Boehm

unread,
Feb 19, 2023, 8:05:12 PM2/19/23
to mTCP
I've ran it again and measured 462 seconds on the good drive (XT being server). I've also tried it on another drive with known bad sectors and it worked as well, I could hear it trying 5 times on each sector before giving up and seeking to the next one, see the attached picture. I have few more systems with ST-251s (I think) and Compaq Portable Plus with the original 10MB Rhodime drive, altough I'm not sure if it still spins up nowadays, so I could do some more testing if you'd like.

-Jakub


Dne pondělí 20. února 2023 v 0:33:18 UTC+1 uživatel mbbr...@gmail.com napsal:
image.jpg

Michael Brutman

unread,
Mar 5, 2023, 9:29:30 PM3/5/23
to mTCP
My apologies in advance ...

I found a serious bug and I'd like you to run it again.  I didn't shift bits correctly, so the data past the 512 cylinder is being corrupted.  I'm glad this is only the second time I ever used it, but now I feel bad because I'm sure the person I wrote it for 8 years ago doesn't even know their data is bad.  (I still have that drive so I'm going to contact them and get them a new image.)



-Mike

Reply all
Reply to author
Forward
0 new messages