Hostwinds Tutorials
Search results for:
Table of Contents
This guide requires rsync and will only work on Linux VPS, and will not work for a Windows VPS.
If you'd like to copy the contents of your *-nix VPS to your local machine, the rsync command makes it extremely easy to do so.
rsync is a standard tool for Unix-based operating systems that is used to sync files between directories. One nifty use of rsync is that the source and destination directories for syncing can be located on a remote server. It even works with MacOSx.
We can use this feature to sync files from the remote VPS to your localhost. This one-liner will sync all files on the VPS starting from the / directory. It will preserve permissions and ownership, and copy objects in "archive" mode, which also preserves timestamps, symlinks, and other features:
# sudo rsync --archive root@<IP>:/* --exclude={"/tmp/","/sys/","/proc/","/dev/","/mnt/"} .
The command may take several minutes to complete. Once it completes, the contents of the VPS will be available on your local machine:
You will now have a copy of the contents of the VPS with the original file structures preserved.
Windows does not provide support for the rsync command. You will need to install cygwin with the default net packages. Then you can execute the provided commands from cygwin's bash.exe.
Written by Hostwinds Team / June 18, 2020