With raspiBackup you can create regular backups of your Raspberry. In addition you can restore a backup to any SD card. A new partition table is created on the target SD card and the backup data is restored on the partitions. If an external root filesystem was saved with raspiBackup this filesystem will also be restored to an external device.



  • Simple restore of backups for windows, mac or linux users by using the Raspberry Pi
  • Messages in English and German
  • External rootfilesystem will be restored if the normal backup mode was used during backup and tar or rsync backup mode was used
  • Can be used to clone Raspberry Pis
  • Simple update to the latest version (-U parameter)



Invocationsyntax and -options

Restorescenario for Windows- or Macusers

Restorescenario for Linuxusers

Restore command examples



Every backup should be tested on a regular base to check whether a restore still works and still contains all required data. It's ugly if you detect at the time you want to restore the backup that the backup is corrupt or there is data missing. A restore test is quite simple: Just insert a new SD card, restore a backup and boot the restored backup.

If the restore fails for any reasons with raspiBackup the backup can also be restored with the standard Linux tools used to create the backups - dd, tar or rsync - but will not as convenient as a restore executed with raspiBackup.


Invocationsyntax and -options

raspiBackup has to be executes as root or with sudo.

raspiBackup.sh Option1 Option2 Option3 ... [backupdirectory or backupfile]

Option -R defines, whether a single SD card restore will be executed or an external root partition will also be restored to an external partition.

Parameter Function Default
-d SD card device. Example: e.g. /dev/sda. Starting with version the size of the root partition will be adjusted if the SD card is larger or smaller than the backup SD card. No

Defines the partition which will be used to restore the root partition. Example: /dev/sdb1

Attention: This partition will be formatted. Double check that this partition is the right one!

This option allows to restore backups taken on systems which use an external root file system on USB or disk.

Note: This option works only for tar and rsync backups and if the backup was created in the normal backup modus. If option -P was used no external root filesystem will be available.

-0 No partition layout will be created on SD card and the existing layout will be reused. See FAQ #6 for details. No



Restorescenario for Windows- and Macusers

For DD backups the Windows32DiskImager can be used to restore the backup. As an alternative every backup can be restored with Raspberry Pi. TAR or RSYNC backups have to be restored with Raspberry Pi. Following steps are required:

1) Start raspbian on Raspberry

2) Connect the SD cardreader with the SD card

3) Connect the device which holds the backup (e.g. a disk) and mount it or mount a network drive which holds the backup

4) If there is a root partition to restore connact another disk which will get the restored root partition.

Usually the SD card becomes /dev/sda, the backup partition becomes /dev/sdbx and the rootpartition becomes /dev/sdcx. If there is a network device used the root parition usually becomes /dev/sdbx

The actual device allocation may be different and should be checked all the time with

sudo parted -l 

to make sure there will be no other partition overwritten by error.


Restorescenario for Linuxusers

That's in general the same as for Windows- and Macusers. In contrast there is no Raspberry Pi required. Just connect the SD card reader on the Linux system together with the backup partition and an optional external root filesystempartition.

Examples for restore commands

Required hardware for restore:

1) Running Raspberry Pi running raspbian or another Linux operatingsystem or another LInux system with installed raspiBackup

2) Connected card reader with a new SD card

3) Connected device which keeps the backup (USB or net)

4) If an external rootpartition should be restored there has to be another USB disk or SD card connected


Restore boot and root partition to SD card

  1. Name of system to restore is raspberrypi
  2. SD card which will get the restored boot- and root partition is available in the sample command as sdf. The whole SD card will be repartitioned and all old data will be deleted.
  3. Backup to restore is available on /remote/raspifix/disks/backup/rsync/raspberrypi/aspberrypi-rsync-backup-20141230-213032/
  4. Here you will find instruction how to identify the parameters for -d.
sudo raspiBackup.sh -d /dev/sdf /remote/raspifix/disks/backup/rsync/raspberrypi/raspberrypi-rsync-backup-20141230-213032/


