riahc3
Posts: 7
Joined: Sun Feb 22, 2015 9:09 am

Make backups of a live running Raspberry Pi?

Sat Aug 17, 2019 5:58 am

Is it possible to make live backups of a running Raspberry Pi?

RonR
Posts: 520
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Make backups of a live running Raspberry Pi?

Sat Aug 17, 2019 6:10 am

riahc3 wrote:
Sat Aug 17, 2019 5:58 am
Is it possible to make live backups of a running Raspberry Pi?
Yes. image-backup contained in Image File Utilities will create an image file of a running Raspbian system that can be written to an SD card or USB device. image-backup can also incrementally update image files. You can mount image files with image-mount and read or write them as if they were a device.

fruitoftheloom
Posts: 20769
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Make backups of a live running Raspberry Pi?

Sat Aug 17, 2019 8:11 am

riahc3 wrote:
Sat Aug 17, 2019 5:58 am
Is it possible to make live backups of a running Raspberry Pi?

Raspbian Buster with Desktop includes SD Card Copier which will clone to a SD Card in a USB SDXC Card Reader or USB Flash Drive.
Retired disgracefully.....

User avatar
B.Goode
Posts: 8604
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Make backups of a live running Raspberry Pi?

Sat Aug 17, 2019 8:19 am

riahc3 wrote:
Sat Aug 17, 2019 5:58 am
Is it possible to make live backups of a running Raspberry Pi?


As previous replies have accurately stated, Yes, it is possible.

But you have to be reconciled to the fact that the result might be inconsistent, because the Operating System might have changed the content of the filesystem while the backup was running.

For many purposes that won't be significant. You have to understand your own use of the system to know if it will be an issue.

Kendek
Posts: 107
Joined: Thu Jul 25, 2019 4:39 pm
Location: Kaposvár, Hungary

Re: Make backups of a live running Raspberry Pi?

Sat Aug 17, 2019 9:15 am

I usually using the systemback.sh script on Ubuntu/Debian to create restore points, but it's perfectly fine with Raspbian as well. This is just restore point, so you can restore the running system to the previous state (but you may need to edit cmdline.txt and fstab if you perform a restoration on a different system).

W. H. Heydt
Posts: 10907
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Make backups of a live running Raspberry Pi?

Sat Aug 17, 2019 4:56 pm

B.Goode wrote:
Sat Aug 17, 2019 8:19 am
riahc3 wrote:
Sat Aug 17, 2019 5:58 am
Is it possible to make live backups of a running Raspberry Pi?


As previous replies have accurately stated, Yes, it is possible.

But you have to be reconciled to the fact that the result might be inconsistent, because the Operating System might have changed the content of the filesystem while the backup was running.

For many purposes that won't be significant. You have to understand your own use of the system to know if it will be an issue.
You can be pretty safe if you start the copy process and nothing else, leaving the system alone until the copy completes. Still not 100% guaranteed, but likely to work just fine.

ejolson
Posts: 3587
Joined: Tue Mar 18, 2014 11:47 am

Re: Make backups of a live running Raspberry Pi?

Sat Aug 17, 2019 5:02 pm

riahc3 wrote:
Sat Aug 17, 2019 5:58 am
Is it possible to make live backups of a running Raspberry Pi?
Here is another approach which can be used to make online incremental backups of a running Pi.

User avatar
clicky
Posts: 396
Joined: Thu Oct 25, 2012 7:34 am

Re: Make backups of a live running Raspberry Pi?

Sun Aug 18, 2019 10:41 am

Wouldn't just simple rsync do the job?

Code: Select all

sudo rsync -axv / /mounted-backup-drive
(of course with caveat about potentially inconsistent system...)

ejolson
Posts: 3587
Joined: Tue Mar 18, 2014 11:47 am

Re: Make backups of a live running Raspberry Pi?

Sun Aug 18, 2019 5:47 pm

clicky wrote:
Sun Aug 18, 2019 10:41 am
Wouldn't just simple rsync do the job?

Code: Select all

sudo rsync -axv / /mounted-backup-drive
(of course with caveat about potentially inconsistent system...)
The Debian systemback.sh script mentioned above is using rsync, except there are so many training wheels attached that it seems much more likely to fall over than a single rsync command.

The backup method I described above is also based on rsync but has the advantage of using a copy-on-write filesystem for the backup disk to implement incremental backups. Incremental backups are important because there is no way of knowing whether the new backup is a good one until it's finished. In fact months can pass after making a backup before it's understood that something needs to be restored from even earlier.

My experience has been that as long as one doesn't perform any deb package management during the rsync command, the resulting backup is consistent enough. As a result, you may want to disable all automatic updates before running the rsync command.

Return to “General discussion”