How to clone DOS drive? - Page 1
Forum section: electronics / general

author: jmelson
author_rank: Super Contributor
timestamp: March 25, 2022, 09:32:28 pm
content: 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

author: Twoflower
author_rank: Frequent Contributor
timestamp: March 25, 2022, 09:48:35 pm
content: 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.

author: themadhippy
author_rank: Super Contributor
timestamp: March 25, 2022, 10:06:05 pm
content: QuoteDid 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

author: jmelson
author_rank: Super Contributor
timestamp: March 25, 2022, 10:30:37 pm
content: Quote from: Twoflower on March 25, 2022, 09:48:35 pmThis 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

author: Whales
author_rank: Super Contributor
timestamp: March 25, 2022, 11:00:10 pm
content: 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).

author: granzeier
author_rank: Regular Contributor
timestamp: March 26, 2022, 01:36:56 am
content: 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.

author: james_s
author_rank: Super Contributor
timestamp: March 26, 2022, 02:22:50 am
content: 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.

author: jmelson
author_rank: Super Contributor
timestamp: March 26, 2022, 02:51:53 am
content: Quote from: james_s on March 26, 2022, 02:22:50 amRight, 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

author: jmelson
author_rank: Super Contributor
timestamp: March 26, 2022, 02:58:52 am
content: Quote from: Whales on March 25, 2022, 11:00:10 pmYes, the SATA drive is 500G, but I just have one 168Meg partition on it. So, why should the bootloader care?QuoteYes 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.QuoteI'll see if I can do that.QuoteYup, I am using one of those drives on a Win95 system on a pick and place machine.Quote

author: mariush
author_rank: Super Contributor
timestamp: March 26, 2022, 06:18:21 am
content: 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/393134503570You 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/3246685127779$ transcend 4GB :https://www.ebay.com/itm/19373888632123$ for the 16 GB version of HyperDisk40pinIDE :https://www.ebay.com/itm/333540449924SSD DOM 2G 4G 8GB 16GB 32GB 64GB Disk On Module Industrial IDE Flash 40 Pins MLC

author: james_s
author_rank: Super Contributor
timestamp: March 26, 2022, 06:31:10 am
content: Quote from: jmelson on March 26, 2022, 02:51:53 amDo 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.

author: PKTKS
author_rank: Super Contributor
timestamp: March 26, 2022, 08:34:19 am
content: I would replace DOS with modern FREEDOS.Did that for myself times ago to move deprecated stuffPositive things .. support for 32 bit and usb and all GNU tools out of the boxAll DPMI handlers and memory managers available..It should be a 500% improved replacementPaul

author: Whales
author_rank: Super Contributor
timestamp: March 26, 2022, 09:01:13 am
content: Quote from: jmelson on March 26, 2022, 02:58:52 amThose 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.

author: nightfire
author_rank: Frequent Contributor
timestamp: March 26, 2022, 09:46:03 am
content: 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.

author: DiTBho
author_rank: Super Contributor
timestamp: March 26, 2022, 09:56:21 am
content: Quote from: PKTKS on March 26, 2022, 08:34:19 amFrom my experience with Acord x86-guest card ... they are not 100% compatible.I tried- DrDOS v7- MsDOS v5- MsDOS v6.22- FreeDOS

author: PKTKS
author_rank: Super Contributor
timestamp: March 26, 2022, 11:05:56 am
content: Quote from: DiTBho on March 26, 2022, 09:56:21 amin 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 goodPaul

author: jmelson
author_rank: Super Contributor
timestamp: March 26, 2022, 06:11:08 pm
content: Quote from: mariush on March 26, 2022, 06:18:21 amYes, 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

author: jmelson
author_rank: Super Contributor
timestamp: March 26, 2022, 08:33:20 pm
content: 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

author: james_s
author_rank: Super Contributor
timestamp: March 26, 2022, 09:01:44 pm
content: 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.

author: jmelson
author_rank: Super Contributor
timestamp: March 26, 2022, 10:50:51 pm
content: Quote from: james_s on March 26, 2022, 09:01:44 pmThe 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

author: jmelson
author_rank: Super Contributor
timestamp: March 27, 2022, 05:05:06 pm
content: Quote from: jmelson on March 26, 2022, 10:50:51 pmUgh! 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

author: james_s
author_rank: Super Contributor
timestamp: March 27, 2022, 05:59:22 pm
content: 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.

author: nightfire
author_rank: Frequent Contributor
timestamp: March 27, 2022, 06:47:28 pm
content: 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.

author: Twoflower
author_rank: Frequent Contributor
timestamp: March 27, 2022, 06:57:00 pm
content: According to that page:https://tldp.org/HOWTO/Large-Disk-HOWTO-4.htmlthe 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.

