Backup/Restore Setup
I decided to keep it simple and use the rsync
command which comes already installed on Raspberry Pi OS. The guide linked below does a good job of explaining rsync
in a step by step process.
Below the linked guide I’ll provide an example of the commands I use to Backup and Restore my raspberry Pi. This creates a copy of the /rootfs folders that make up your Raspberry Pi Operating System and User folders. The commands will exclude some folders that may cause issues when restoring a backup. The guide linked below has more details.
Since I am going to power down the Pi and physically connect it’s hard drive to my computer, I don’t have to worry about making backups on a live and running storage.
The below commands assume I also have an additional EXTERNAL_STORAGE hard drive connected to my computer. This means the backup command will copy the contents from the Raspberry Pi drive (/rootfs folder) to the EXTERNAL_STORAGE drive (/EXTERNAL_STORAGE/backup folder). The restore command will copy the contents from the EXTERNAL_STORAGE drive (/EXTERNAL_STORAGE/backup/rootfs folder) to the Raspberry Pi drive (/rootfs folder)
rsync
WILL delete data on the target location to sync all files and folders from the source location. Be mindful of which direction you are going to avoid any losses. I suggest testing it out on some other folders before commiting to backing up and restoring the entire Raspberry Pi. The guide linked below also covers exclusions to minimize backup sizes.
The backup storage MUST be formatted in EXT4 to make sure file permissions and attributes remain the same.
- nano ~/.bash_aliases
- Add comments & Save
alias rsyncBACKUP="sudo rsync -avxhP --delete --exclude={'proc/','sys/','dev/','tmp/','run/','mnt/','media/','home/USERNAME/.cache','lost+found'} /media/USERNAME/rootfs /media/USERNAME/EXTERNAL_STORAGE/backup/"
rsyncRESTORE="sudo rsync -avxhP --delete --exclude={'proc/','sys/','dev/','tmp/','run/','mnt/','media/','home/USERNAME/.cache','lost+found'} /media/USERNAME/EXTERNAL_STORAGE/backup/rootfs/ /media/USERNAME/rootfs"
- Add comments & Save
- Reset bash in terminal
. ~/.bashrc
- Backup system TO EXTERNAL_STORAGE
- !!EXT4 file system only!!
rsBACKUP
- Restore system FROM EXTERNAL_STORAGE
rsRESTORE
Firewall (LOCAL HOST)
- Install: Choose ONE
- Command line only
sudo apt install -y ufw
- Graphical Interface with command line access
sudo apt install -y gufw
- Command line only
I haven’t figured out how to properly set this up for myself yet, but I figure it’s probably worth having for an additional layer of protection.
…Continued from PieFed Instructions…
~/pyfedi/.env.docker
file. Look at~/pyfedi/env.sample
and add the other variables to~/pyfedi/.env.docker
according to your needs.nano ~/pyfedi/env.sample
nano ~/pyfedi/.env.docker
docker compose down && docker compose up -d
Updating PieFed Docker Container
docker compose down
git pull
docker compose up --build
docker compose down && docker compose up -d