logo elektroda
logo elektroda
X
logo elektroda

Windows 10 and rsync, the efficient and fast way to back up our data

p.kaczmarek2 7611 11

TL;DR

  • Uses WSL to run Linux rsync on Windows 10/11 for automated backups to a NAS or external drive.
  • Maps the NAS as a Windows network drive, mounts it in WSL with drvfs, then syncs files with rsync instead of blind copying.
  • Requires Windows 10 version 2004 or higher (Build 19041 or higher), or Windows 11, and the example command is rsync -av --delete --dry-run /mnt/w /mnt/x/b/w.
  • Rsync transfers only changed files, can be paused and resumed, and the dry-run mode shows deletions before any real synchronization.
Generated by the language model.
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
📢 Listen (AI):
  • Screenshot showing Ubuntu installation via WSL in the Windows PowerShell window. .
    I will show here how to easily set up Linux rsync on Windows via WSL and then use it to make a copy of our files to a local NAS server via SMB, although analogously copies can also be made to a regular external hard drive. In a way, this method will automate what we often do quite unnecessarily manually, so it will ultimately save us time in keeping our files safe. In addition, the whole thing will work more efficiently, thanks to the fact that rsync only sends changed files and does not blindly copy everything.

    Today's electronics are inextricably linked to IT. It's really hard to imagine sifting through tonnes of catalogue notes in the form of physical binders taking up half our cupboard, and even harder to imagine designing a circuit fully on paper - from schematic to PCB design, which is also increasingly at least two layers. For this reason, I thought it worthwhile here to present a method for automatically creating copies via the tool rsync . Rsync is a console tool, normally available on Linux systems, but with a little effort it can be run on Windows too. I'll outline the whole process here step by step and perhaps save someone from losing files.

    Step 1 - Install WSL <span>
    These Windows steps are skipped if we are on Linux! .
    For some time now, Microsoft has offered us the possibility to install WSL, the so-called Windows Subsystem for Linux. WSL allows us to install a Linux distribution (such as Ubuntu, OpenSUSE, Kali, Debian, Arch Linux, etc.) on Windows without having to resort to less efficient and inconvenient solutions such as dual boot or there virtual machine. This allows us to run Linux programs from within our ten (or eleven...).
    Before installation, we need to check that we meet the requirements.
    You need Windows 10 version2004 or higher (Build 19041 or higher) or Windows 11. If we don't meet this, we do an upgrade.
    Then we open PowerShell - as administrator:
    PowerShell context menu with Run as Administrator option highlighted in Windows. .
    We type wsl --install :
    PowerShell window running as administrator with the command wsl --install typed. .
    The laborious installation process will then begin:
    Windows PowerShell window with the WSL installation command active and a message about installing Virtual Machine Platform. .
    Waiting:
    Screenshot of Windows PowerShell window running wsl --install command, installation progress at 74.1%. .
    In my case it continued to install Ubuntu by default, but the installation was stuck at 0.6%:
    Screenshot of WSL and Ubuntu installation in a Windows PowerShell window. .
    I aborted the process and performed the necessary reboot of the machine. Reboot can be done with the command wsl --install -d Ubuntu :
    Windows PowerShell window running the command to install Ubuntu via WSL, showing download progress at 16.8%..
    After a while, our Linux system will install and our Ubuntu prompt will start.

    Step 2 - we are finalizing Ubuntu on Windows .
    It's time to configure our Windows Ubuntu. We provide a username and password:
    Computer screen with PowerShell running Ubuntu installation via WSL and Ubuntu window asking to create a UNIX user. .
    Ubuntu is picky, I had to enter the name in lower case:
    PowerShell window installing WSL and Ubuntu, with Ubuntu terminal prompting for a UNIX username during initial setup. .
    We also set a password, I myself chose a fairly short four-letter one:
    Ubuntu installation screen in PowerShell on Windows with user setup in WSL. .


    Step 3 - getting familiar with Ubuntu .
    From now on, we can type "WSL" on the Windows bar and run the Linux command line this way:
    Screenshot of the Windows search showing the WSL app with a penguin icon in the results. .
    In my case it looks like this:
    Ubuntu 20.04 terminal launched in WSL showing the welcome message and system summary. .
    The obvious implication of this is that you need to know the Linux commands. That is, we operate via cd (change folder), mkdir (create), chmod (set permissions), etc, etc. Our disks can be found in the mnt folder:
    Screenshot of Ubuntu terminal running in WSL on Windows, showing filesystem navigation commands and directory listing. .
    For example, below I have looked at my W drive - lower case there. All files are visible:
    WSL terminal window on Windows displaying directory structure and filenames on mounted W drive with visible commands and text files. .

    Step 4 - plug the backup media into the WSL .
    Now we still need to access our media from the backup in WSL. Initially I wanted to use the normal Linux way of SMB, i.e. mapping the Samba resource to mnt via mount, but that didn't want to work here.
    Eventually I decided that I would map my server on Windows as a network drive .
    This is performed in This Computer, here:
    A screenshot from Windows Explorer highlighting the Map network drive option in the top toolbar. .
    We click through the wizard:
    Network location wizard window in Windows, with Next and Cancel buttons visible. .
    We enter the address of the share in the format <span>share:
    Network drive mapping window in Windows with options for selecting drive letter and network folder. .
    Below you have an example of what this looked like for me:
    Windows network drive mapping window with selected drive letter and network folder address. .
    It's worth ticking the box from automatically connecting after a reboot.
    Then in my case the disk did not appear at first, but after the reboot everything was ok:
    Windows “This PC” window with a mapped network drive “Backup (\NAS19)” as drive X: highlighted. .
    If you want to copy to a regular drive connected via USB it is even simpler - you don't need to map the network drive.

    Step 5 - rsync command .
    The name rsync comes from Remote Sync - meaning remote synchronisation. It is not a simple command cp , but much more. Rsync offers a lot of switches and possibilities, which you can read about in the documentation:
    https://linux.die.net/man/1/rsync
    Rsync is a much more efficient solution than blindly copying data. Rsync analyses the files and only transfers what has changed. Rsync can be easily resumed and paused. Rsync also compresses data on transfer.
    I didn't even have to install rsync itself. I only had to mount the newly added network share to WSL by first creating a folder for it in mnt (as root) with the mkdir command:
    WSL terminal window showing permission denied error for mkdir, then successful directory creation with sudo. .
    And then by executing mount:
    
    sudo mount -t drvfs X: /mnt/x
    
    .
    WSL terminal window showing the command to mount drive X: to /mnt/x using sudo mount -t drvfs. .
    As a result, WSL also started to see files from my mapped network drive.
    Then all I had to do was use the rsync command.
    I recommend this for a trial:
    
    rsync -av --delete --dry-run /mnt/w /mnt/x/b/w
    
    .
    The basic syntax is:
    
    rsync [przełączniki] [źródło] [cel]
    
    .
    This will make a copy of the files from the source on the specified target.
    Let's decipher the arguments one by one:
    - a is the archive mode (recursive synchronisation with the option to preserve attributes)
    - v - verbose mode (displaying progress and processing information)
    - delete - deletes files on the target location that do not exist on the source location
    - dry-run - enables simulation mode, where rsync displays what would happen, but does not perform the actual synchronisation, so you can experiment to your heart's content
    This is what it looked like for me:
    WSL terminal showing example use of the rsync command to simulate copying files between directories. .
    rsync will also give information about deleted files. And of course - the process can be interrupted and resumed, the whole thing works "smart" and does not copy blindly, it is an efficient solution.


    Summary
    Installing WSL on Windows really opens up a lot of possibilities and allows you to run a lot of convenient, previously rather inaccessible applications comfortably on "windows". Rsync is one of them and does quite well, especially as it synchronises everything locally. There are no clouds, Boxes, Drives or thereabouts commercial intermediaries, additionally constantly trying to persuade us to buy additional storage space. For this reason, I believe that the solution presented here is attractive to those who value privacy and want to have everything under their control.
    Finally, let me remind you of the important 3-2-1 rule:
    - 3 means that all our data should be kept in at least 3 copies (3 x backup)
    - 2 means that the copies should be on at least two different media
    - 1 means that at least one copy should be in a different location (physically, so-called "offsite").. off-site backup)
    In my case there are a bit more of these copies, as I also regularly burn DVDs with progress shots, but these 3 (or is it 4?) copies are the bare minimum when something is important.
    That's about it from my side. If something is not clear, please ask in the forum, I will help. .
    I hope to save at least one person from data loss this way....
    Do any readers use rsync? Or do you have any other methods to protect against data loss? .
    PS: With these at least three copies it's not a joke - just recently on our forum I read a story of a user who supposedly made a copy, but when the main media broke down (one with SMR - but that's another matter...) this copy failed him.... so three copies is the minimum.
    PS2: Just for the record - nothing replaces a version control system, but if it's about e.g. photos etc, then rather rsync will suffice

    Cool? Ranking DIY
    Helpful post? Buy me a coffee.
    About Author
    p.kaczmarek2
    Moderator Smart Home
    Offline 
    p.kaczmarek2 wrote 14615 posts with rating 12633, helped 655 times. Been with us since 2014 year.
  • ADVERTISEMENT
  • #2 20681510
    GGK
    Level 13  
    Posts: 45
    Help: 1
    Rate: 18
    Such a copy does not protect against ransomware unfortunately. You can play around and set the mapping of the remote share before and after synchronisation. Possibly introduce rotation. We use the free veeam, which works superbly and has deduplication, conoresion and versioning.
  • #3 20681555
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14615
    Help: 655
    Rate: 12633
    It depends. In my case, the remote server is only switched on occasionally, so there's a period of time where I can figure out if something is wrong. I also have extra copies.

    A version control system is essential for e.g. code, but for data such as images, pdfs, etc., in my case rsync is sufficient.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #4 20681844
    acctr
    Level 39  
    Posts: 4554
    Help: 389
    Rate: 2021
    I have set up a backup and data management system for my own use. I use rsync, but this tool alone is not enough.
    There are problems such as duplicate files and strategies for managing them, synchronising backups (especially when it comes to photos and getting rid of unnecessary files), undoing changes, logging exactly what is being done, busy reports, etc.
    I base my solution on file hashes. All operations of adding, moving and deleting files are first performed on the hashes, then execution scripts are generated and scripts for undoing changes should something go wrong.
    Technically it is a set of tools written in Python, Bash, Java and C.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #6 20681970
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14615
    Help: 655
    Rate: 12633
    @simw good point.

    @acctr yes, I play like that too, I have at least a multithreaded, just based on hash tables (but the first level of hashes is... file length in bytes), deduplication program:
    Screenshot of a file deduplication program showing a summary of files, directories, and data usage. .
    Helpful post? Buy me a coffee.
  • #7 20682157
    ex-or
    Level 28  
    Posts: 785
    Help: 147
    Rate: 151
    I use rsync to back up my Linux machines. The root branch is dumped in its entirety (without /tmp and the like) - disaster recovery is easy and fast, which I have tested several times.
    The filesystems of bekapped machines are based on LVM, and bekap is done on snapshot so it can be done during normal operation while maintaining consistency. The transfer is done via SSH, which slows down the transfer a bit (a direct connection with the rsyncd daemon is fastest) but allows for flexible configuration, and is the most secure. Mounting or mapping network shares is rather a pain, neither convenient nor secure. On the NAS side, there is simple archive versioning based on hard links, which on the one hand allows to maintain almost any number of versions, on the other hand does not bloat the archive volume excessively. Bekap can be run by cron from the NAS server or from a client machine.
  • #8 20682232
    acctr
    Level 39  
    Posts: 4554
    Help: 389
    Rate: 2021
    ex-or wrote:
    I use rsync to backup Linux machines. The root branch is dumped in its entirety (without /tmp and the like) - disaster recovery is easy and fast, which I have tested several times.
    .
    I use the dedicated Timeshift tool for this.
    Helpful post? Buy me a coffee.
  • #9 20683068
    jvoytech
    Level 22  
    Posts: 361
    Help: 61
    Rate: 136
    If by chance someone has msys2 installed on windows, rsync is installed with the command "pacman -S rsync"
  • ADVERTISEMENT
  • #10 20683076
    acctr
    Level 39  
    Posts: 4554
    Help: 389
    Rate: 2021
    jvoytech wrote:
    rsync is installed with the command "pacman -S rsync"
    .
    And this is not the package manager in Arch linux? In ubuntu/mint we have apt.
    Helpful post? Buy me a coffee.
  • #11 20683084
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14615
    Help: 655
    Rate: 12633
    Looks like @jvoytech is right. On my msys2 this command works. Thanks, I learned something new.

    File Explorer window with the msys64 folder open and a terminal window showing rsync installation in MSYS2. .
    Helpful post? Buy me a coffee.
  • #12 20683143
    simw
    Level 27  
    Posts: 756
    Help: 94
    Rate: 286
    p.kaczmarek2 wrote:
    It looks like @jvoytech is right. With me on msys2 this command works. Thanks, I learned something new.
    .
    It seems to be similar with Cygwin64.
    It too is in packages and can be installed.
    All in all no surprise, after all it's a linux toolkit for windows.
    Cygwin Setup window displaying a package selection list, rsync searched. .
