We have a number of vme computers that I need to set up. All of them will be using an 8GB compact flash drive as their hard disk. The details for how to set this up are all on this page. Now, I need to install linux on a bunch of compact flash drives and was looking for a way to clone one after I’d set it up how I wanted. Since I normally use a mac laptop, I also wanted to be able to use that. Here’s what I did.

First, install linux on one of the compact flash drives by pulling all the internal drives out of a computer and using the linux expert method. Once this is installed and all the other required software is installed, use dd to make an image on my mac.

sudo dd if=/dev/disk2 of=~/Desktop/crate.img

I know the input is /dev/disk2 because when I mount the compact flash drive, it would show as:

/dev/disk2s3    6.9G   1.6G   5.0G    24%    /Volumes/:
/dev/disk2s1    101M   9.1M    87M    10%    /Volumes/:boot

The s3 is the partition for / and s1 is the partition for /boot. (s2 would also be the swap partition.) Since I want to copy the entire disk and not each partition, I use /dev/disk2.

Using dd to copy the disk takes a long time, but it can be left unattended. You can check that it’s working by doing a listing of ~/Desktop/crate.img. The size will slowly be increasing.

Once the image has been created, prepare a new compact flash drive to use for the clone. The key here is that the partition on the drive must first be deleted. I used Disk Utility for this.

Here’s how the new compact flash card looked when I attached it to my laptop.

I needed to delete that KINGSTON partition to be able to copy my image back. Change the Volume Scheme to 1 Partition and then format it with Free Space.

The disk is now still connected to the laptop, but it has no partitions, so nothing is mounted. Now use the dd command again to copy the image to the new compact flash card.

sudo dd of=/dev/disk2 if=crate.img

Again, it takes a long time, but when it’s done, I can put the card in the vme crate and it boots successfully. I just need to ok any new hardware changes it finds and configure a new ip address for it.