Author Topic: How to clone DOS drive?  (Read 4005 times)

0 Members and 1 Guest are viewing this topic.

Offline jmelson

  • Super Contributor
  • ***
  • Posts: 2465
  • Country: us
How to clone DOS drive?
« on: March 25, 2022, 09:32:28 pm »
I have an old system that runs DOS 6 that runs an X-ray fluorescence machine in a lab.  I am trying to replace the ancient computer with a modern one.
I have cloned the IDE hard drive onto a modern SATA drive, but I get "missing operating system".  I used dd on a Linux system to copy the whole drive contents, including the MBR, partition table and the main partition.  I can't figure out why I get the missing OS error.

I have seen desciption online that I should run fdisk /mbr from a Win95 CD, but I don't have a good one of those anymore.

Thanks in advance for any ideas.
Jon
 

Offline Twoflower

  • Frequent Contributor
  • **
  • Posts: 712
  • Country: de
Re: How to clone DOS drive?
« Reply #1 on: March 25, 2022, 09:48:35 pm »
Probably the modern computer can't handle the old OS. Especially if the computer has only UEFI with no legacy (old BIOS) support. I think that's the case for Intel Gen 10 Core-I CPUs. And I thing they even dropped some other legacy support since some longer time (e.g. the good old A20 Gate emulation).

One workaround would be to use a VM if the software can work in it.
 

Offline themadhippy

  • Super Contributor
  • ***
  • Posts: 1272
  • Country: gb
Re: How to clone DOS drive?
« Reply #2 on: March 25, 2022, 10:06:05 pm »
Quote
I used dd on a Linux system to copy the whole drive contents, including the MBR, partition table and the main partition.  I can't figure out why I get the missing OS error.
Did it copy the hidden files ,seem to recall you had to include the sys command if you wanted to make a bootable disc in the days of dos
 

Offline jmelson

  • Super Contributor
  • ***
  • Posts: 2465
  • Country: us
Re: How to clone DOS drive?
« Reply #3 on: March 25, 2022, 10:30:37 pm »
Probably the modern computer can't handle the old OS. Especially if the computer has only UEFI with no legacy (old BIOS) support. I think that's the case for Intel Gen 10 Core-I CPUs. And I thing they even dropped some other legacy support since some longer time (e.g. the good old A20 Gate emulation).
This is a Celeron CPU, and the manufacturer specifically states it has been tested on DOS, Win95 and Win98.
The message "missing operating system" comes FROM the boot code in the MBR, as one can find it when dumping the first block of the disk.
At least on an older motherboard, I get the SAME message from the SATA disk clone, but the original PATA drive boots up and runs DOS and the application perfectly.  So, the REAL problem here is the way I am cloning the disk.  Something about using dd to suck up the whole disk (not SDA1 but just sda, so it gets EVERYTHING on the original drive including the MBR and partition table) is leaving something not quite right in the clone.  I'm guessing there is some pointer to cyl/head/sector that ends up not pointing to the right disk block.
The fact I get "missing operating system" proves the MBR code is executing, but it is failing to find the OS file for the next phase of the boot.
Jon
 

Offline Whales

  • Super Contributor
  • ***
  • Posts: 1527
  • Country: au
    • Halestrom
Re: How to clone DOS drive?
« Reply #4 on: March 25, 2022, 11:00:10 pm »
dd'ing the whole disk is a good strategy, assuming you did the entire disk (dd if=/dev/sdx of=/dev/sdy) and not just a partition (dd if=/dev/sdx1 of=/dev/sdy1).  I recommend making a backup to a file (on a modern computer) too.