📢 Listen (AI):

Topic summary

✨ The discussion focuses on using rsync for efficient data backup on Windows 10 via Windows Subsystem for Linux (WSL). Users highlight the advantages of rsync, such as only transferring changed files, which saves time and resources. However, concerns about ransomware protection and the need for additional tools for managing duplicates and logging are raised. Alternatives like Veeam and Timeshift are mentioned for more comprehensive backup solutions. Users also discuss the availability of rsync through other platforms like msys2 and Cygwin, emphasizing its versatility in backup strategies.
Generated by the language model.

FAQ

TL;DR: The thread’s bottom line is "three copies is the minimum," and the 3-2-1 rule gives the concrete target: 3 copies, 2 media, 1 offsite copy. For Windows 10 users, WSL + rsync solves fast local NAS backups by syncing only changed files and testing safely with --dry-run before deletion-enabled runs. [#20681049]

Why it matters: This setup gives Windows users a practical, low-cost path to repeatable backups without relying on cloud storage or full recopy jobs.

Option Setup effort Best use case Main trade-off
WSL + Ubuntu Medium Windows 10/11 users who want Linux rsync behavior Needs WSL setup and drive mounting
cwRsync Low Simple Windows-native rsync use Less Linux-like workflow
MSYS2 / Cygwin Medium Users already running Unix-like toolchains on Windows Extra package/toolchain layer
rsync over SSH / rsyncd Medium-High Linux/NAS backup servers Better security or speed, less convenient on Windows shares

Key insight: Rsync is strong at efficient file synchronization, but the thread treats it as one layer of backup, not the whole strategy. For ransomware resistance and recovery, add versioning, rotation, or offline copies. [#20681510]

Quick Facts

  • WSL in the thread requires Windows 10 version 2004+ with Build 19041+, or Windows 11, before wsl --install is expected to work cleanly. [#20681049]
  • The sample backup flow maps the NAS as a Windows network drive, then mounts it into WSL with sudo mount -t drvfs X: /mnt/x so rsync can access it. [#20681049]
  • The test command shown is rsync -av --delete --dry-run /mnt/w /mnt/x/b/w; the risky switch is --delete, so the safe first pass is the dry run. [#20681049]
  • The thread’s backup baseline is the 3-2-1 rule: 3 copies, 2 different media, and 1 physical offsite copy. [#20681049]
  • Several commenters add missing layers beyond raw rsync: deduplication, compression, versioning, hard links, hashes, and undo scripts for safer rollback and storage efficiency. [#20681510]

How do I set up rsync on Windows 10 using WSL and back up files to a NAS over SMB step by step?

Use WSL, map the NAS in Windows, then run rsync from Ubuntu. 1. In Administrator PowerShell, run wsl --install, finish Ubuntu setup, and reboot if needed. 2. Map the SMB share as a Windows network drive, for example X:. 3. In WSL, create /mnt/x, mount X: with sudo mount -t drvfs X: /mnt/x, then test with rsync -av --delete --dry-run /mnt/w /mnt/x/b/w. Replace --dry-run only after reviewing the file list. [#20681049]

What is WSL in Windows 10 and why use it to run rsync instead of a virtual machine or dual boot?

WSL lets Windows run a Linux distribution directly, which makes rsync available without dual boot or a full VM. "WSL" is a Windows feature that runs a Linux userspace inside Windows, avoiding a separate boot path and reducing setup friction compared with a virtual machine or dual boot. The thread recommends it because Ubuntu tools run from the Windows desktop, and Microsoft supports installation with a single wsl --install command on supported systems. [#20681049]

Why does the Ubuntu installation in WSL sometimes get stuck during wsl --install, and what troubleshooting steps help?

The thread shows WSL can stall during Ubuntu installation, including one case stuck at 0.6%. The practical fix was to stop the process, reboot the PC, and run installation again, including wsl --install -d Ubuntu. That reboot completed the setup and launched the Ubuntu prompt afterward. This is an edge case worth expecting during first-time WSL deployment. [#20681049]

Where are Windows drives mounted inside WSL, and how do I access a drive like W: from Ubuntu?

Windows drives appear under /mnt inside WSL. In the thread, the W: drive is accessed as /mnt/w, using a lowercase drive letter. You then use normal Linux commands such as cd and ls to browse files from Ubuntu. That mapping lets rsync treat Windows folders like local Linux paths. [#20681049]

How do I mount a mapped Windows network drive inside WSL using drvfs so rsync can see it?

Mount the mapped Windows drive into WSL with drvfs. "drvfs" is a WSL filesystem driver that exposes Windows drives inside Linux paths, preserving easy access to mapped letters like X: without a native Linux SMB mount. The thread’s exact method is to create a folder such as /mnt/x as root, then run sudo mount -t drvfs X: /mnt/x. After that, rsync can read and write the NAS path through /mnt/x. [#20681049]

What do the rsync options -a, -v, --delete, and --dry-run actually do in a backup command?

-a preserves structure and attributes, -v prints progress, --delete removes target files missing from the source, and --dry-run simulates everything without changing data. The thread explicitly warns by example that --delete is powerful because it mirrors deletions too. That makes --dry-run the safest first pass before any real synchronization. [#20681049]

Why is rsync more efficient than copying files with cp or normal drag-and-drop backup methods?

Rsync is more efficient because it transfers only changed files instead of recopying everything. The thread contrasts it with simple cp and manual drag-and-drop workflows, calling rsync “smart” because it can pause, resume, and report deletions. That reduces wasted transfer time when the source already mostly matches the target. [#20681049]

How should I safely test an rsync backup to a NAS before running the real synchronization?

Test the job with --dry-run first and inspect every listed change. In the thread, the sample safe command is rsync -av --delete --dry-run /mnt/w /mnt/x/b/w. That simulation shows copies and deletions without touching data. Only remove --dry-run after you confirm the source and destination paths are correct. [#20681049]

What is the 3-2-1 backup rule, and how does it apply to rsync backups on Windows and NAS storage?

The 3-2-1 rule means 3 total copies, 2 different media, and 1 copy in another physical location. In the thread, rsync handles one synchronization layer, such as Windows files to a NAS, but the author still keeps extra copies and mentions at least 3 copies as the minimum. That turns rsync from a convenience tool into part of a broader resilience plan. [#20681049]

Why doesn’t a simple rsync copy fully protect against ransomware, and what extra measures like rotation or versioning are recommended?

A plain rsync mirror can copy damage too, so it does not fully stop ransomware impact. One reply recommends disconnect timing, share mapping only around sync time, and adding rotation. Another suggests Veeam because it adds deduplication, compression, and versioning. The practical lesson is simple: keep historical versions or offline windows, not only a live mirror. [#20681510]

Rsync over mapped SMB shares vs rsync over SSH or rsyncd on Linux and NAS systems — which approach is better for security, speed, and convenience?

Mapped SMB shares are convenient on Windows, but the thread presents SSH and rsyncd as stronger Linux-side choices. One user says rsyncd is fastest, while SSH is slower yet more secure and more flexible. The same reply calls mounting or mapping network shares inconvenient and less secure for that use case. Choose SMB for easy Windows integration, SSH for security, and rsyncd for raw speed. [#20682157]

What Windows-native alternatives to WSL exist for running rsync, such as cwRsync, MSYS2, or Cygwin, and how do they differ?

The thread names three Windows-native alternatives: cwRsync, MSYS2, and Cygwin. cwRsync is presented as a direct Windows rsync option that avoids WSL entirely. MSYS2 and Cygwin instead provide broader Unix-like toolchains where rsync comes as a package. That makes cwRsync the simplest dedicated choice, while MSYS2 and Cygwin suit users already using those environments. [#20681922]

How do I install rsync in MSYS2 on Windows with pacman, and when is that a better choice than WSL Ubuntu?

In MSYS2, install rsync with pacman -S rsync. The thread confirms that exact command works on MSYS2, and another comment says Cygwin offers a similar packaged approach. Choose MSYS2 over WSL when you already maintain an MSYS2-based Windows toolchain and want rsync without installing Ubuntu. WSL is better when you want a fuller Linux environment. [#20683068]

What is LVM snapshot in Linux backups, and why do people use it with rsync for consistent live-system backups?

An LVM snapshot freezes a point-in-time view of a live filesystem so backup reads stay consistent during normal use. "LVM snapshot" is a Linux storage feature that captures a temporary, point-in-time view of a logical volume, allowing backup software to read stable data while the system keeps running. In the thread, one user backs up from snapshots specifically to keep disaster-recovery images consistent. [#20682157]

How do deduplication, file hashes, hard-link versioning, and tools like Veeam or Timeshift complement rsync in a more complete backup strategy?

They add rollback, storage efficiency, and change control that raw rsync alone does not guarantee. The thread mentions Veeam for deduplication, compression, and versioning; Timeshift for Linux system recovery; file-hash workflows for duplicate detection and undo scripts; and NAS hard-link versioning to keep many versions without excessive archive growth. One participant summarizes the idea well: “rsync alone is not enough.” [#20681844]
Generated by the language model.
ADVERTISEMENT