author: phs
author_rank: Contributor
timestamp: March 27, 2022, 07:54:59 pm
content: 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!

author: geggi1
author_rank: Frequent Contributor
timestamp: March 27, 2022, 09:50:38 pm
content: The limitation in MSdos is not Dos, but the FAT16 disc system.Try a partition that is less than 2GB. Back in the flopppydisc times Dos came on 5 or 6 1,44 discs so you dont need a very large drive.MSdos can take up to about 9GB split in several partitions that is 2GB or less.Use a disc image tool and create a image. Use Rufus to extrect the image to your drive.

author: jmelson
author_rank: Super Contributor
timestamp: March 28, 2022, 01:03:26 am
content: Quote from: geggi1 on March 27, 2022, 09:50:38 pmThe only partition on the disk is 162 MB. I have been using Linux dd to copy the whole disk rather than the partition (sdd vs sdd1).Yes, it is FAT16.Thanks,Jon

author: jmelson
author_rank: Super Contributor
timestamp: March 28, 2022, 01:11:36 am
content: Quote from: PKTKS on March 26, 2022, 08:34:19 amI really don't have this option. I have an antique special device with a large ISA data acquisition card. We have a fully working, but very old, PATA hard drive from the original computer. It is an ~ 168 MB drive. We want to just clone this drive to a new drive, but every attempt I have made has resulted in "missing operating system". I have now tried this about 20 times, on a wide variety of drives, from 500 GB to 20 GB. For some reason, the boot code in the MBR just can't boot the copy, but it boots the original drive just fine.Reinstalling the programs for this special hardware might be VERY difficult, especially if the 20+ year old distribution floppies are no good. I have not seen a 3.5" floppy drive in quite a while and I wouldn't trust one with irreplaceable media, anyway.Thanks,Jon

author: bw2341
author_rank: Regular Contributor
timestamp: March 28, 2022, 02:40:37 am
content: It's been a long time since I used MS-DOS. If I remember correctly, LBA came out many years after MS-DOS. For compatibility, hard drives report a CHS geometry. If you switch the drive to bigger drive, the geometry won't be the same. The entries in the partition table will point to a particular C, H and S as the start of the partition. Since you did a straight LBA to LBA copy, the partition table is now pointing to the wrong LBA as the start of the partition.You are seeing the "missing operating system" message because the position of first track on the old hard drive will match on the new hard drive. However, as the old drive runs out of sectors and switches to the next head, the new drive still has more sectors. This is where the disk geometry address will get scrambled.I don't have a particular recommendation for your problem. My first guess would be to try a file level copy instead. I would boot from an MS-DOS installation disk andfdisk,formatandsysthe new drive on the new computer. After the computer is running properly, I would install the old hard drive into the new machine andxcopy /eorxcopy /sto copy the old drive to the new.If you are lucky and the software doesn't have copy protection, it should boot properly. Check theconfig.sysandautoexec.batfiles for drivers that could affect the hard disk. Even older MS-DOS systems needed crazy workarounds before larger and larger hard disks were supported.

author: jmelson
author_rank: Super Contributor
timestamp: March 28, 2022, 02:46:48 am
content: Quote from: bw2341 on March 28, 2022, 02:40:37 amI tried this first, but maybe I need to try this with a smaller destination drive. I'll keep plugging away at it.Thanks,Jon

author: bw2341
author_rank: Regular Contributor
timestamp: March 28, 2022, 03:00:39 am
content: If you've already tried a file level copy, how did it fail?

author: jmelson
author_rank: Super Contributor
timestamp: March 28, 2022, 03:19:11 pm
content: Quote from: bw2341 on March 28, 2022, 03:00:39 amI think I got the "missing operating system". But, that was some weeks ago, and I was doing it on a larger hard drive.Now I have found a good 20 GB hard drive, but it reports 65535 cylinders to the BIOS. Not sure if that will cause problems.I'm wondering if I can make this boot with LILO or GRUB, but I'll have to supply the right boot information. I'm guessing it is /DOS/MSDOS.SYSthat needs to be loaded to boot.Jon

