Skip to content
Follow
Ubuntu Linux Windows

How to Back Up and Restore Linux on WSL

Richard
Written by
Richard
Jan 21, 2022 Updated Sep 15, 2026 2 min read
How to Enable or Disable Phone Link in Windows 11
How to Enable or Disable Phone Link in Windows 11

Backing up WSL (Windows Subsystem for Linux, a feature that lets you run Linux software directly inside Windows 10 and Windows 11) saves your entire Linux setup into a single .tar archive file on your hard drive. This backup protects your custom settings and personal files so you can restore them within minutes if your system breaks or you switch to a new PC.

Advertisement

You use the built-in Windows command prompt to export and import your Linux distribution, such as Ubuntu 22.04 LTS, without needing any extra backup tools.

⚡ Quick Answer

Back up your Linux on WSL distribution by running `wsl –export ` in an administrator PowerShell. Restore it using `wsl –import `. These commands create and restore a portable tar archive of your Linux environment.

Advertisement

Why back up your Linux environment?

Protecting the Linux environment prevents data loss from unexpected system issues.

What happens when you are done?

Once imported, the system functions normally, though restored instances will not appear in the Windows Start menu or apps list automatically.

How to back up and restore Linux on WSL

To back up and restore Linux on WSL, you need to use Windows PowerShell with administrator permissions so you can properly export and import your files. This process lets you save a copy of your Linux environment or move it to a different computer without losing your data. You will use specific export and import commands in the terminal to manage your distributions safely.

1. Open the Start menu , search for PowerShell, and select Run as administrator. Learn how to run as administrator here.

Advertisement
Windows 11 Command Prompt running as administrator for WSL backup
windows 11 command prompt administrator

2. List your installed distributions:

💻Code
wsl.exe --list

Exporting your WSL distribution

Exporting a WSL distribution creates a backup file of the Linux system using a dedicated command.

💻Code
wsl --export Ubuntu-20.04 C:\backup\my-linux-backup.tar
💡Pro TipCompressing the resulting .tar file using tools like 7-Zip saves significant disk space.

Importing your WSL distribution

Restoring or moving an instance relies on the import command. This process generates a new .vhdx file (a virtual hard disk format Windows uses) in your chosen folder.

Advertisement
💻Code
wsl --import Ubuntu-20.04 C:\Users\genericuser\Ubuntu C:\backup\my-linux-backup.tar

Advanced Troubleshooting and Automation

Moving an instance to a different drive requires exporting it, unregistering the old one with wsl --unregister, and importing it to the new path. Automated backups involve saving the export command within a .ps1 script and executing it daily through Windows Task Scheduler.

Summary

Backing up and restoring a Linux WSL setup remains vital for data safety, streamlining system migrations and troubleshooting.

Was this guide helpful?

Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard is a writer at Geek Rewind who turns complex IT tasks into clear, step-by-step guides. He draws on years of hands-on experience in system administration and enterprise IT operations, focusing on Windows, Linux and WordPress: the problems people actually run into, and the fixes that work. His server and WordPress guides come from systems he runs himself. Richard builds and maintains the platform behind Geek Rewind, from its Ubuntu servers and Nginx configuration to its custom WordPress plugins. Many new tutorials start with readers' questions, and he's always glad to answer them in the comments.

Advertisement

📚 Related Tutorials

How to Install Windows Subsystem for Linux (WSL) on Windows 11
Ubuntu Linux How to Install Windows Subsystem for Linux (WSL) on Windows 11
How to Access Command Prompt in Windows 11
Windows How to Access Command Prompt in Windows 11
How to Access Linux Files on Windows 11 Using WSL
Windows How to Access Linux Files on Windows 11 Using WSL
How to Install PrestaShop on Windows WSL
CMS How to Install PrestaShop on Windows WSL

No comments yet — be the first to share your thoughts!

Leave a Comment

Your email address will not be published. Required fields are marked *