Skip to content

Customizing sysbkp.linux.sh

Thom edited this page Jul 1, 2021 · 3 revisions

How to customize my backup script for your system

script link

I have a system partition mounted on / and a boot partition (efi system) mounted under /boot. system is formated with something like EXT-4 or BTRFS. efi system is FAT-32.

In another disk, I have two partitions formatted with the same FS and same size, labels "Archbak" and "EFI-HARD" on my system. The script clones the linux to the backup partitions, including /boot.

  • change LHOME variable to be your home folder
  • change "Archbak" to your backup partition name inside strings
  • change "EFI-HARD" to your backup efi-partition name inside strings
  • change mount command "sudo mount /dev/disk/by-label/Archbak /mnt" replace Archbak with the label your partition uses
  • change mount command "sudo mount /dev/disk/by-label/EFI-HARD" replace EFI-HARD with the label your partition uses

check if excludes make sense for your system (if the folder exist) these can be removed if you like. They exist to same space and avoid copying crap.

"--exclude="$LHOME/Desktop/*" this line excludes ~/Desktop from the system-wide rsync. Then a more specific rsync is used to copy the desktop, specifically ignoring node_modules of projects, because I keep my project in the desktop. If you have another project folder, you can add an --exclude for it (like desktop) and copy the rsync command for desktop changing the path (see below)

if ! sudo rsync \
# ... flags
# source           destination
"$LHOME/Desktop/" "/mnt$LHOME/Desktop"; then
echo "Rsync errored, continue anyway? (y/n)"
  • the last block assumes your efi-partition is mounted under /boot
Clone this wiki locally