Backing up your Raspberry Pi's SD card is an essential step to ensure that you do not lose your data in case of failure or corruption. One of the easiest ways to do this is by using the rpi-clone script, available on GitHub. This script allows you to create an exact copy of your SD card and save it to a USB drive.
Here is a step-by-step guide on how to create an SD card backup to a USB drive using rpi-clone:
Step 1: Install the rpi-clone script
The first step is to download and install the rpi-clone script from GitHub. You can do this by opening a terminal window on your Raspberry Pi and typing the following command:
sudo apt-get install git
git clone https://github.com/billw2/rpi-clone.git
This command installs Git and then clones the rpi-clone repository into your Raspberry Pi.
Step 2: Move to rpi-clone folder
Move to newly created folder where rpi-clone script is located:
cd rpi-clone
Step 3: Connect your USB drive
Next, you need to connect your USB drive to your Raspberry Pi. Make sure that the USB drive is formatted and has enough space to store the backup.
Step 4: Find the location of your USB drive
To find the location of your USB drive, type the following command in the terminal:
sudo blkid
This command displays a list of all connected storage devices and their file systems. Find your USB drive in the list and note down its device name (e.g., /dev/sda1).
Step 5: Run the rpi-clone script
Now that you have installed the rpi-clone script and found the location of your USB drive, you can run the script to create a backup of your SD card. To do this, type the following command in the terminal:
sudo rpi-clone sd_device usb_device
Replace "sd_device" with the device name of your SD card (e.g., /dev/mmcblk0) and "usb_device" with the device name of your USB drive (e.g., /dev/sda1).
Step 6: Wait for the backup to complete
The rpi-clone script will create an exact copy of your SD card and save it to your USB drive. The time it takes to complete the backup depends on the size of your SD card and the speed of your USB drive.
Step 7: Verify the backup
Once the backup is complete, you can verify it by disconnecting your SD card and booting your Raspberry Pi from the USB drive. If everything works as expected, then your backup was successful.
In conclusion, creating an SD card backup to a USB drive using the rpi-clone script is a straightforward process that can save you from losing your data in case of failure or corruption. Make sure to regularly backup your SD card to ensure that you always have a recent copy of your data.
Clear skies!
Add comment
Comments