メインコンテンツ

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

  1. List the available WSL distributions and identify the distribution name:

    wsl -l -v
  2. Shut down WSL before exporting the distribution:

    wsl --shutdown
  3. Export 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
  4. Verify that the backup file was created successfully:

    Get-Item <BackupFilePath>.tar

Restore a WSL Distribution

  1. 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
  2. Verify that the imported distribution appears in the list of available WSL distributions:

    wsl -l -v
  3. Start the restored distribution:

    wsl -d <NewDistroName>

See Also