To synchronize your home directory between two Manjaro systems using rsync, you can follow these steps:
Preparation
- Ensure both systems are connected to the same network.
- Install rsync on both systems if it’s not already installed:
sudo pacman -S rsync
- Determine the IP address of the destination system:
ip addr show
Syncing the Home Directory
To sync your home directory from the source system to the destination system, use the following command on the source system:
rsync -av --update ~/ username@destination_ip:/home/username/
Replace username
with your actual username on the destination system, and destination_ip
with the IP address of the destination system[1][2].
Explanation of the Command
-a
: Archive mode, which preserves permissions, ownership, timestamps, etc.-v
: Verbose mode, which provides detailed output of the sync process.--update
: This option skips files that are newer on the receiver side.~/
: This is the source directory (your home directory on the current system).username@destination_ip:/home/username/
: This is the destination, specifying the user, IP address, and path on the remote system[1][3].
Additional Considerations
-
SSH Key Authentication: For a smoother experience, set up SSH key authentication between the two systems. This eliminates the need to enter a password each time you run rsync[4].
-
Exclude Files: You might want to exclude certain directories or files. Use the
--exclude
option:rsync -av --update --exclude '.cache' --exclude '.local/share/Trash' ~/ username@destination_ip:/home/username/
-
Dry Run: Before performing the actual sync, you can do a dry run to see what would be transferred:
rsync -av --update --dry-run ~/ username@destination_ip:/home/username/
-
Bandwidth Limit: If you’re concerned about network usage, you can limit the bandwidth:
rsync -av --update --bwlimit=1000 ~/ username@destination_ip:/home/username/
This limits the transfer to 1000 KB/s[3].
-
Incremental Backups: The
--update
flag ensures that only newer files are transferred, making subsequent syncs faster.
Remember to run this command from the source system, and ensure you have the necessary permissions on both systems. Always double-check your command before running it to avoid unintended data loss or overwriting[2][5].
Citations: [1] https://www.bleepingcomputer.com/forums/t/748252/a-guide-to-backing-up-your-home-directory-using-rsync/ [2] https://www.reddit.com/r/linux4noobs/comments/qtu0ww/backup_and_restore_home_directory_with_rsync/ [3] https://www.cherryservers.com/blog/how-to-use-rsync-on-linux-to-synchronize-local-and-remote-directories [4] https://www.tecmint.com/rsync-local-remote-file-synchronization-commands/ [5] https://www.digitalocean.com/community/tutorials/how-to-use-rsync-to-sync-local-and-remote-directories [6] https://stackoverflow.com/questions/9090817/copying-files-using-rsync-from-remote-server-to-local-machine/9090859 [7] https://www.heficed.com/tutorials/vps/how-to-use-rsync/