How to Backup with rsync on Ubuntu



Nowadays, almost everyone uses his computer for productivity and personal data management; software, configuration files, documents, are all important to users’ everyday life; and exactly for this reason, it’s fundamental to prevent data loss, with periodic backups of filesystem. There are many tools, GUI and CLI-based, which are designed for this purpose.
In this article, it’s explained how to use rsync for a full system backup.

Backup all the filesystem

It’s needed just one command in shell, with root privileges, to perform a complete backup.
# rsync -aAXv --exclude={"path/to/excluded/directories"} / /path/to/destination
This command depends on brace expansion available in bash and zsh.
The -aAX arguments are needed for ensuring that symbolic links, devices, permissions and ownerships, modification times, ACLs and extended attributes are preserved.
With --exclude option users’ can specify folders that has not to be copied to destination; usually this string contains /dev, /sys, /run, /tmp, /proc. Could be necessary to add also /mnt or /media if they’ll not be used as backup destination folder, otherwise could start an infinite loop.

Restoring backup

Restoring backup is easy as making it. It’s the same command, but with with source and destination reversed.
Remember that a gold rule is to make three backup copies, and put them in different locations; computers permits an easy access and management of your informations, but it’s also easy lose everything, so, prudence is never enough.

raditeputut

Blogger dengan kerja sambilan Designer Freelancer.

No comments: