Backup your linux system to a compressed file

It’s well known how LINUX, compared to Windows, manages pretty well hardware migration. It involves 3rd party (usually paid) apps or some time editing registry settings and a bit of luck to get it right. However, on any *nix environment, all you have to do is create the new partitions on the target system, pack your files on the old (or just directly transfer them), deploy them on the new, edit /etc/fstab, and the bootloader reference to the disk you want to boot from and perhaps a

mkinitcpio -p linux

to regenerate the boot images and you’re done!

This is a little command I use to make a backup of my whole system from time to time in case something goes wrong:

tar cvpzf /home/backup-$(date +%Y-%m-%d_%H%M%S).tgz –exclude=/proc –exclude=/lost+found –exclude=/mnt –exclude=/var/cache/pacman –exclude=/sys –exclude=/home –exclude=/.snapshots /

The output would be a file under /home with the date on it, so you ca keep old versions easily and basically, I skip every volatile and external directory from the backup. Finally, I want to keep the btrfs snapshots out of the picture as well, hence the last –exclude option.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s