I recently created a "disk image" of an OpenBSD installation
with this process:

         o On development (dev.) PC...

                    # nc -n -l -p 9000|dd of=/usr/src/ata.fs

         o Then on production (prod.) PC...

         # dd if=/dev/rwd0c bs=512 count=125440|nc -n <ip-dev-sys> 9000

(wd0 is a 64MB ATA flash card.  disklabel indicated a total of 125440
sectors.)  On the dev. PC, I then mapped it to a vnode pseudo device:

                      # vnconfig -c svnd0 /usr/src/ata.fs

I next used fdisk to fix the MBR (reinit, then update), and then I
mounted the disk image into the dev. PC's file system:

                          # mount /dev/svnd0a /mnt/ata

So far, so good.  At this point, I theoretically have /usr/src/ata.fs on
the dev. PC as an archive from which I can base additional copies.

        On the prod. PC, I have a 4GB CompactFlash (CF) card to which I
want to copy the contents of the original ATA flash card.  Ultimately, I
want to replace the ATA card with the CF card.  I started by clearing the
CF card:

              # dd if=/dev/zero of=/dev/rwd1c bs=512x1008 count=7964

(disklabel indicated 1008 sectors/cylinder, and a total of 7964 cylinders,
for a total of 8027712 sectors.)  Next, I needed to initialize the MBR on
the CF card and create a disklabel:

    # fdisk -i wd1
    # disklabel -E wd1
      [...create an a-partition encompassing the disk less the first
      "sector"...]

I created a file system on the CF card:

    # newfs -U /dev/wd1a

...And mounted it into the dev. PC's file system:

    # mount /dev/wd1a /mnt/cf

Now on the dev. PC, I have the contents of the original ATA flash card
mounted as /mnt/ata and the CF card mounted as /mnt/cf.

        I needed to make the CF card bootable, so...

                         # cp -p /usr/mdec/boot /mnt/cf

..then...

          # /usr/mdec/installboot /mnt/cf/boot /usr/mdec/biosboot wd1

And now I just need to copy the ATA flash card data to the CF card:

       # cd /mnt/ata && find . ! -path ./boot -print|cpio -padmuv /mnt/cf

(Does it make a difference if I just copy all the data from the ATA
flash card, including /boot, and then run installboot targeting the CF
card, or is it important that /boot always be copied to the target
storage first?)

        Now I just umount /mnt/ata and /mnt/cf, and reboot the dev. PC
to test.  Before the BIOS is done loading, I reconfigure to boot off of
the CF card.  This is where I run into trouble:

Using Drive: 0 Partition 3
reading boot..
Read error

The system just hangs at that point, and only a power cycle will recover
it.

        I'm like 99.999% certain this is the process I ended up with for
a completely functional CF card of the same make and model (SanDisk
Extreme IV), and it's actually been running in the prod. PC for a week
or so.  I've tried the same process with two other seemingly identical
CF cards, but the boot problem described is always the end result.
Ultimately, I want to be able to create a second copy of the functional
CF card as a backup, and also apply OS upgrades and such on the dev.
PC, only affecting the prod. PC with the amount of down time necessary
to swap the CF card.  Does anyone have any insights why I can't seem to
recreate a bootable CF card?

Thanks,
Mike
-- 
                                         | Manager for Networking, Admin.
         Michael T. Davis (Mike)         | & Research Computing: CBE/MSE
 http://www.ecr6.ohio-state.edu/~davism/ |   The Ohio State University
                                         |   197 Watts, (614) 292-6928
              ** E-mail is the best way to contact me **

Reply via email to