author: Whales
author_rank: Super Contributor
timestamp: March 28, 2022, 11:12:14 pm
content: I've just been looking into alternative bootloaders, but I can't find anything relevant. Most (all?) do their DOS compatibility by chainloading directly to the MBR already on the disk (not much use here as that is likely what's failing). Freedos appears to have been designed to allow linux-style bootloader boots, ie it doesn't provide a useful alternative bootloader that you could try and shoehorn in here. GRUB can make a fake disk from a file via its ramdisk features, but even if that works it prevents you from ever saving your changes back to disk.What I really wanted to know is whether or not there is a way of overwriting the BIOS' CHS numbers, but it looks like an INT13h is used to query disk geometry from the BIOS, so you will have to patch that interrtupt handler (I'm way out of my depth here, but I presume this means modifying the BIOS. Or would it be "easy" to write your own handler and override the BIOS' one, then try chainloading the DOS MBR? Still sounds nasty and hard).The best solution seems to be trying to get more (smaller) disks with better behaved CHS numbers? The only solution I've tried successfully before was a CF card (+ a CF to IDE adaptor, which is just a passive connector as CF cards support IDE natively).Some relevant CHS info from around the web:GRUB manualQuotePhil Storrs PC Hardware BookQuote

author: Whales
author_rank: Super Contributor
timestamp: March 28, 2022, 11:21:15 pm
content: If we are not able to help here, then VOGONs might be a better forum to ask for help in:https://www.vogons.org/They might be able to recommend specific models of parts (SATA<->PATA adapters, SD card<->PATA, CF cards, specific modern disks, etc) that they know work.

author: jmelson
author_rank: Super Contributor
timestamp: March 29, 2022, 05:51:31 pm
content: Well, I finally bit the bullet and built a new DOS 7.1 system, and then loaded all the files that I think will be needed. With DOS, there is no registry, so just getting all the files in the right place should work. If not, then I can start copying more stuff.Thanks, everybody for trying to help!Jon

author: Twoflower
author_rank: Frequent Contributor
timestamp: March 29, 2022, 06:07:36 pm
content: Right, DOS doesn't has a registry, but you should check the config.sys and autoexec.bat as they might start some drivers you need. If you run into problems: The order of the commands might be important as well.Copy this files will probably not work out of the box over several mayor versions. Some manual adaption might needed. They are human readable. But that might look like a lost language. Like latin only few people might be able to read it, even fewer are able to write it. ;-)

author: james_s
author_rank: Super Contributor
timestamp: March 29, 2022, 08:33:56 pm
content: Copying the DOS boot files manually doesn't work, I don't remember the details but something has to be in just the right place. You can use sys c: if you have sys.com or you can format c:/s, both will copy the needed system files and make the drive bootable.

author: nightfire
author_rank: Frequent Contributor
timestamp: March 30, 2022, 10:19:12 am
content: Yes, the Floppy disk has to be bootable- so the simple way is with the "sys" command, but theoretically you could do it also with tools that modify the mbr like fdisk and then copy stuff like command.com, config.sys and autoexec.bat to the floppy.

author: jmelson
author_rank: Super Contributor
timestamp: April 01, 2022, 12:56:26 am
content: OK, problem solved! I built a DOS 7.1 system, copied all the files over, and then added in the specific lines from the old CONFIG.SYS and AUTOEXEC.BAT files, and the special app ran, but did not show the right graphics. So, I had to install ANSI.SYS and load it in CONFIG.SYS, then the whole thing worked!Thanks for all the help.Jon

author: m k
author_rank: Super Contributor
timestamp: April 03, 2022, 05:33:48 pm
content: Quote from: jmelson on March 27, 2022, 05:05:06 pmDo you know drive geometries?You can't use CHS geometry in LBA disk, access is not possible.Can you connect 2nd drive to that old machine?You can also connect only that new drive and check its geometry.Your problem seems to be that you're using Linux in between and it understands more than this old DOS.You need that original DOS doing the thing.There's nothing magic with DOS, FORMAT /S D: or SYS D: will do the trick.Then copying COMMAND.COM if it's missing and you have a functional system disk.After partitioning the disk first of course, and don't forget to activate the partition.http://facstaff.uwa.edu/bmoore/340/theBasics/Operations%20of%20FDISK%20The%20Basics%20of%20FDISK.htmPhysical locations of those hidden system files are fixed, no restrictions after that.But something else in your system can also have a fixed location.If so then you need to maintain the geometry and duplicate the disk.Some copy protections had that kind of easter eggs.

author: SL4P
author_rank: Super Contributor
timestamp: April 04, 2022, 12:07:57 am
content: Im jumping in here, having read only 20% of the thread, but what about some attempt with Ghost from the early 2000s?Playing with the target options, you might get lucky creating a bootable working version of the original image.If you can get it to load, you may then be able to update any drivers etc that have fallen by the wayside…

author: BeBuLamar
author_rank: Super Contributor
timestamp: June 23, 2022, 11:38:04 pm
content: I generally have to use a floppy disk to partition, set the partition as startup, format the drive with system files. The simply copy the rest over.