At a guess:

 * new disk is too big
 * new system has too much ram
 * new system is otherwise too foreign (shouldn't be an issue with IDE boot via BIOS?  edit: but the new disk is SATA, so perhaps check if the BIOS is configured to use IDE emulation or AHCI/RAID/something else for the SATA disks)

I imaged one of my win3.1 boxes a while back and ran into problem #2 whilst trying to virtualise.  Half of the files on the filesystem simply didn't exist, the system would only boot to dos and then complain.  Reducing the RAM magicly fixed this.

For a long time there were HDDs with jumper options to intentionally reduce their reported size.  I believe this was done to workaround software that couldn't handle the high disk size numbers.

It's difficult to get small SSDs/HDDs these days, but you can cheat and use a CF-to-IDE adaptor (CF cards natively implement IDE) or a SD-to-IDE/SATA adapter (probably cheaper and better in the long term, but I have not tried them on old systems/software yet).

Offline granzeier

  • Regular Contributor
  • *
  • Posts: 69
  • Country: us
Re: How to clone DOS drive?
« Reply #5 on: March 26, 2022, 01:36:56 am »
Could you just put a bootable image of MS-DOS 6 onto a thumb drive, boot off of that and then use FDISK and Format to make the new hard drive bootable. After this, you could just copy all the data onto the new system.
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 18312
  • Country: us
Re: How to clone DOS drive?
« Reply #6 on: March 26, 2022, 02:22:50 am »
This is really digging into the cobwebs in my brain but there is something you have to do to make the partition bootable, I think it was with fdisk. If you want to rule out incompatibility, boot DOS from a floppy or pretty sure you can get a DOS boot CD image and try installing it on a hard drive and see if that works. Format c:/s should format the hard drive and copy the system files.
 

Offline jmelson

  • Super Contributor
  • ***
  • Posts: 2465
  • Country: us
Re: How to clone DOS drive?
« Reply #7 on: March 26, 2022, 02:51:53 am »
This is really digging into the cobwebs in my brain but there is something you have to do to make the partition bootable, I think it was with fdisk. If you want to rule out incompatibility, boot DOS from a floppy or pretty sure you can get a DOS boot CD image and try installing it on a hard drive and see if that works. Format c:/s should format the hard drive and copy the system files.
Right, the partition has a * in the boot flag.  I don't have a floppy drive here that I trust to not destroy the media.  I HAD a Win95 CD but I lost my balance and crunched it!  I have looked for another, but so far no luck.
Jon
 

Offline jmelson

  • Super Contributor
  • ***
  • Posts: 2465
  • Country: us
Re: How to clone DOS drive?
« Reply #8 on: March 26, 2022, 02:58:52 am »
dd'ing the whole disk is a good strategy, assuming you did the entire disk (dd if=/dev/sdx of=/dev/sdy) and not just a partition (dd if=/dev/sdx1 of=/dev/sdy1).  I recommend making a backup to a file (on a modern computer) too.

At a guess:

 * new disk is too big
Yes, the SATA drive is 500G, but I just have one 168Meg partition on it.  So, why should the bootloader care?
Quote
* new system has too much ram
Yes it has a lot, but again, why should the bootloader care?
This mobo only has PATA connectors, so I am using a PATA-> SATA adaptor card.
Quote
* new system is otherwise too foreign (shouldn't be an issue with IDE boot via BIOS?  edit: but the new disk is SATA, so perhaps check if the BIOS is configured to use IDE emulation or AHCI/RAID/something else for the SATA disks)

I imaged one of my win3.1 boxes a while back and ran into problem #2 whilst trying to virtualise.  Half of the files on the filesystem simply didn't exist, the system would only boot to dos and then complain.  Reducing the RAM magicly fixed this.
  I'll see if I can do that.
Quote

For a long time there were HDDs with jumper options to intentionally reduce their reported size.  I believe this was done to workaround software that couldn't handle the high disk size numbers.

Yup, I am using one of those drives on a Win95 system on a pick and place machine.
Quote
It's difficult to get small SSDs/HDDs these days, but you can cheat and use a CF-to-IDE adaptor (CF cards natively implement IDE) or a SD-to-IDE/SATA adapter (probably cheaper and better in the long term, but I have not tried them on old systems/software yet).
 

Offline mariush

  • Super Contributor
  • ***
  • Posts: 4544
  • Country: ro
  • .
Re: How to clone DOS drive?
« Reply #9 on: March 26, 2022, 06:18:21 am »
Jeesh... can't get small capacity drives... you're kidding. You can get 4GB / 8 GB / 16 GB / 32 GB SSDs for cheap, they make them as boot drives or to store licenses/keys for switches and servers and you can get IDE<->SATA converters that work transparently quite easily.

example : 7$ for 8 GB HP sata SSD module: https://www.ebay.com/itm/393134503570

You can even buy small 4/8 GB 44pin IDE drives (44 pin is for laptops) and you can buy a 44pin to 40 pin IDE adapter if you don't want to have converters.
Example :

8$ 2 GB 44pin ide drives harvested from hp thin clients : https://www.ebay.com/itm/324668512777

9$ transcend 4GB : https://www.ebay.com/itm/193738886321

23$ for the 16 GB version of HyperDisk 40pin IDE : https://www.ebay.com/itm/333540449924
SSD DOM 2G 4G 8GB 16GB 32GB 64GB Disk On Module Industrial IDE Flash 40 Pins MLC
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 18312
  • Country: us
Re: How to clone DOS drive?
« Reply #10 on: March 26, 2022, 06:31:10 am »
Right, the partition has a * in the boot flag.  I don't have a floppy drive here that I trust to not destroy the media.  I HAD a Win95 CD but I lost my balance and crunched it!  I have looked for another, but so far no luck.
Jon

Do you have a CD burner? I can make you an ISO if there isn't one floating around already, I'd bet there is. There is also at least one free DOS clone IIRC.
 

Offline PKTKS

  • Super Contributor
  • ***
  • Posts: 1766
  • Country: br
Re: How to clone DOS drive?
« Reply #11 on: March 26, 2022, 08:34:19 am »
I would replace DOS with modern FREEDOS.

Did that for myself times ago to move deprecated stuff

Positive things ..  support for 32 bit and usb and all GNU tools out of the box

All  DPMI handlers and memory managers available.. 

It should be a 500% improved replacement

Paul
 

Offline Whales

  • Super Contributor
  • ***
  • Posts: 1527
  • Country: au
    • Halestrom
Re: How to clone DOS drive?
« Reply #12 on: March 26, 2022, 09:01:13 am »
dd'ing the whole disk is a good strategy, assuming you did the entire disk (dd if=/dev/sdx of=/dev/sdy) and not just a partition (dd if=/dev/sdx1 of=/dev/sdy1).  I recommend making a backup to a file (on a modern computer) too.

At a guess:

 * new disk is too big
Yes, the SATA drive is 500G, but I just have one 168Meg partition on it.  So, why should the bootloader care?
Quote
* new system has too much ram
Yes it has a lot, but again, why should the bootloader care?

Those things have been known to affect DOS itself, but I've not disassembled the bootloaders so I can't be sure if it affects those.

Eg bootloader queries the BIOS for C/H/S counts of the primary HDD, then does maths using real mode instructions (16 bit) and overflows.

Offline nightfire

  • Frequent Contributor
  • **
  • Posts: 340
  • Country: de
Re: How to clone DOS drive?
« Reply #13 on: March 26, 2022, 09:46:03 am »
The problem could in fact be the Adapter from PATA to SATA- does the mainboard recognize this as a bootable device?

Does this adapter works in a transparent way to the OS? I remember lots of issues in the old days with this stuff...

Another approach could be in the form of industrial spec disk on modules, "DOM" with PATA/IDE interface. Those are still around for decent money and also match the smaller sizes the BIOS of the computer might be better suited for.
Alternatively a simple mechanical adapter from IDE/PATA to compact flash.
 

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 2093
  • Country: gb
Re: How to clone DOS drive?
« Reply #14 on: March 26, 2022, 09:56:21 am »
I would replace DOS with modern FREEDOS

From my experience with Acord x86-guest card ... they are not 100% compatible.
I tried
- DrDOS v7
- MsDOS v5
- MsDOS v6.22
- FreeDOS
 

Offline PKTKS

  • Super Contributor
  • ***
  • Posts: 1766
  • Country: br
Re: How to clone DOS drive?
« Reply #15 on: March 26, 2022, 11:05:56 am »
I would replace DOS with modern FREEDOS

From my experience with Acord x86-guest card ... they are not 100% compatible.
I tried
- DrDOS v7
- MsDOS v5
- MsDOS v6.22
- FreeDOS


in my specific case...  the BIOS was kind enough to provide me that AHCI option  where  AHCI drives are presented as IDE devices...  not SATA...

Fussss  a decent MOBO with such AHCI option...
the drive will be presente in LBA as a regular IDE device...

chances are good

Paul
 

Offline jmelson

  • Super Contributor
  • ***
  • Posts: 2465
  • Country: us
Re: How to clone DOS drive?
« Reply #16 on: March 26, 2022, 06:11:08 pm »
Jeesh... can't get small capacity drives... you're kidding. You can get 4GB / 8 GB / 16 GB / 32 GB SSDs for cheap, they make them as boot drives or to store licenses/keys for switches and servers and you can get IDE<->SATA converters that work transparently quite easily.
Yes, I think this is the key!  The 500 GB drive is too big, over 1024 cylinders.  I saw this on another cloning project, the boot block won't boot from a big drive.
Once I selected the "CLIP" option on the drive that had this feature, it did boot.  I need to do this again for this project.
Jon

« Last Edit: March 26, 2022, 08:30:21 pm by jmelson »
 

Offline jmelson

  • Super Contributor
  • ***
  • Posts: 2465
  • Country: us
Re: How to clone DOS drive?
« Reply #17 on: March 26, 2022, 08:33:20 pm »
Well, I don't have another of those drives with the "CLIP" feature, so I tried a 4GB SATA DOM drive.  Surely that would work!  Well, it doesn't!  It shows in the BIOS as having 7000+ cylinders!  That's just crazy, and causes the same problem with the old MBR boot code.
So, I'm still trying to find a solution.
Jon
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 18312
  • Country: us
Re: How to clone DOS drive?
« Reply #18 on: March 26, 2022, 09:01:44 pm »
What happens if you make a partition smaller than 512MB? I vaguely remember having to use overlay programs on some older machines when larger hard drives became available. I have a 5GB drive in my IBM XT and it works fine, although I'm using a XT-IDE card with modern BIOS on it.
 

Offline jmelson

  • Super Contributor
  • ***
  • Posts: 2465
  • Country: us
Re: How to clone DOS drive?
« Reply #19 on: March 26, 2022, 10:50:51 pm »
What happens if you make a partition smaller than 512MB? I vaguely remember having to use overlay programs on some older machines when larger hard drives became available. I have a 5GB drive in my IBM XT and it works fine, although I'm using a XT-IDE card with modern BIOS on it.
The only partition on the disk is 162 MB.  But, I think the problem is the stupid PATA-SATA adaptor makes some crazy C/H/S settings.
Jon
 

Offline jmelson

  • Super Contributor
  • ***
  • Posts: 2465
  • Country: us
Re: How to clone DOS drive?
« Reply #20 on: March 27, 2022, 05:05:06 pm »
What happens if you make a partition smaller than 512MB? I vaguely remember having to use overlay programs on some older machines when larger hard drives became available. I have a 5GB drive in my IBM XT and it works fine, although I'm using a XT-IDE card with modern BIOS on it.
The only partition on the disk is 162 MB.  But, I think the problem is the stupid PATA-SATA adaptor makes some crazy C/H/S settings.
Jon
Ugh!  The drive that boots up win95 fine in my P&P machine shows up as 65525 cylinders on the new computer.  So,  maybe the diff is the MBR code on that one can handle it.
This is getting confusing!
Jon
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 18312
  • Country: us
Re: How to clone DOS drive?
« Reply #21 on: March 27, 2022, 05:59:22 pm »
Now I'm getting confused, this is a modern PC with a modern-ish hard drive, the problem is that it's not booting DOS6? I still think the first step needs to be formatting a drive as a bootable system drive and seeing if DOS6 will boot that machine.
 

Offline nightfire

  • Frequent Contributor
  • **
  • Posts: 340
  • Country: de
Re: How to clone DOS drive?
« Reply #22 on: March 27, 2022, 06:47:28 pm »
Sometimes a two-stage approach can help.
Transfer from the original system via dd the contents of the HDD to file (or over the network with a pipe to ssh/scp), and on the final target system you dd back the image via Linux live system.
 

Offline Twoflower

  • Frequent Contributor
  • **
  • Posts: 712
  • Country: de
Re: How to clone DOS drive?
« Reply #23 on: March 27, 2022, 06:57:00 pm »
According to that page: https://tldp.org/HOWTO/Large-Disk-HOWTO-4.html the MS-DOS boot limit 1024 cylinders are allowed (BIOS Int 13 - the 8.5 GB limit). You should check if you can setup in the BIOS the SATA port to CHS (probably currently in AUTO or LBA).

The already mentioned FreeDOS seems to support LBA drives. At least the FreeDOS Wiki says so.

Edit: I missed the posts that you're already aware of that. So nothing new. Sorry.
« Last Edit: March 27, 2022, 07:16:57 pm by Twoflower »
 

Offline phs

  • Contributor
  • Posts: 23
Re: How to clone DOS drive?
« Reply #24 on: March 27, 2022, 07:54:59 pm »
Yeah, sounds like it could have to do with the size of the drive, and Twoflower's suggestion to use the CHS setting in the BIOS seems to ring a dim bell with me.  That's probably well worth trying.

You likely already know all of this, but just in case it might help someone...  When I clone drives with dd I usually boot the machine containing the source and target drives from a USB stick containing a recent distro like Ubuntu, Debian, etc.  Then, once the machine is booted from the USB drive, examine the source/target drives using fdisk -l.  I then usually mount both drives (unless the target drive isn't formatted), and examine the files using ls, and other commands, just to make sure the files look OK.  Then, I check /var/log/kern.log and do a dmesg to check for any drive errors.

Then, before I launch the dd command, I do a dmesg -c to clear the kernel ring buffer.  Once the dd command is launched (and for cloning the entire drive, you're correct to use /dev/sd[a-z] designation for the source drive), you can issue dmesg commands to watch for any new errors the drive might throw during the dd operation.  Also, you can issue a kill -USR1 <pid_of_dd_command> while dd is running to get a progress status.

This all makes sure that you catch any possible errors indicating that the drive has issues.  And, once the dd command has completed, and dmesg doesn't show any drive errors, you could do a recursive diff of the two drives to verify that the copied files are identical to the source drive's files.

One other thing that might help, if you need to move the cloned drive data to a smaller drive, would be to dd the source drive to an image file and then use udisksctl to set up the image file as a /dev/loop0 device so that you can open it with gparted and resize partitions.  Once the image file is set up the way you want it with gparted you can then use truncate -s, if necessary, to shrink the image file, and then dd it back to another (smaller) target drive.  There are good examples of this procedure available via your favorite search engine, and I can verify this all works quite well, although it's been a while since I've had to do it...

Good luck!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf