script for creating backups, preferrably complete system backups
| ubuntu | ||
| .gitignore | ||
| actions | ||
| PKGBUILD | ||
| rc.skel | ||
| README.md | ||
| rsbackup | ||
rsbackup
A script to simplify complete system backups
1 key features
- uses
tarto create backup archives - archive gets compressed with zstd
- on smt machines, uses all of your physical cpus for compression
- configurable via environment variables
- directories of your choice can be excluded from backup
- respects extended file attributes and acls
2 installation
2.1 prepare
Clone this repository:
git clone https://git.tuxomat.eu/automat/rsbackup.git
2.2 install
2.2.1 arch users
cd rsbackupmakepkg -sic
2.2.2 *buntu users
cd rsbackup/ubuntu./install_xbuntu.sh
2.2.3 users of other distros
cd rsbackupsudo install rsbackup /usr/local/bin- verify that
zstd,tarandzenityare installed
2.3 configure
rsbackup is configured via environment variables. The variables along with their default values can be seen in rc.skel. If a variable isn't set, rsbackp uses the default value.
Make shure the variables are set with your preferred values, e.g. via ~/.bashrc or ~/.bashrc.local
The variables and their meanings are (defaults in square brackets):
- MOUNTDIR: The base directory where your backup medium is mounted on [/media]
- MOUNTNAME: The name of the directory your backup medium is mounted on
$MOUNTDIR[backup]. The complete path to your backup medium is"$MOUNTIDR/$MOUNTNAME" - BASEDIR: The root directory where your backup will start
- BACKUPDIRS: A string containing space seperated directories that will be backuped.
Use relative paths, e.g.'. ./boot ./media/myprojects'
Note thatrsbackupwill not cross file system boundaries (option--one-file-systemtotar) - EXCLUDEFILE: Directories containing a file with this name will be backed up, but not their contents (only
$EXCLUDEFILEis saved)[.no_backup]. This way you can exclude cache directories and the like from your backups. - TAROPTS: You probably never change this. Ensures, that extended attributes and acls are saved, too [-S --acls --xattrs --exclude=./sys].
3 usage
For a complete system backup, just give rsbackup.
If an optional paramter is passed, that will be the name of a single directory to backup.
4 restoring
Let's say you have a new hard disk where you want to restore your backup to. If this disk is mounted at /mnt/mynewdrive, give
cd /mnt/mynewdrive
sudo tar xf --xattrs-include='*' --acls /path/to/backup.tar.zst