How to clone SD cards on Linux
Created - 08 Oct 2024
Insert the SD card into your PC, through a USB or a built-in card reader.
Open Terminal and enter the following command:
sudo fdisk -l
This will list all drivers on your system.
Search in this list for the drive name of the inserted SD card.
In our example it is: sdd.
CloningSDcards-5-linux
If you want to write the backup to a backup drive instead of the system drive, you have to first mount this drive.
In our example it is: sdb1.
CloningSDcards-6-linux
Create a mount point:
sudo mkdir /mnt/sdb1
Mount the backup drive (sdb1) to this point:
sudo mount -t auto /dev/sdb1 /mnt/sdb1
To write the image to your backup drive use the dd command. The current date will be attached to the file name:
sudo dd if=/dev/sdd of=/mnt/sdb1/emteriaBackup'date +%d%m%y'.img
CloningSDcards-7-linux
Insert the new SD card into your PC.
Before you restore the image, it is important to make sure that the SD card’s partitions are unmounted. To verify this, open the Terminal, and execute the following command:
sudo mount | grep sdd
Here sdd is the new SD card’s device name.
Use the dd command to write the image to your new SD card:
sudo dd if=/mnt/sdb1/emteriaBackup'date +%d%m%y'.img of=/dev/sdd