• DevOps
  • How To's
  • How to Export and Import Your Linux Systems on Windows 10

    In this article we will guide you on how to backup or export Windows Linux Subsystem in windows 10 and let you export intalled linux environment like ubuntu,kali or any linux distribution and also we will guide you how to import to other pc or workstation this will served as a clone copy of the WSL.

    1. To export/backup a Linux System open a PowerShell and run wsl command.

    To list the distros installed, run the following command:

    wsl --list

    2. Run the  following command to export a distro’s file system to a TAR file:

    wsl --export distro_name file_name.tar

    3. To export out Ubuntu 18.04 system to a file named Ubuntu-18.04.tar, we’d run:

    wsl --export Ubuntu-18.04 Ubuntu-18.04.tar

    You now have a TAR file containing the Linux distribution’s file system. My backup size around 4.79GB in size since i have pre-isntalled DevOps tools already and some repository. If you’ve installed more software in your distribution, it will be larger.

    How to Import (Restore) a Linux System

    You can use the wsl command with the –import option to import a TAR file created in this way. From a PowerShell or Command Prompt window, run the following command

    wsl --import distro_name install_location file_name.tar

    For example, let’s say you want to import a distro from a TAR file located at C:\Users\Chris\ubuntu.tar, call it “Ubuntu-18.04,” and store it at C:\Users\Chris\ubuntu. You’d run:

    wsl --import Ubuntu-18.04 C:\Users\Chris\ubuntu C:\Users\Chris\ubuntu.tar

    If you want to match where Windows normally installs them to by default, they’re in their own folder in C:\Users\NAME\AppData\Local\Packages.

    For example, you might want to put Ubuntu

    in C:\Users\NAME\AppData\Local\Packages\Ubuntu.

    Wherever you put the install location, note that you shouldn’t modify the files directly from Windows tools. Here’s how you should access the files in File Explorer instead.

    How to unregister or delete a Linux System

    You can uninstall a distro with the –unregister option along with its name. This will result in all the Linux distribution’s files being deleted.

    Use the following command to see all installed distributions:

    wsl --list

    Then, specify the distribution you want to delete:

    wsl --unregister distro_name

    For example, if it’s called Ubuntu-18.04, you’d run:

    wsl --unregister Ubuntu-18.04

    This feature also lets you quickly and easily move installed distributions to another folder or drive. Just export the distro to a TAR file, unregister it from your system, and then import the TAR file to another location on your system.

    Leave a Reply

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

    3 mins