Skip to content
Follow
Ubuntu Linux Windows

How to Back Up and Restore Linux on WSL

Richard
Written by
Richard
Jan 21, 2022 Updated Jul 14, 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 and restoring Linux on Windows Subsystem for Linux (WSL) uses simple commands to create a portable archive of your Linux system.

This process bundles all your installed apps and personal files into a single `.tar` file, making it easy to move or recover your Linux setup. For instance, you can export your Ubuntu 22.04 LTS distribution to a tar file on your C: drive.

This action protects your Linux environment from accidental data loss or system issues.

⚡ 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.

Why back up your Linux environment?

Backing up your Linux environment on WSL is smart because it lets you quickly get your work back if something goes wrong.

What happens when you are done?

Once imported, your Linux WSL setup will function as expected. However, it won’t appear in the Windows Start menu or apps list.

How to back up and restore Linux on WSL

You can back up and restore Linux on WSL to keep your files safe or move them to another computer. This process involves using commands in Windows PowerShell, and you’ll need to run PowerShell as an administrator to give the commands permission to access all your Linux files.

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

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 your WSL distribution is how you create a backup file of your Linux system using a simple command.

💻Code
wsl --export Ubuntu-20.04 C:\backup\my-linux-backup.tar
💡Pro Tip
You can compress the resulting .tar file using tools like 7-Zip to save significant disk space.

Importing your WSL distribution

To restore or move your instance, use the import command. This process creates a new vhdx file (a virtual hard disk file) in the directory you specify.

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

Advanced Troubleshooting and Automation

If you need to move your instance to a different drive, export it, unregister the old one with wsl --unregister, and then import it to the new path. For automated backups, save the export command within a .ps1 script. Then, use Windows Task Scheduler to execute it on a daily basis.

Summary

Ultimately, backing up and restoring your Linux WSL setup is vital for data safety and simplifies moving or fixing your system.

Can I back up a running WSL instance?

It is highly recommended to shut down your WSL instance before backing it up to ensure data consistency. Use the command ‘wsl –shutdown’ in PowerShell before running your export command to prevent file corruption or incomplete snapshots of your Linux environment.

Does wsl –export include my Windows-side files?

No, the export command only captures the Linux filesystem contained within the WSL virtual disk. It does not include files stored on your Windows drives that you access via the /mnt/c path. You must back up those Windows files separately using standard backup software.

Was this guide helpful?

Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

📚 Related Tutorials

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 Windows Subsystem for Linux (WSL) on Windows 11
Ubuntu Linux How to Install Windows Subsystem for Linux (WSL) on Windows 11
How to Uninstall Windows Subsystem for Linux (WSL) in Windows 11
Ubuntu Linux How to Uninstall Windows Subsystem for Linux (WSL) in Windows 11

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

Leave a Comment

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