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:

  • /mnt/source/ is the source directory containing the filesystem to copy,
  • /mnt/destination/ is the destination directory where the filesystem should be copied

and the options resolve to:

  • -a means archive mode,
  • -x means to not cross filesystem boundaries,
  • -H means preserve hard links,
  • -A means preserve ACLs,
  • -W means to copy whole files without delta transfers,
  • -X means to preserve extend attributes,
  • -S mean to handle sparse files efficiently

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:

  • remote:a/* is a remote filesystem and path,
  • b/ is a local filesystem

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.


fuss/rsync.txt ยท Last modified: 2024/12/15 10:29 by office

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.