Restore the boot partition to SD card and the root partition to an external partition 

  1. Name of system to restore is raspberrypi
  2. A partition /dev/sda1 on /dev/sda was already created. It's not required to format the partition.
  3. SD card which will get the restored boot partition is available as sdf in the sample command. Note: All data on the SD card will be deleted.
  4. The root partition will be restored in the sample command to /dev/sda1. Note: All data on the partition will be deleted.
  5. Backup to restore is available on /remote/raspifix/disks/backup/rsync/raspberrypi/raspberrypi/-rsync-backup-20141230-213032/
  6. Here you will find instruction  how to identify the parameters for -d and -R
sudo raspiBackup.sh -d /dev/sdf -R /dev/sda1 /remote/raspifix/disks/backup/rsync/raspberrypi/raspberrypi-rsync-backup-20141230-213032/ 


How do identify the devicenames used by the external SD card and external disk?

Type following command on Raspberry:

fdisk -l | egrep "^Disk /|^/dev"

The output will look similar to

pi@raspberrypi:~# sudo fdisk -l | egrep "^Disk /|^/dev"
Disk /dev/mmcblk0: 8011 MB, 8011120640 bytes
/dev/mmcblk0p1            8192      122879       57344    c  W95 FAT32 (LBA)
/dev/mmcblk0p2          122880    15646719     7761920   83  Linux
Disk /dev/sda: 15.5 GB, 15548284928 bytes
Disk /dev/sdb: 300.1 GB, 300069052416 bytes
/dev/sdb1               1   586072367   293036183+  ee  GPT

You now can see the internal SD card /dev/mmcblk0 with 8GB, the new external SD card /dev/sda with 16GB and the external disk /dev/sdb with 300 GB which has one partition /dev/sdb1 for the external rootpartition.

Given this use -d /dev/sda (External SD card). If the backup also has an external root partition use in addition -R /dev/sdb1 (External rootpartition). Adapt these parameters to your local environment.

Add comment

Spam Kommentare sind sinnlos !
Vor der Publizierung wird jeder Beitrag auf Spam geprüft. Leider dauert es deswegen bis ein Kommentar sichtbar wird. Dafür erhält aber kein Subscriber Spam eMails.
Die eMail ist optional und nicht öffentlich sichtbar. Sie ist notwendig um eMail Benachrichtigungen zu Antworten auf Kommentare zu erhalten. Sie wird auch u.U. auch vom Seitenbetreiber genutzt um offline Kontakt aufzunehmen.

Spam comments are useless !
Any comment will be reviewed first and checked for spam. Unfortunately this delays the publishing of comments but will protect subscribers from spam.
eMail is optional and hidden and is required to get update notifications for any comments. In addition your eMail may be used by the website owner to get in contact with you offline.


0 #9 Raul 2016-09-04 18:21
Thank you for your support.
0 #8 framp 2016-09-04 10:01
Hi Raul,

you shouldn't get this error message :cry: . raspiBackup can create a detailed log which allows me to debug the issue. Please turn on the logging and add the additional parameters -l 1 -m 1 (lowercase L and M) when you start the restore and send the log to me. You find my eMail address on the contact page.

Cu framp
0 #7 Raul 2016-09-04 00:22
I'm trying to restore an Rsync backup following the procedure (boot/root partition to SD card) without luck. It doesn't matter if I try to restore it to the same sd card that I got the backup from or to a different one. In both cases I saw the same complain in raspiBackup.log when trying to create the partitions:

Device Boot Start End #sectors Id System
/dev/sdc1 2048 499711 497664 c W95 FAT32 (LBA)
start: (c,h,s) expected (1,0,1) found (16,0,1)
end: (c,h,s) expected (243,63,32) found (1023,3,32)
/dev/sdc2 501760 31115263 30613504 83 Linux
start: (c,h,s) expected (245,0,1) found (31,59,29)
end: (c,h,s) expected (1023,63,32) found (1023,254,63)
/dev/sdc3 0 - 0 0 Empty
/dev/sdc4 0 - 0 0 Empty
Warning: given size (30616576) exceeds max allowable size (30614528)

