How to clone SD cards

I’m using FlightAware and FlightRadar24 with Raspberry Pi and before upgrade FlightAware I would like to create a clone of my SD card.
I have 2 cards with 8GB each but I think the image is larger than the second card’s capacity.

The SD card has 2 partitions, one with FAT12 and other with EXT4, and I did the image with this command:

sudo dd if=/dev/sdb of=/home/jorge/FR24.img status=progress

I install the image with this command:

sudo dd if=/home/jorge/FR24.img of=/dev/sdb status=progress

After complete the installation, the second partition cannot be mounted and whem I tryed to check the partition with gparted it gives this error:

“Can’t have a partition outside the disk!”

Do I need to add some options to dd?
Do you know other way to clone the SD card better than dd command?

Another question:
The first partition has 512MB and the second has 6.92GB but only uses 1.52GB
Do you know how can I shrink the image?

EDIT: with fdisk -l command I can confirm the SD original has 7,4GB and the second has 7,2GB

1 Like

can you shrink the second partition with gparted before making the dd .img file? alternatively, clonezilla will also clone disks, but i think you would run into the same issue if the first is 7,4 and the second is 7,2. i still think you would need to shrink sdb first.

1 Like

yes, I think it’s possible but I’m afraid to damaged the partition of the working SD card (it’s my wife’s card and it works 24/7 on RaspPi).
I didn’t know cards with same labeled sizes could have different real sizes
Maybe it’s better to buy another SD card…

1 Like

definitely better safe than sorry :slight_smile: technically you should be able to dd or clone that partition on to any spare hd or even usb partition and shrink it there, but getting a different sd card would probably be quicker.

1 Like

Just to add my two pennies worth I would tend to agree with @01101111 on this one about getting another SD card rather than risk trying to clone one. Perhaps others will know better, but it is what I do as I do with disks to be honest in case of failure. Doing a back up on external drive to transfer the data across onto it, for me it is just easier.

Sorry I can’t help further than that


Now i agree too
When I opened this topic I was hoping that you could tell me if the command I used was right because I was trying it without success.
Only after posted I realized both SD card had different sizes


You probably know this: the ‘dd’ command wants the output partitions to be identical in size to the input ones.

If the output SD card is of larger capacity than the input card the standard advice is to use ‘gparted’ to create partitions on the output card that are identical in size to the input ones, then run ‘dd’, then go back to ‘gparted’ and enlarge the output partitions to use the rest of the card’s capacity (if you want).

1 Like

yes, I know, my friend but try to think about this example:

  • When you buy 2 SD cards of 8 GB each, do you ever suspect the real size of these cards are different?
    I never did and it was my fault :persevere:
    For me it’s simple flash memory and I forgot the controllers, partition tables, memory allocation and Internal structure that could be different and this could implies more or less available memory

Conclusion: I’m real a noob!

1 Like

You’re right, the small variations in card capacity are something I never thought about. You uncovered something pretty subtle.