Cloning booted RPi’s microSD card if RPi is physically accessable

ab cd

Senior Member
Plug into RPi, a USB card reader/writer, with backup microSD Card inserted into the card reader/writer.


Case (1):

If Image is Raspberry Pi OS with desktop (GUI), it has a tool in accessories named SD Card Copier which very conveniently copies the booted microSD card. You will need to connect a monitor+keyboard to the RPi to use SD Card Copier. Alternatively you can enable VNC Server on your RPi, and install RealVNC's VNC Viewer on your Desktop/Laptop to access RPi's GUI without need to connect a monitor and keyboard to RPi


Case (2):
If image is Raspberry Pi OS Lite or Piaware SD Card image or Flightradar24's PI24 image (all of which are without GUI), SSH to your RPi and issue commands given below.

Depending on size of microSD card, it may take 5 to 10 minutes to copy the booted microSD card (source microSD card) to destination microSD card. During this period you will see continuous flow of output from the process in your SSH terminal. Do NOT close the SSH terminal till the process is completed.

Code:
wget https://raw.githubusercontent.com/billw2/rpi-clone/master/rpi-clone
sudo bash rpi-clone sda -v

NOTE:
The destination microSD card's drive letter used in above command is sda.
To determine this letter on your RPi, follow the example below:

After inserting a blank microSD card in card reader/writer, and plugging it in USB port of RPi, determine the destination drive letter (in example below sda) by command lsblk.

Please note that in example below:
sda is drive letter for destination microSD card
mmcblk0 is drive letter for the source (booted) microSD card.

Code:
pi@raspberrypi:~ $ lsblk

NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    1   7.4G  0 disk
└─sda1        8:1    1   7.4G  0 part
mmcblk0     179:0    0   7.4G  0 disk
├─mmcblk0p1 179:1    0 159.1M  0 part /boot
└─mmcblk0p2 179:2    0   7.2G  0 part /


Please see this post:
https://www.raspberrypi.org/forums/viewtopic.php?t=180383#p1877328

For complete Guide:
https://github.com/billw2/rpi-clone

.
 
Last edited:
Back
Top