Back Up and Restore WSL Distribution
You can back up a configured Windows® Subsystem for Linux (WSL) distribution by exporting it to a tar file. You can later restore the distribution by importing the tar file as a new WSL distribution.
Note
Backing up a WSL distribution preserves the PX4 firmware source code, toolchain, dependencies, and any customizations made to the environment.
Back Up a WSL Distribution
List the available WSL distributions and identify the distribution name:
wsl -l -v
Shut down WSL before exporting the distribution:
wsl --shutdownExport the distribution to a tar file:
wsl --export <DistroName> <BackupFilePath>.tar
For example:
wsl --export PX4-Ubuntu-22.04 D:\Backups\PX4-Ubuntu-22.04.tar
Verify that the backup file was created successfully:
Get-Item <BackupFilePath>.tar
Restore a WSL Distribution
Import the backup tar file as a new WSL distribution. Use a different name than the original distribution to avoid overwriting it:
wsl --import <NewDistroName> <InstallLocation> <BackupFilePath>.tar
For example:
wsl --import PX4-Ubuntu-22.04-Restored D:\WSL\PX4-Ubuntu-22.04-Restored D:\Backups\PX4-Ubuntu-22.04.tar
Verify that the imported distribution appears in the list of available WSL distributions:
wsl -l -v
Start the restored distribution:
wsl -d <NewDistroName>