Skip to content

Instantly share code, notes, and snippets.

@gbrayut gbrayut/backup.sh
Last active Apr 14, 2019

Embed
What would you like to do?
Quick Backup Scripts
cd /data/Backups/gbmint02/
sudo tar -zcvf "etc_$(date +"%F").tar.gz" /etc
sudo tar -zcvf "run_$(date +"%F").tar.gz" /run
sudo tar -zcvf "root_$(date +"%F").tar.gz" /root
sudo tar -zcvf "var_$(date +"%F").tar.gz" /var
sudo tar --exclude="$HOME/.cache" --exclude="$HOME/.config.old" --exclude="$HOME/Dropbox" --exclude="$HOME/code/go/pkg" -zcvf "${SUDO_USER}_$(date +"%F").tar.gz" $HOME
$ snap list
Name Version Rev Tracking Publisher Notes
aws-cli 1.16.129 143 stable aws✓ classic
bitwarden 1.14.0 17 stable bitwarden✓ -
core 16-2.38 6673 stable canonical✓ core
core18 18 782 stable canonical✓ base
gtk-common-themes 0.1-16-g2287c87 1198 stable canonical✓ -
notepad-plus-plus 7.6.4 195 stable mmtrt -
skype 8.34.0.78 66 stable skype✓ classic
wine-platform-i386 1.0 25 stable mmtrt -
#Backup apt sources https://askubuntu.com/a/99151/266909
mkdir /data/Backups/gbmint02/apt
cd /data/Backups/gbmint02/apt
dpkg --get-selections > Package.list
sudo cp -R /etc/apt/sources.list* .
sudo apt-key exportall > Repo.keys
#from http://www.fsarchiver.org/
#can be installed on mint live distro once you get Internet working
sudo -sE
apt-install fsarchiver
fsarchiver probe
#Note: if saving to fat32 have to add -s 1024 to split into 1GB sized files
#Or use -c - to prompt for a password
fsarchiver savefs /data/Backups/gbmint02/vfat.fsa /dev/sdd1
fsarchiver savefs /data/Backups/gbmint02/ext4.fsa /dev/sdd2
fsarchiver savefs /data/Backups/gbmint02/luks.fsa /dev/sdd3
#There are also savedir options for saving just folders
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.