Created
June 7, 2023 21:03
-
-
Save bootrino/bc4a4b8bfe82180391904046c2c9e344 to your computer and use it in GitHub Desktop.
backup a linux machine with xz compression using all CPU cores
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# compression level 9, use all cores | |
XZ_OPT='-T$(nproc) -9' | |
# J means xz compression, z means gz | |
NUM_THREADS=$(nproc) | |
sudo env "XZ_OPT=-T${NUM_THREADS} -7" tar -cvpJf /tmp/backup.tar.xz \ | |
--exclude=/tmp/backup.tar.xz \ | |
--exclude=/var/swap.1 \ | |
--exclude=/proc \ | |
--exclude=/mnt \ | |
--exclude=/dev \ | |
--exclude=/sys \ | |
--exclude=/run \ | |
--exclude=/media \ | |
--exclude=/boot \ | |
--exclude=/usr/src/linux-headers* \ | |
--exclude=/home/*/.gvfs \ | |
--exclude=/home/*/.cache \ | |
--exclude=/home/*/.local/share/Trash \ | |
/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment