backing up a PI SD card..

Sep 17, 2023 Last reply: 2 years ago 24 Replies

This is totally off topic, but I'm curious: did you once post under the name "Mayayana"? If so, I'd like to thank you for the quote in my .sig below.

Er no. I don't believe I ever did. Ive been using this one a LONG time now as my 'I'm not at work presenting my company' one for a long time.

If you don't want to fiddle with that, there is partclone which makes copies of partitions, smartly enough so it doesn't copy unused sectors.

I use very similar options. I add -u and I add the --delete-after option. Oh and --numeric-ids . I've been bitten by backing up to a system where some of the system uids (<1000) were different and on backup got mangled. At least with numeric-only they go back as they were.

This is what I ended up using. I have to back up /boot every time as it gets deleted by the first backup

#!/bin/bash # Mounts the backup server, backs up the files in / excluding mounted stuff and other dross # then backs up the boot partition # and unmounts the backup server

mount 192.168.0.100:/backup2 /mnt cd /mnt/heating-controller

# And the main partition with the exclusions to prevent pseudo filing systems and temporary stuff being included when backing up live systems, some of it shouldn't be necessary # but turns out is needed

rsync -vaxHAX --stats --numeric-ids --delete --delete-excluded

--one-file-system --exclude=/tmp/* --exclude=/run/* --include=/var/lock

--exclude=/var/run --exclude=/var/swap --exclude=/var/cache/*

--exclude=/var/tmp/* --exclude=/var/lib/machines/*/var/cache/

--exclude=/var/lib/mlocate/* --exclude=/var/lib/nginx/fastcgi/*

--exclude=/var/log/journal/* --exclude=/var/log/Xorg.*

--exclude=/lost+found/* --exclude=*/.cache --exclude=*/__pycache__

--exclude=*/chromium/hyphen-data/ --exclude=*/.config/chromium/*Cache*/* / .

rsync -vax --stats --modify-window=2 --delete /boot/ ./boot cd umount /mnt

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required