7

I would like to backup the entire content of my Raspberry Pi SD Card on linux PC. I have found online many tutorials that suggest to use dd to perform the operation. However my SD Cards have a wide free space that doesn't require to be saved on backup, that is why I am searching for an efficient alternative to dd that would not backup free space.

Do you have any idea of such alternative software that could do this ?

Thank you in advance.

Edit : When I say I want to perform a backup, I mean I want to make a copy of the entire OS installed in the SD Card plus personnal data installed on. When I restore the backup on another SD Card, I should get a clone of the initial SD Card. Furthermore, the backup should be done with the Raspberry shutdown and the SD Card plugged in my PC.

Pierre HUBERT
  • 201
  • 2
  • 8

4 Answers4

6

There are at least two options to create bootable mSD clones, depending on whether you prefer a UI or the terminal:

  1. pi clone which gets installed alongside with the Pixel desktop.
  2. the rpi-clone script from https://github.com/billw2/rpi-clone, which does roughly the same job, but without any UI. Clone the GitHub repository, and chmod u+x rpic-clone/rpi-clone. Then ...
    • run sudo rpi-clone/rpi-clone -f sda the first time; this creates the necessary partitions and does a full rsync to ensure that you get a workable booting copy.
    • subsequent delta updates: sudo rpi-clone/rpi-clone sda.

Replace sda with your particular SD card reader/writer.

I'm solely using the rpi-clone script for many months now and I never had any issues. The only caveat: don't do a delta update to an mSD with an existing, different OS setup. Just use the -f option to ensure that you get a working clone in this case.

TheDiveO
  • 1,591
  • 1
  • 11
  • 16
3

I was not satisfied with any of the previous answer, but I have now found a way that gives me entire satisfaction, using Clonezilla :

On another computer running Linux (in my case Ubuntu 18.04),

  1. I installed clonezilla : sudo apt install -y clonezilla
  2. I created the /home/partimag to store my backups (sudo mkdir /home/partimag )

When I want to backup the entire system of my Raspberry Pi, I shut it down, I unplug the SD card from the Raspberry Pi and I plug the SD card into my PC. Then,

  1. I run Clonezilla as root: sudo clonezilla
  2. I decide to work as device-image
  3. And then I skip the step Mount Clonezilla image directory
  4. I complete all the others steps to make the backup.

This produces a compressed backup of the full content of the SD Card (OS + programs + documents + ...)

Pierre HUBERT
  • 201
  • 2
  • 8
0

Since I'm not sure if it's what you're looking for, I was hoping to make this a comment instead of an answer but don't have enough (points?), anyways I've been taking the sd card out of pi putting it in a usb card reader/writer, then using win32diskimager to create an image from it.

ben
  • 101
  • 1
  • 1
0

raspiBackup is able to save only the used space even if you use a dd backup. Just read FAQ #16

framp
  • 896
  • 7
  • 17