Slow moving folder with a lot of files from Windows to WSL
If you are using the Windows Subsystem for Linux (WSL) and need to move a folder with a large number of files from your Windows file system to WSL, you might encounter slow transfer speeds or even freezing of the system. This article will guide you through some steps to optimize the transfer process and ensure a smooth file transfer experience.
1. Check WSL version
Before proceeding, it's important to ensure that you are using the latest version of WSL. Microsoft regularly releases updates with performance improvements and bug fixes. To check your WSL version:
- Open the Command Prompt or PowerShell.
- Type
wsl --list --verboseand press Enter. - Look for the default WSL distribution (usually "Ubuntu" or "Debian") and note the version number.
- If you are not using the latest version, update WSL by visiting the Microsoft Store and searching for the distribution you are using. Click on "Update" if available.
2. Disable real-time antivirus scanning
Antivirus software can significantly slow down file transfers, especially when dealing with a large number of files. Temporarily disabling real-time scanning during the transfer process can help improve performance. Here's how to disable real-time scanning in Windows Defender:
- Open Windows Security by clicking on the shield icon in the taskbar notification area.
- Click on "Virus & threat protection" in the left sidebar.
- Under "Virus & threat protection settings," click on "Manage settings."
- Toggle off the "Real-time protection" switch.
Note that disabling real-time scanning temporarily reduces your system's security, so make sure to re-enable it after the file transfer is complete.
3. Use compression
Compressing the folder before transferring it to WSL can significantly reduce the transfer time. Windows provides built-in compression capabilities, and you can use them to compress the folder into a single file. Here's how:
- Navigate to the folder you want to transfer in File Explorer.
- Right-click on the folder and select "Send to" > "Compressed (zipped) folder."
- A compressed version of the folder will be created in the same location.
- Move the compressed folder to your WSL distribution.
- In WSL, navigate to the location where you transferred the compressed folder.
- Extract the contents of the compressed folder using the
unzipcommand. For example, if the compressed folder is named "myfolder.zip," rununzip myfolder.zip.
4. Use rsync
Rsync is a powerful command-line utility that can efficiently synchronize files between different locations. It is especially useful for transferring large folders with many files. To use rsync:
- Open your WSL distribution.
- Install rsync if it is not already installed. Run
sudo apt install rsyncfor Ubuntu or Debian-based distributions. - Use the following command to transfer the folder from your Windows file system to WSL:
rsync -avh --progress /mnt/c/path/to/folder/ /path/to/destination/
Make sure to replace /mnt/c/path/to/folder/ with the actual path to your folder in Windows, and /path/to/destination/ with the desired path in WSL.
5. Additional tips
Here are some additional tips to optimize the file transfer process:
- Close unnecessary applications and processes running in the background to free up system resources.
- Ensure that both your Windows and WSL distributions are running on an SSD for faster read and write speeds.
- Split large folders into smaller chunks and transfer them individually.
- If possible, connect your computer to a wired network for faster transfer speeds.
By following these steps and tips, you should be able to transfer your folder with a lot of files from Windows to WSL more efficiently. If you still experience slow transfer speeds or encounter any issues, it is recommended to seek further assistance from your system administrator or technical support.
References
| Source | Link |
|---|---|
| Microsoft WSL Documentation | https://docs.microsoft.com/en-us/windows/wsl/ |
| How-To Geek - How to Use Rsync to Sync New or Changed Files in Linux | https://www.howtogeek.com/50787/use-rsync-for-easy-and-fast-file-transfer/ |