Table of Contents

Copy Entire Filesystem

Command Line Aspect Visual Mnemonic Graft
-axHAWXS

One good way to copy an entire filesystem is to use rsync:

rsync -axHAWXS --numeric-ids --info=progress2 /mnt/source/* /mnt/destination/

where:

and the options resolve to:

Transfer Between Linux Filesystems

Command Line Aspect Visual Mnemonic Graft
-SaxHAX

Transferring between a remote system and a local system with the additional knowledge that the filesystems are both Linux systems, would imply a set of options (except -a, archive and -x do not cross filesystems) that would synchronize Linux-typical metadata such as ACLs or extended attributes (-H, -A, -X) as well as perhaps dealing nicely with sparse files -S.

This leads to the following command:

rsync -SaxHAX remote:a/* b/

where:

Direct Synchronization on Local Network

On a local network and provided that the files are not secret, rsync can be used directly with a remote rsync server in order to synchronize files. On Debian, in order to set up a server, copy /usr/share/doc/rsync/examples/rsyncd.conf to /etc/rsyncd.conf and edit the file to your needs.

After editing the rsyncd configuration file, enable the rsync daemon via SystemD:

systemctl enable rsync

Transferring files can now take place without SSH or RSH simply via the rsync transport. For instance, the command:

rsync --password-file=/etc/rsyncd.secrets -SaxHAX --inplace --del --info=progress2 rsync://data@storage/grimore/* /mnt/grimore/

will retrieve files located on the server named storage under the share name grimore and update the local folder /mnt/grimore.

Note that for authentication, the password file /etc/rsyncd.secrets on the client side, the one that issues the rsync command (not the server running rsyncd), should contain only the password of the username specified within the URL rsync:///data@storage/grimore/*, namely, in this case, the user data. On the server side the /etc/rsyncd.secrets, or whatever secrets file is configured via the options in /etc/rsyncd.conf, should contain both the username and the password separated by the colon.

This method could be used perhaps as a way to distribute public files on a local network, in order to skip the overhead required by using SSH as the transport.