Skip to content

Instantly share code, notes, and snippets.

@sergixnet
Forked from JosefJezek/ubuntu-backup.md
Last active September 14, 2018 07:52
Show Gist options
  • Save sergixnet/89f475f6015464b70bc4445c0f5cbe4a to your computer and use it in GitHub Desktop.
Save sergixnet/89f475f6015464b70bc4445c0f5cbe4a to your computer and use it in GitHub Desktop.
Ubuntu Backup

Ubuntu Backup

Exclude Files

/dev/*
/lost+found
/media/*
/mnt/*
/proc/*
/run/*
/sys/*
/tmp/*
/var/cache/apt/archives/*

Backup of the system

$ sudo tar cvzpf /home/Backup.tgz --same-owner --exclude=/home/Backup.tgz --exclude=/home/error.log --exclude=/dev/* --exclude=/lost+found --exclude=/media/* --exclude=/mnt/* --exclude=/proc/* --exclude=/run/* --exclude=/sys/* --exclude=/tmp/* --exclude=/var/cache/apt/archives/* / 2>/home/error.log

Test the backup file

$ sudo tar tvzf /home/Backup.tgz

Restore the backup

$ sudo tar xvzf /home/Backup.tgz -C /
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment