QNX4 Copy old CF to a new CF model


I’m using an old embedded system (2001) with PC/104 CPU card and QNX4.23 installed on a WD Compact Flash 128MB. For maintenance purpose, we have difficulties to supply the WD CF so I bought a new model of CF 128 MB and I’m trying to copy the content (OS + data) from the old CF to the new one.

To do the copy I use a QNX4 VM and I plug CF through an USB adapter. The old CF has 3 partitions : t77 with OS, t78 with System application, t79 with Logs, Records data. My steps are the following:

  1. Backup all the files from each partition of the old CF
  2. Connect the new CF and prepare it:
    2.1) fdisk /dev/usb0 (interactive mode), create 3 partitions, tag t77 partition as Bootable and add Loader
    2.2) enumerate partitions with mount -p /dev/usb0
    2.3) initialize each partition with dinit -h /dev/usb0t7x
  3. Mount each partition to folder:
    3.1) mount /dev/usb0t77 /mnt/part77
    3.2) mount /dev/usb0t78 /mnt/part78
    3.3) mount /dev/usb0t79 /mnt/part79
  4. Copy back all files (.boot included) to each partition (ex: cp -R backupPart77 /mnt/part77)
  5. Unmount everything and put the CF back to the embedded system

The problem is nothing is booting and I have the following message “Operating system not found”.
I know changing CF manufacturer could be a problem because cylinder geometry but I don’t think it’s the problem here. Any ideas ?

Thank you in advance,

This used to be a tricky problem with QNX 2. The drives were Head/Track/Sector and the drivers had to deal with this. Getting things to sync up at boot time was a black art, to which I am one of the last remaining wizards.

But by the time of QNX 4, this was an issue of the past. The drives were LBA (Logical Block Address) which basically means that sectors were numbered 0, 1, 2, 3, …, N. CF cards are EIDE cards which means that they are LBA capable.

I would have a look in the BIOS to see how it is set up. If it is set to something other than LBA, it likely is the problem. EIDE drives could simulate Head/Track/Sector but the geometries might differ.

Hi maschoen,

Oh ok thank you dear wizard :slight_smile:, I will be able to try it next Tuesday and get back to you.
In the meantime, I’ve noticed also when I try to create a QNX image from scratch, fdisk seems to write the wrong loader in the partition as it detects the CF as a Floppy drive… It’s written “QNX Floppy” in the Loader section:

I believe I can help you solve this problem, but I will have to take a look at my QNX 4 VM. I will write back in the next day or two.

So, it would appear that you have the wrong boot loader written to the first sector of the drive. There are a number of ways to remedy this. I personally would be inclined to just do a cp from the original to the new disk, but stop it after a few sectors, then run fdisk to make the partitions etc.

However the fdisk program has a command line interface that can deal with all this.


$ use fdisk

to see all the options.

Note the -B option which lets you choose a loader to write to the first sector.

First, I think you should capture some screen pictures so we can review this problem more clearly. May be you need “buildqnx” to rebuild a new bootimage.
Second, you should read some useful links:

Hi maschoen,

Thank you for your time, yes I’m quite sure it’s the main reason I can’t boot properly the OS.
I saw -B option but the problem is I don’t know where to find a loader file. Under /boot/sys/ there is a file named “boot” but I’m not sure what it is.
Concerning your proposition to do a cp from original to the new disk, I suppose it means that I need two USB adaptors right ? Which I don’t have. Or maybe I create a raw disk image of original disk with dd and then copy to the new disk with dd again juste like that ?

Hi sieudot,

Thank you for your links but I think I quite covered the steps to an OS image. I have a small experience to build an image but with QNX6 version.
See attached my build file:

I don’t think this is the root cause as discussed with maschoen, it seems to be the boot loader. In one link you shared they use dloader as we do in QNX6.X but it doesn’t exist in QNX4.

I was looking around for loader files too and did not find them. I imagine, but am not sure that a dump from the first 512 bytes of the disk would suffice, but I’m not sure at all.

If QNX 4 has dd that would be much better than cp. Yes, use dd to copy the first sector to a file and then back should work. After doing this, use fdisk to put the partitions on.

This is speculative but I would definitely give it a try.

