Well I guess the title is pretty self-explanatory but to put a little more words on, I want to use rsync to perform a weekly, incremental backup of my RPi4 which is hosting Pi-Hole, Unbound DNS and Wireguard VPN. The backup will be performed by the Raspberry Pi itself onto a USB stick.

While researching guides as well as ready-made scripts, I have seen several mention that you need to stop services that write to databases or ram while the backup process is running. However it wasn't clear to me if that applied to rsync or other methods like dd, etc.?

Thanks in advance.

  • The RPF/RPTL folks have given you a built-in SD card copier. It doesn't stop services when it copies your system to a bootable clone. Try that, it's an easy tool to use (as long as you have a USB SDCard reader to use to write the clone).
    – Dougie
    Aug 6 '20 at 18:49

The method of backing up is irrelevant; it applies to any (tar, rsync, scp, cpio etcetera) form of backup.

If you backup a database, and the database changes while you are backing up, you may get a copy that is inconsistent. Serious databases can often be recovered, if you backup the redo-log files last. Shutting down the database ensures that the database does not change during backup and is therefore sometimes preferred. You may also look for a tool that allows you to copy an open database (by, f.e. , making an export).

If a service runs in RAM only, the changes it makes are not written to "disk". So if you copy the disk, you will miss all the changes that have been made since the last write. Gracefully shutting down such services will probably result in an update on disk, and allows you to backup the modified data.

  • Thanks a lot... Aug 7 '20 at 5:48
  • @problemshavearisen Please accept the answer with a click on the tick on its left side. Only this will finish the question and it will not pop up again year for year.
    – Ingo
    Aug 14 '20 at 7:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.