Frequent asked questions about raspiBackup. Every new user of raspiBackup should read all questions and answers.
I run three Raspberries at home. Two of them run 7/24 all the time as LAN servers. It's common practice to backup a server on a regular base just in case there are any failures. In particular the SD card of the Raspberry tends to fail after some time. That's why I wrote a small script which created a dd backup. Then a tar backup was possible to create because the dd backup saves the whole SD card all the time even there is only a subset of the space used. Finally a rsync backup was introduced to use hardlinks and save backupspace. raspiBackup helped me multiple times to revover from a broken SD card so I thought the script may also be very helpful for other people running Raspberries and decided to publish raspiBackup.
The most reliable backup is a backup from a stopped system. Unfortunately this cannot be done on a regular base with cron automatically. If you stop all active services as mysql, samba, nfs, seafile, Owncloud, Webserver and all other active services before starting the backup in order to keep all the data consistent the backup can be used to restore the system. If these services are not stopped there is a high probability that the backup will become inconsistent. Parameter -a and -o help to achieve for this. See also FAQ 18. As an alternative a sample wrapper script can be used and extended .
raspiBackup can restore all created backups (See this page for details). raspiBackup runs on Linux only. Windows user can use windisk32imager to restore a dd backup. For all other backup types a Linux system is required.
Fortunately your Raspberry can be used to restore the backup with raspiBackup. Install a Linux OS (e.g. raspbian) on a second SD card, start it and install raspiBackup. Now connect an external SD card reader and the drive with the backup and use raspiBackup to restore the backup to the external SD card. Shutdown the system, insert the external SD card with the restored backup and start your Raspberry again.
raspiBackup can save two partitionens in the normal backup mode: The boot and the rootpartition of the SD card. If the rootpartition was moved to an external partition this external partition is also saved. An unlimited number of partitions on the SD card will be saved in the partition oriented mode. Additional external partitions will not be saved in this mode. This mode is usefull for NOOBs images.
You can use dd, tar and rsync to backup the data. dd and tar backups can be zipped also. See the following page for pros and cons of the different backup methods.
That was a requirement for raspiBackup: It should be possible to restore the backup with Linux means only.
raspiBackup creates readable files of the output of the Linux commands sfdisk, blkid and fdisk of the SD card. This allows to restore the partition layout of the original SD card with Linux means. Then the partition backups can be restored into these partition using the corresponding linux backup tools.
That works perfectly for larger SD cards. But the additional space will not be used. To use the additional space a Linux repartitioning tool has to be used when the backup was restored.
Starting with version 0.6.1.3 this works perfectly for smaller and larger SD cards if backup mode tar or rsync and the normal backup mode is used. The root partition size is either truncated if the SD card is smaller than the original SD card or expanded to use the whole SD card size if it's larger. But the used space on the backup SD card has to be smaller than the restore SD card size. Otherwise the restore will fail.
Option -0 (zero) allows to use the existing partitioning of the target SD card for restore. That way you have full control about the size the partitions should have on the restored SD card. So it's possible to restore partition oriented backups also on a smaller SD card.
There exist two options which give you full control of the way the new SD card is partitioned. Option -1 (one) forces raspiBackup to create the same partitioning on the target SD card even the partitions are smaller or larger than the size of the target SD card. Option -0 (zero) disables partitioning by raspBackup. This allows to create the partitioning and formating on the target SD card upfront and these paritions are used as is by raspiBackup during restore.
In general on every device which can be mounted on Linux:
- External USB Stick
- External USB disk
- cifs/samba networking disk
- nfs networking disk
- sshfs networking disk
- webdav networking disk
- ftpfs networking disk
Use one of the following approaches:
a) Use a wrapper script (see here) and write your own code which is executed before and after raspiBackup and saves additional data
b) Use extension points which are called before and after the backup function to save the data. There exist two sample extensions (see here) which report the CPU temperature before and after a backup run and the used memory. An eMailExtension can be used to plug in your own eMailClient.
mailx, sendEmail and ssmtp are supported. The eMailExtension plugpoint can be used to plugin every other eMailClient (Details see here).
Use the eMalExtension plugpoint to write a small extension which will be used to send the emails from raspiBackup. The existing extensionsamples include one sample code for the mailx eMailClient.
At the bottom of every webspage you can create comments. Just ask your question there. To eliminate spam the comments are checked manually and that's why it usually takes one day until the comment is published and will be answered. The eMailAdress which is optional, will not be published. It's required to get update notifications about new comments and may also be used to get in contact offline.
Every software can have bugs and raspiBackup is no exception. Please report the bug on https://github.com/framps/raspiBackup/issues
and provide detailed information about your environment. In particular a log from raspiBackup which will be created with additional options
-l debug -L current -m detailed
Registration on github is for free. If you don't want to create a github account or have any issues with gihub just create a comment on this website.
raspiBackup checks in every invocation whether there exist a new version. A message will be written and the notification eMail will have a smiley ;-) in it's mail title. Now you can check on this page what's new in the new version and update raspiBackup with parameter -U.
raspiBackup creates a backup copy every time an upgrade is done with parameter -U. Option -V can be used to revert to a previous version. A list of all saved raspiBackup versions will be presented and the version to restore can be selected.
dd backup backups the whole SD card Starting with version 0.6.1.3 there is a configuration parameter
DEFAULT_DD_BACKUP_SAVE_USED_PARTITIONS_ONLY which causes raspiBackup to save only the space used by defined partitions. So you just have to resize the 32GB partition to 8GB with gparted or other repartitiontools and the backup will only use 8GB. Current partiton sizes can be checked with lsblk command.
From time to time raspiBackup users report they cannot use rsync backup because raspiBackup complaints the backupspace doesn't support hardlinks. Hardlinks are used successfully by raspiBackup with rsync if a local attached USB stick or a local attached USB disk formatted with ext3/ext4 or a remote disk mounted via nfs is used. samba and sshfs don't support hardlinks.
Command du -sh * displays the used backup space and du -shl * displays how much space would be used if no hardlinks are used.
root@raspberrypi:/media/nas-backup/raspberrypi# du -sh *
root@raspberrypi:/media/nas-backup/raspberrypi# du -shl *
All services which keep any states in databases or in memory or on filesystemhave to be stopped. Otherwise inconsistent data will be saved and this will be detected when the backup is restored and the backup is unusable. raspiBackup offers option -o to stop services before starting the backup and option -a to start the services afterwards.
Following services have to be stopped with option -o in any case:
|nfs||service nfs-kernel-serv er stop|
|Samba||service samba stop|
|Pilight||service pilight stop|
|Cups||service cups stop|
|Minidlna||service minidlna stop|
|Apache||service apache2 stop|
|Wordpress||service wordpress stop|
|nginx||service nginx stop|
|seafile||service seafile stop|
|mysql||service mysql stop|
|cron||service cron stop|
To start the services again use option -a and use the reverse service sequence used with -o. If you are dead certain you don't need to stop and start services use ":" as parameter for option -a and -o.
In general every filesystem can be used which can be mounted on LInux. But there are following constraints:
- rsync backup reuqires supprot for hardlinks which is available with ext3/4. If an ext4 filesystem is exported via samba there is no support for hardlinks. NFS is an alternative.
- FAT32 can store files with max 4GB only. A dd backup will become as large as the SD card is (Configuration option DEFAULT_DD_BACKUP_SAVE_USED_PARTITIONS_ONLY can reduce the size) and is in genaral larger than 4GB. It's similar for tar backups which become larger than 4GB quite quickly. An alternative may be NTFS on windows.
General suggestion: Use ext3/4 if possible. On Linux use NFS for remote drives. On windows NTFS for exported samba network drives. Use FAT32 only if you are sure the backup files will not become larger than 4GB,
There are various raspiBackup users who successfully save their backups on Synology via nfs. Unfortunately I don't have a Synology and cannot help much on this. But there exists a dedicated page for Synology where one raspiBackup user told me what he configured on his Synology in order to save his backups successfully.
In about 98% situations this is true. But a firmware update can change the bootpartition. There is a configuration parameter DEFAULT_LINK_BOOTPARTITIONFILES which causes raspiBackup to link the bootpartition backups with hardlinks if they are supported. That way every backup is 60MB smaller. But the bootpartition is nevertheless saved all the time to check whether there are changes to the previous backup and then replaced with a hardlink. This option is useful only if you use a very small backup device.