0x79 - a blog

Work in progress.

Backup Linux with tar

A simple way to backup your entire linux machine is just to create a tar all files

tar -cvzpf backup.tar.gz --directory=/ --exclude=proc --exclude=sys --exclude=dev --exclude=run --exclude=tmp --exclude=boot .

We set the directory to create the archive from to / and include everything in the archive with the . at the end. Also exclude directories like /dev or /sys, which are machine or OS specific and don't contain any of our files.

Parameters:

  • -c create a new archive
  • -v verbosely list files processed
  • -z gzip files
  • -p preserve-permissions
  • --directory change to directory
  • --exclude file/directory