
Code: Select all
#!/bin/sh
#stage4.scr
# Also note: https://wiki.archlinux.org/index.php/rsync#Full_system_backup
# (to check for diffs) tar -d -f /mnt/backup0/stage4/stage4.tar.zst -I zstd
# (to restore) tar xpf /mnt/backup0/stage4.tar.zst -I zstd --acls --xattrs-include='*.*' --numeric-owner
mount /mnt/backup0
cd /
date > /mnt/backup0/stage4date.txt
tar cpf /mnt/backup0/stage4.tar.zst -I "zstd -9 -T0" --acls --xattrs --numeric-owner --no-wildcards-match-slash -X /home/USERNAME/bin/exclude.stage4 /
date >> /mnt/backup0/stage4date.txt
cd
umount /mnt/backup0
Code: Select all
dev/*
home/USERNAME/*
home/lost+found
lost+found
media/*
mnt/*/*
proc/*
root/.cache/*
root/.thumbnails/*
root/.dbus/session-bus/*
run/*
sys/*
tmp/*
var/cache/distfiles/*
var/log/portage/*
var/tmp/*


Code: Select all
rsyncall='rsync -a --info=stats2'
curr_date=`date +%Y-%m-%d-%H:%M:%S`
back_root="/mnt/backup/gateway"
if [ ! -d $back_root/current ] ;
then
echo 'Current gateway backup directory not found'
else
echo "Using backup root $back_root"
root_bind="/mnt/root"
# Make sure we have our root filesystem bind-point set up
if [ ! -d $root_bind/bin ] ;
then
mount -o bind / $root_bind
fi
# Backup most of the filesystem and include /dev from the
# root bind to get all of the "default" device enties.
mkdir $back_root/$curr_date
$rsyncall --exclude-from=/root/gateway-backup-excludes --link-dest=$back_root/current / $back_root/$curr_date
$rsyncall --link-dest=$back_root/current/dev $root_bind/dev/ $back_root/$curr_date/dev
rm $back_root/current
ln -s $curr_date $back_root/current
fi
gateway-backup-excludes:
root/.ccache/*
root/.system/*
sys/*
proc/*
dev/*
mnt/*
run/*
home/*
boot/*
tmp/*
var/tmp/portage/*
usr/portage/*
var/cache/squid/*
var/lib/ntop
Which is what the Timeshift program does. Very respectable. Having it in your own script(s) gives you much more control.gentoo_ram wrote:I created a backup script that is based on the concepts from Apple's Time Machine implementation. ...
Code: Select all
init=/sbin/openrc-init
-systemd -logind -elogind seatdI am NaN! I am a man!
Well.. Jukeboxes do exist, so you could circumvent the size limitation by using multiple volumes per backup, but quite frankly I'd stick with hard drives. For many reasons, including ease of access, versatility, durability.... Throw some deduplication into the mix and it will be cheaper too. (You can't realistically do that with a jukebox).I discovered an external device
that is USB3 compatible so I use that for my laptop. So these are options, but I
wonder about using Bluray as well though I am only able to locate 25GB and 50GB
disks.
Code: Select all
# shellcheck /usr/local/sbin/makestage4
In /usr/local/sbin/makestage4 line 11:
cd
^-- SC2164: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.
Did you mean:
cd || exit
For more information:
https://www.shellcheck.net/wiki/SC2164 -- Use 'cd ... || exit' or 'cd ... |...
Are you sure you mean MY script? My script is completely linear and simple. Did you edit it to match your layout? Yes, in my script I meant cd where it includes cd. It uses cd twice. Just cd / to go to the system root to ensure consistent paths regardless of where it was started, and cd return before exiting. Feel free to leave out the 2nd cd. It's neither necessary nor fatal.Tony0945 wrote:figueroa, I ran shellcheck on your script
...
You might consider a rotation of three rather than two backup destination devices. Safety in redundancy.Spanik wrote: ...
And then from time to time I rsync the whole raid5 to a USB. There are 2 identical USB disks, one at home and one at the second home. When I go there I rsync and swap the drives. This includes all the other stuff as well.
...


definitly dirvishA.S. Pushkin wrote:I know this may have been posed previously, but what sort of system
backups, both software and hardware do Gentoo users use..
[..]
Thanks
Code: Select all
+----+----+----+
| |::::| |
| |::::| |
+----+----+----+ 
What do you mean exactly?I have an external device
that allows the use of an external hard drive over USB3.
you only mean duplicates?Suggestions on how to clean up /home prior commencing with a backup would be appreciated as well.