August 08, 2024
Last updated
Last updated
I learned how to create a complete backup of my Raspberry Pi SD card. This will help me preserve all my data and settings before giving away the Raspberry Pi.
Reference:
DD Command: I discovered that using the dd
command is a powerful way to clone the SD card.
Example command: sudo dd if=/dev/sdX of=/path/to/backup.img bs=4M
Note: Replace /dev/sdX
with the actual device path of your SD card.
GUI Tools: I found GUI tools like Etcher
that simplify the backup process, making it easier for users who prefer not to use the command line.
Since, the image file contents all the partitions of the SD Card, we need calculate the offset for each partition and adjust accordingly. The offsets can be checked by sudo fdisk -l
command.
Example command: sudo mount -o loop,offset=70254592 /path/to/backup-rpi-image.img /mnt/rpi-img
Note: This command would mount the image file to /mnt/rpi-img
directory, so create it beforehand!
Reference:
Apparently, dd
command would read and write even empty space to the image file, so we can just compress the image file using gzip
command.
Example command: gzip --keep /path/to/backup-image.img
I realized the significance of backing up not just the Raspberry Pi but also any critical data regularly. It’s a good practice to have multiple backup strategies.
Today was productive! Understanding the backup process gives me peace of mind as I prepare to hand over my Raspberry Pi 4.
I also appreciated how accessible these resources are; the online tutorials made it easy to follow along.