Problems restoring a Compact Flash

Go there if you encounter an unexpected error when using the softare. For installation problems, use another forum.

Moderator: feffer

Post Reply
Posts: 1
Joined: Mon Jun 16, 2008 8:40 am

Problems restoring a Compact Flash

Post by kemoka » Mon Jun 16, 2008 8:55 am


I use partimage to clone IDE drives without any problems, but I can't seem to get this working with Compact Flash drives.

With IDE disks, I start by backing up the MBR with dd:
dd if=/dev/hda of=/tmp/backup.hda.mbr bs=512 count=1

I then use sfdisk to save extended partition information:
sfdisk -d /dev/hda > /tmp/backup.hda.sf

Finally, using partimage, I save each partition to it's own file.

I can then succefully restore an IDE disk reversing this method, but when I try with CF's, the image gets corrupted somehow - when I try to boot the CF, all I get is a freezed "GRUB" message on top of the screen.

Can someone assist me tracking down what the problem might be?
I find it strange that the above method works well with IDE and not with CF.

Thank you!

Posts: 2
Joined: Mon Jun 07, 2010 3:28 am

Restore to compact flash not working

Post by rnmixon » Mon Jun 07, 2010 4:01 am

I have a similar problem, trying to restore a backup of a 4GB Patriot compact flash card. Like the original poster I've had not problem with this on IDE and SATA drives, but the compact flash (its in an IDE to CF adapter) does not work.

When I boot I just get a blinking cursor. Instead of the master boot restore, I tried using GParted to partition it like I would for a Linux install, then just restored the primary partition. Still just a blinking cursor.

I can install Linux, with advanced partitioning to the CF card just fine.

Any ideas are appreciated.

Thx - Richard

Posts: 126
Joined: Tue Mar 17, 2009 4:30 am

Post by feffer » Tue Jun 08, 2010 6:36 pm

I had better luck at this just using dd for the whole SD card (should be the same for CF). My SD card had debian installed for use in an ARM server device. There were 3 partitions on the card and, of course, a partition table. I wanted a cloned backup, in case my original card failed. This is off topic, since partimage is not used, but I think dd is a better solution. Following is my howto based on using the Linux shell. Windows users could install Cygwin to do similar.

1. Mount the SD card, and run fdisk -l which will give the partition list.
2. Let's assume the SD card gives something like, sda1, sda2, sda3
3. Then run dd using only "sda" as the source (no partition # after sda!)

Code: Select all

dd if=/dev/sda of=path-to-image-file
This creates an image of the entire SD card, including the partition table and all the partitions!

4. To restore or clone a new SD card (use an identical size, unformatted card), mount it and run "fdisk -l" to be sure of the "/dev/sda" Then do:

Code: Select all

dd if=path-to-image-file of=/dev/sda
5. The cloned card will be an exact image, partitions and all!

On older machines, or with slow card-readers this process may take a long time. For me, about 70 minutes to image and restore. What if you have constantly changing data on the SD? To avoid the long dd times, if you have them, use rsync. The main advantage of dd is that it partitions, formats and writes data all at once (it's a block device). In my case, after getting the cloned back-up card, it was easier to use rsync to keep it up to date.

1. Create a directory on your computer for the backup, say "SD_bak"
2. Create a sub-directory for each partition, say "sda1, sda2 and sda3"
3. Mount the SD card and backup each of its partitions, like:

Code: Select all

rsync -av /mountpoint-of-sda1/ ~/SD_bak/sda1
4. Do the same for each partition.
5. Update your back-up clone SD card from ~/SD_bak/sda1 etc.

In my case, usually only one partition changes, so this is a quick process.
Be careful about how you mount your SD card. Do it the same way every time. For example, if your computer has a built in reader, use that. If you have an external reader, plug it into the same usb slot on your computer each time. Do not use a hub between your computer and the card reader. I did this initially, and got corrupted results.

Hope this helps,

Posts: 2
Joined: Mon Jun 07, 2010 3:28 am

Problems restoring a Compact Flash

Post by rnmixon » Tue Jun 08, 2010 6:45 pm

Thanks feffer, that's a great idea. I will try it, though I'm concerned about the restore time. We wanted to use this to do low-volume duplication of the compact flash cards once we had a good image.

I had settled on partimage because it only copied the use blocks - it really saves a lot of time.

I'm still confused as to why things do not work correctly on restoring to a compact flash but work fine on a regular hard drive. The manufacturer says it should appear exactly as an IDE hard drive.

Someone else suggested clonezilla.

I'll try and report back.

- Richard

Post Reply