sfdisk: bad input
20160904-001705: MSG ??? RBK0015E: Error occured with rc=112
20160904-001705: MSG ??? RBK0077E: Restore failed: Create partition error (RC 112)

Do you have any tip/idea of why is this happening?.
0 #6 framp 2015-09-22 17:54
Moin René,

die Meldung ist eigentlich ziemlich eindeutig. Auf /media/raspibac kup kann nicht geschrieben werden. Hast Du einen Schreibschutz aktiv?

Was sagt denn
mount | grep media ?
sudo touch /media/backup/dummy.test

PS: Antwort bitte auf der deutschen Seite (oben links ist eine Deutschlandfahn e ;-) ) posten.

Cu framp
0 #5 René Hillebrand 2015-09-22 09:33
Hi framp,

wir haben hier ein Kali Linux mit dem Script gesichert - das klappt ausgezeichnet.
Restore schlägt allerdings nach kurzer Zeit mit
rsync: write failed on "/media/raspiBa ckup/usr/lib/lo cale/sat_IN/LC_ CTYPE": Read-only file system (30)
rsync error: error in file IO (code 11) at receiver.c(393) [receiver=3.1.1]
??? RBK0015E: Error occured with rc=11
??? RBK0077E: Restore failed in task 11 raspiBackup.log with RC . See logfile for details

Brauchst Du das Logfile dafür?


+1 #4 framp 2015-05-10 15:54
Glad you managed to restore the backup :-) A backup is useless if you cannot restore it.

I will improve the restore doc the next couple of days. There is still room for improvement :lol:
0 #3 Andreas 2015-05-10 15:42
I chickend out and installed Ubuntu on an old EeePC. Popped out the SD and USB from RPi. Put it in the Ubuntu machine and ran "sudo raspiBackup.sh -X -d /dev/sdb1 -r /home/andreas/t ouchedbyarobot/ touchedbyarobot -tar-backup-201 50507-130001.ta r -R /dev/sdc2" in terminal.

0 #2 framp 2015-05-10 12:06
Hi Andreas,

it depends on the environment you use. If you restore from some other Linux system (e.g. your Laptop) and assuming the SD card which should get the restore is on /dev/sdc and the external root file system is available as /dev/sda2 your it should be something like

sudo raspiBackup.sh -X -d /dev/sdc -r /home/andreas/n as/backup/robot /robot-tar-back up-20150507-130 001.tar -R /dev/sda2

If you have booted your raspberry with a fresh raspbian and connected the SD card which should get the boot filesystem as /dev/sda and the external root filesystem is connected as /dev/sdb1 then it should work with

sudo raspiBackup.sh -X -d /dev/sda -r /home/andreas/n as/backup/robot /robot-tar-back up-20150507-130 001.tar -R /dev/sdb1

If you do it this way

sudo raspiBackup.sh -X -d /dev/mmcblk0p1 -r /home/andreas/n as/backup/robot /robot-tar-back up-20150507-130 001.tar -R /dev/sda2

you will restore the boot partition on the current active SD card and use the external root filesystem on /dev/sda2.

I frankly didn't test whether it works to overwrite the current active boot partition. But I think it should work as long as you use an external root filesystem. So you either just give it a try and let me know whether it works - or you use a second SD card with raspbian, boot it up, connect the SD card to use for restore in a card reader and execute the command assuming the external root filesystem is available as /dev/sdb2

sudo raspiBackup.sh -X -d /dev/sda -r /home/andreas/n as/backup/robot /robot-tar-back up-20150507-130 001.tar -R /dev/sdb2

Cu framp
0 #1 Andreas 2015-05-10 11:25
Hi again!

I thought I would try the backup thingy :-)

So if BOOT is on /dev/mmcblk0p1 and ROOT is on /dev/sda2 and it is a TAR backup. It would be like this?

sudo raspiBackup.sh -X -d /dev/mmcblk0p1 -r /home/andreas/n as/backup/robot /robot-tar-back up-20150507-130 001.tar -R /dev/sda2

Or is it only the directory "/home/andreas/ nas/backup/robo t/" I should point to?