How to Backup Data using Rsync on Windows 10

Personally, I love Rsync, a small command-line utility for data sync and backup. I have been using Rsync to handle my Linux server backup for the last few years. I was looking for similar software for Windows 10 but still cannot find it. So this article will discuss how to use Rsync to back up our data on Windows 10. We will utilize the Windows Subsystem for Linux.

Windows Subsystem for Linux allows us to seamlessly run the Linux operating system on top of Windows. We do not need third-party virtualization software such as VMware or Virtualbox. To set up the WSL on Windows 10, please follow my previous guide below

Install Windows Subsystem for Linux on Windows 10

In this practice, I am using WSL Debian Linux. You can install Debian from Microsoft Store once you set up the WSL on Windows 10. I will show you how I backup my local folder to the remote NAS server.

Steps to Backup Data using Rsync on Windows 10

Step 1. Install Windows Subsystem for Linux

As I mentioned above, first we need to install and configure WSL on Windows 10.

Step 2. Install Debian

Next, install Debian or Ubuntu, or any other Linux you feel comfortable using. Use Microsoft Store to download.

Step 3. Install Rsync

If you are using Ubuntu, rsync package is already installed. But if you are choosing Debian, you need to install this package manually. I also install ssh because I want to backup my local data to the remote server via ssh.

sudo apt install rsync ssh

Step 4. Perform the backup

In this example, I am going to backup my VM folder to the remote server (192.168.100.100). This is the backup source.

f:\VM

The folder in the remote server would be:

/mnt/Pool01/Test

Now let’s execute the command

rsync -avv /mnt/f/VM dhani@192.168.100.100:/mnt/Pool01/Test

My F drive is mounted under /mnt directory in the Debian Linux.

We can also start the rsync command directly from Windows PowerShell. For example:

wsl rsync -avv /mnt/f/VM dhani@192.168.100.100:/mnt/Pool01/Test

The command above will synchronize or backup the folder VM to the remote folder Test. We can do more with rsync. For more command or options, please visit the following page to learn more about rsync.

Common Rsync Options

Here are some of the common rsync options:

  • – a : archive mode, archive mode allows copying files recursively and it also preserves symbolic links, file permissions, user & group ownerships and timestamps
  • – v: verbose mode
  • – h: human-readable, output numbers in a human-readable format

Backup/Sync Examples

A. Sync/Copy Folder A content to Folder B (Local folders)

rsync -avh --progress /mnt/f/folder_a/ /mnt/f/folder_b

The command will copy/sync all files inside folder_a to folder_b and show the progress.

Now, folder_b content is exactly the same as folder_a.

B. Sync/Copy folder_a to folder_b (Local folder)

Slightly it is similar to the scenario above. But, the following command will create folder_a inside folder_b.

rsync -avh --progress /mnt/f/folder_a /mnt/f/folder_b

C. Sync/Copy local folder_a to remote server via SSH

The following scenario will copy/sync the local folder to remote server via SSH. For example: We will sync the folder_a (local) to a remote directory via SSH connection.

rsync -avh --progress /mnt/f/folder_a dhani@192.168.100.100:/mnt/Pool01/Test

D. Sync/Copy remote folder to local folder

The following example will sync the remote directory to the local directory via SSH. It’s pretty similar to the above scenario but with a different sync direction.

rsync -avh --progress dhani@192.168.100.00:/mnt/Pool01/Test /mnt/f/folder_a

Bottom Line

Rsync is one of the popular backup/sync software for Linux users. With the new WSL (Windows Subsystem for Linux) technology we can bring this rsync to Windows 10. With a little effort, we can bring the power of rsync to Windows 10.

Be the first to comment

Leave a Reply