HOWTO: [rsync, backup, files, folders] How to use RSYNC command to backup entire OS

HOWTO: [rsync, backup, files, folders] How to use RSYNC command to backup entire os

Last weekend I've made a full OS backup 'cause I've been stuck with Lubuntu 15.10 and I couldn't upgrade anymore because reasons and I needed to upgrade to the latest version.

So I picked up my backup HDD and launched this simple command:

sudo rsync -avxHAWX --numeric-ids --info=progress2 /root-folder /destination-folder-\ beware\ of\ spaces > ~/rsync.out

In a few... hours I've successfully completed my backup.

Let's explain all the flags.

sudo: ... come on. It does means "I'm sweating" in Italian. Lol.

rsync: ...

-a: --archive
This is equivalent to -rlptgoD. It is a quick way of saying you want recursion and
want to preserve almost everything.

Note however that -a does not preserve hardlinks, because finding multiply-linked
files is expensive. You must separately specify -H.

-v: --verbose
This option increases the amount of information you are given during the transfer.
By default, rsync works silently.
A single -v will give you information about what files are being transferred
and a brief summary at the end.
Two -v flags will give you information on what files are being skipped and
slightly more information at the end.
More than two -v flags should only be used if you are debugging rsync.

-x: --one-file-system
This tells rsync not to cross filesystem boundaries when recursing.
This is useful for transferring the contents of only one filesystem.

-H: --hard-links
This tells rsync to recreate hard links on the remote system to be the same
as the local system. Without this option hard links are treated like regular files.

Note that rsync can only detect hard links if both parts of the link are
in the list of files being sent.

This option can be quite slow, so only use it if you need it.

-A: 
--acls, preserve ACLs (implies --perms)

-W: --whole-file
With this option the incremental rsync algorithm is not used and the whole
file is sent as-is instead. The transfer can be faster if this option is
used when the bandwidth between the source and target machines is higher
than the bandwidth to disk (especially when the "disk" is actually a networked file system).
This is the default when both the source and target are on the local machine.

-X: --xattrs preserve extended attributes

--numeric-ids: 

With this option rsync will transfer numeric group and user ids rather than
using user and group names and mapping them at both ends.

By default rsync will use the user name and group name to determine what
ownership to give files. The special uid 0 and the special group 0 are never
mapped via user/group names even if the --numeric-ids option is not specified.

If the source system is a daemon using chroot, or if a user or group name
does not exist on the destination system, then the numeric id from the
source system is used instead.

--info=progress2 : shows a global overall progress percentage 

/root-folder: the folder to copy (in my case, the entire OS)

/destination-folder-\ beware\ of\ spaces: beware also of strange non supported chars, IMHO

>: 
"write the stdout log to..."

~/rsync.out: "... this file". 

HIH

You may also like

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

due × 2 =