So to understand correctly I can try the following :

  • Backup bootloader from original CF with : dd if=/dev/usb0 of=/tmp/bootloader.img bs=512 count=1
  • Copy back to the new CF with : dd if=/tmp/bootloader.img of=/dev/usb0 bs=512 count=1
  • Clear/Create partition table with:
    • fdisk /dev/usb0 delete -a
    • fdisk /dev/usb0 add -t77 -p100
    • fdisk /dev/usb0 boot -t77
  • Mount partition with : mount -p /dev/usb0
  • Initialize QNX filesystem with my boot image: dinit -hf /boot/images/mybootimage.1 /dev/usb0t77

Do you think dinit will overwrite the bootloader segment ?

dinit will not overwrite the bootloader segment if run with the correct parameters. You need to point it at the partion, not the root device, as in your example. I would not use the -f parameter, just copy the boot file in after dinit. It might be correct but I’ve never needed it nor used it before.

I think you should answer some questions below:

  • Is your CF formatted correctly ?
  • Is your boot partition bootable ?
  • Does your boot partition have a correct boot-image file (.boot)?

Another solution which I have done successfully before, you may use a raw disk copy tool to make a new ‘same’ CF. It may be quicker and more convenient than you did above. The only problem is the new CF must be larger than the old one, i.e. the new CF must have more sectors than the old CF.
You also can use a 256Mb new one.
Try some apps:

  • Norton Ghost 1.15
  • HDD raw copy
  • R-drive image

This is how we did it at a prior company I worked for so I know this method works.

Clonezilla which is free should also work.


Hi all,

I’ve tried what we discussed (dinit with and without the -f option) and unfortunately I still got “Operating system not found”. My original CF has the following configuration in fdisk :

However if I try to copy orignal CF image to a bigger CF (512MB or 1GB) I got “Missing operating system”…

  • Is your CF formatted correctly ? I don’t know. I connect the new CF to a Linux VM and I do a zero write all over the CF with dd if=/dev/zero of=/dev/sdb (CF)
  • Is your boot partition bootable ? I guess so, I marked the partition as “Boot”
  • Does your boot partition have a correct boot-image file (.boot)? I can’t say really but I think yes it’s ok. See previous message, I did a snapshot of the boot file configuration.

I tried what you said with HDD raw copy with a 512MB and 1GB. Unfortunately it’s not working for me :cry:

If you connect your original CF card to your Linux VM and run fdisk in Linux do you see the same info you showed in the QNX screen shot?

Assuming you do, if you connect your new CF card to your Linux VM (after doing the HDD Raw copy), what does fdisk show? It should show the same thing as your original CF card (it may have some extra block / 4th partition at the end since it’s a bigger CF but that shouldn’t matter).

One other thing. When you say the new CF that you did the HDD Raw Copy doesn’t work, do you mean it doesn’t work in a new machine? Or that it doesn’t work in the machine that the original CF is installed in? You should be testing on the machine your original CF is installed in.


This suggests that you are missing something significant. If you have two LBA drives, one larger than the other, you copy the smaller one sector by sector to the larger, the smaller one boots but the larger one doesn’t, you’ve defined the laws of the computer universe.

Something else must be going on.

I have done well with all these tools: R-Drive Image, Ghost, Acronis True Image, HDD raw copy. It worked well both for CF or cFAST.
You should try some ones, but remember, when you doing the raw copy, you need to select “sector by sector” option.
But I have a little doubt, is the main board itself having a card reading error? Is it still working fine with the old card?

Hi guys,

@Tim I have the following information with fdisk in Linux with original CF:

And after I did a HDD Raw copy with the new CF (1GB):

I mean it doesn’t work with the same machine where the original CF is installed. For information, I’m using a MSM800BEV PC/104 from Kontron (MSM800BEV User manual) with a deported CF card holder connected through X60 connector (IDE interface).

@maschoen Yes I’m missing something but I can’t point it out. I’ve looked into the BIOS but I don’t see “Access Mode” or something adjustable for LBA mode.

@sieudot I’ve only tried HDD raw copy for the moment as it’s free of use. HDD raw copy is already “sector by sector” copy tool no?
The main board is working fine, when I put back the original CF everything is booting correctly.

  1. A raw copy usually is a sector by sector copy.

  2. The BIOS might be set up with Head/Track/Sector numbers. This can work with an LBA drive. EIDE imbues LBA drives with H/T/S geometry. But that could be the problem. The two CF’s could have different defaults. That would exactly cause the problem you are seeing.

I’ve never seen an old bios where you could not set the geometry, although very old ones will not have LBA as an option.