I have a Raspberry Pi 2 running Raspbian Jessie. It is being used as a reverse proxy for my various self-hosted services, it is running openHAB, it is my mosquitto server, etc.
I would like to create incremental backups of the system just in case the SD card becomes unusable (or some other catastrophe happens).
I have another server running Ubuntu 16.04 with a large HDD that I would like to use to store the backup.
I am essentially following the idea of this answer by goldilocks
Here is my backup script, which is run from the Pi:
#!/bin/bash sudo rsync -aHv --progress --delete-during --rsync-path="sudo rsync" -e 'ssh -i /home/pi/.ssh/id_rsa' --exclude-from=/home/pi/live_backup_script/rsync-exclude.txt / htpc@htpc:/media/htpc/data/backups/rpij/live/ sudo rsync -aHv --progress --delete-during --rsync-path="sudo rsync" -e 'ssh -i /home/pi/.ssh/id_rsa' /boot/ htpc@htpc:/media/htpc/data/backups/rpij/BOOT_PART/
I then create a tar.gz file of the
BOOT_PART/ directories every day, and delete the old ones.
I have run
root on the Ubuntu system in order to maintain the correct ownership of the files. However, obviously all of the users on the Pi don't exist on the Ubuntu system, and therefore a file owned by a user such as
openhab becomes a different user like
pulse. Thus, my question is two-fold:
How can I restore such a backup to get a working Raspbian system? Said another way, will the ownership of the files be correct once copied and booted by the Pi?
rsyncpreserving ownership using the numeric UID and GID? If so, if there is a UID on the Pi that isn't tied to a user on the Ubuntu system, will this cause problems?