Hard Drive Backup

I work for a company that is presently using QNX 4.25 and I stumbled across a solution by blind luck. I found a 250MB industrial Flash Module sold by Logic Supply. Problem was that hard drive 20gig was setup for 1023 cyl, 14 heads and 17 sectors for 124Mb. Everyone was saying that I would have to use “dd” to copy the image but you couldn’t put it on a smaller drive. So I set the computer BIOS Primary slave and secondary master 1023 cyl, 14 heads and 17 sectors for 124Mb. I fdisk the drive and set the partition for 1023 cyl, 14 heads and 17 sectors made it the boot partition and loaded the loader. Rebooted the computer did a dinit -h to the drive powered down the computer. OK here’s the strange part . I place the hard drive I wanted to copy on secondary master and the flash module on primary slave. I had already 4.25 on the primary master. Booted up and did cp /dev/hd2 /devhd1 not expecting it to work. Powered down took the flash module out and plugged into the machine turn it on and it worked. Took it back out and fdisked it and to my surprise cp change the partitions on it to the exact way the partitions on the hard drive that I copied from. If this works I can copy the disk in our machines and put them on the shelf whick could be use when the hard drives crash. Flash Modules were only 40 bucks.

While the narative above is pretty clear, the points you are trying to make were not. Yes, you can clearly copy a 124Mb partition to a 250Mb Flash device. If you got the idea that there was a problem because the original drive was 20gig, that is not correct. It’s only if the partition is larger than the room provided. Even that constraint can be relaxed under certain circumstances. If you lost the data on the hard drive, and copied it back from the flash, would it work properly, of course.
However, can you boot directly from the flash device? That is not always the case. You might want to try it and see. The problem has to do with the assumption of the sectors/cylinders/heads in the partition table sector. Even if it exists, the problem can be overcome.

Does anybody else think that maybe QSSL should have a good knowledge base article on this? We seem to be answering this question about once a week.

My explanation for how to copy a 4.25 hard drive WITHOUT dd/Ghost/etc. can be found here on OpenQNX in Topic 8637. Direct link is

Here’s the salient points from that post to save everybody a click and to save everyone the trouble of messing around with BIOS and dd:

  1. Boot into 4.25
  2. I assume we’re copying / to a new drive, /dev/hd1
  3. “fdisk /dev/hd1” Create a new partition of any size, usually of type 77. Add the loader and make the partition bootable if you like.
  4. “mount -p /dev/hd1” to make the partition appear.
  5. “dinit -h /dev/hd1t77”
  6. “mount /dev/hd1t77 /hdnew”
  7. “cp -cpvLR -P!/.bitmap -P!/.inodes / /hdnew”

The key reason “cp” doesn’t work for people is the .bitmap and .inodes files. The -P! flag prevents them from being copied so the process will work fine.

My memory is failing, but you may or may not have to manually copy the .boot and .altboot files to the new drive.

-James Ingraham
Sage Automation, Inc.

My point was why FDISK the Flash module if cp copies all the partition on to the flash module.?

If you copy the device, you dont need Fdisk. This is how i always create new flashdisks.
The only possible problem is, if you are using different kind of Flashs. But it could work anyway, depending on the Flashs.
But the target disk must be at least as large as the source ;-)


Sorry; I didn’t mean to imply I didn’t appreciate your post. It’s quite interesting that that worked. However, I don’t really trust it, which is why I (a) reiterated my own solution to the drive copy problem, and (b) complained that QNX obviously hasn’t done a particularly good job of educating users about drive copy techniques.

-James Ingraham
Sage Automation, Inc.

So far the 3 Flash modules that I made are working. Now again remember that these were copying from 20 gig hard drive and put on a 256meg flash module.

“ingraham” no problem I’m just surprised that cp would put partitions in.