Skip to content

Instantly share code, notes, and snippets.

@baojie
Last active December 15, 2015 00:49
Show Gist options
  • Save baojie/5175293 to your computer and use it in GitHub Desktop.
Save baojie/5175293 to your computer and use it in GitHub Desktop.
#!bin/sh
# USAGE:
# bash <(curl -s https://gist.github.com/baojie/5175293/raw/cba116a7b3dae98626f775d31aef2301ce5e5ee9/tarall.sh)
# files to be excluded
cat > /tmp/exclude.txt << EOL
/dev
/tmp
/proc
/run
/sys/devices
/var/cache
EOL
# compress the entire file system into /tmp/whole.tar.gz, exclude file patterns given in exclude.txt
sudo tar -zcvf /tmp/whole.tar.gz -X /tmp/exclude.txt /
#scp /tmp/whole.tar.gz somehost:/path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment