How to backup system root with tar

Feb 11, 2014 00:00 · 102 words · 1 minute read Linux

Backup and recovery is essential. All my data are backed up weekly by cron, but what about my system root? It is easy. There are many backup types and methods (e.g., check Ubuntu help). I use a good old tool - tar.

So, how to make a backup of the root:

tar -cpJf /mnt/backups/backup.txz --one-file-system /

You can restore the root in an easy way too:

tar -xvpJf /mnt/backups/backup.txz -C / --numeric-owner

If you restore the root and want to have a bootable system, do not forget to restore GRUB (or another boot loader) and the missing folders (tmp, proc, sys) :)