<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Oluwatamilore Olugbesan]]></title><description><![CDATA[Oluwatamilore Olugbesan]]></description><link>https://tamilore.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Mon, 31 Aug 2026 08:49:47 GMT</lastBuildDate><atom:link href="https://tamilore.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How to Transfer Your WSL 2 Ubuntu Distro to a New Device]]></title><description><![CDATA[If you are a fan of Ubuntu and you want to move your existing distro to a new device, you might be wondering how to do it without losing your data and settings. In this blog post, I will show you how to export and import your Ubuntu distro using Wind...]]></description><link>https://tamilore.hashnode.dev/how-to-transfer-your-wsl-2-ubuntu-distro-to-a-new-device</link><guid isPermaLink="true">https://tamilore.hashnode.dev/how-to-transfer-your-wsl-2-ubuntu-distro-to-a-new-device</guid><category><![CDATA[wsl2]]></category><category><![CDATA[Ubuntu]]></category><category><![CDATA[wsl ubuntu]]></category><category><![CDATA[Linux]]></category><category><![CDATA[software development]]></category><dc:creator><![CDATA[Oluwatamilore Olugbesan]]></dc:creator><pubDate>Sat, 09 Dec 2023 05:29:13 GMT</pubDate><content:encoded><![CDATA[<p>If you are a fan of Ubuntu and you want to move your existing distro to a new device, you might be wondering how to do it without losing your data and settings. In this blog post, I will show you how to export and import your Ubuntu distro using Windows Subsystem for Linux, <strong>specifically</strong> (WSL) version 2.</p>
<p>Before we start, make sure you have WSL version 2 installed embedded and enabled on both your old and new devices. You can check your WSL version by opening PowerShell as an administrator and running the command:</p>
<p><code>wsl --list --verbose</code></p>
<p>If you see version 2 under the STATE column, you are good to go. If not, refer to a different article. WSL 1 does not support the import/export functionality.</p>
<h3 id="heading-step-1-export-your-ubuntu-distro">Step 1: Export Your Ubuntu Distro</h3>
<p>On your old device, open PowerShell as an administrator and run the following command to shut down any running instances of your Ubuntu distro:</p>
<p><code>wsl --shutdown</code></p>
<p>Then, run the following command to export your Ubuntu distro to a tar file:</p>
<p><code>wsl --export &lt;DistributionName&gt; &lt;FilePath&gt;</code></p>
<p>Replace <code>&lt;DistributionName&gt;</code> with the name of your Ubuntu distro (you can find it by running wsl --list) and <code>&lt;FilePath&gt;</code> is the full path to the destination location for your tar file. For example: hello</p>
<p><code>wsl --export Ubuntu C:\Users\Alice\ubuntu-backup.tar</code></p>
<p>This will create a tar file named ubuntu-backup.tar in the C:\Users\Alice folder. You can choose any name and location for your tar file, but make sure it has enough space to store your distro.</p>
<hr />
<h3 id="heading-step-2-transfer-your-tar-file">Step 2: Transfer Your Tar File</h3>
<p>Now that you have exported your Ubuntu distro, you need to transfer it to your new device. You can use any method you prefer, such as a USB drive, cloud storage, or network sharing. Just make sure you copy the tar file to a location that is accessible from your new device.</p>
<hr />
<h3 id="heading-step-3-import-your-ubuntu-distro">Step 3: Import Your Ubuntu Distro</h3>
<p>On your new device, open PowerShell as an administrator and run the following command to import your Ubuntu distro from the tar file:</p>
<p><code>wsl --import &lt;DistributionName&gt; &lt;InstallLocation&gt; &lt;PathToYourUbuntuExport&gt;</code></p>
<p>Replace <code>&lt;DistributionName&gt;</code> with the name you want to give to your imported Ubuntu distro (it can be different from the original name), <code>&lt;InstallLocation&gt;</code> with the directory where you want to install the distro (preferably create a new folder in the current drive), and <code>&lt;PathToYourUbuntuExport&gt;</code> with the full path to the tar file. For example:</p>
<p><code>wsl --import Ubuntu-old C:\WSL\Ubuntu-old C:\Users\Alice\ubuntu-backup.tar</code></p>
<p>This will create a new WSL distribution named Ubuntu-old in the C:\WSL\Ubuntu-old folder. <strong><em>Note:</em></strong> You can choose any name and location for your imported distro, but ensure they are not already used by another WSL distribution.</p>
<hr />
<h3 id="heading-step-4-set-your-imported-ubuntu-distro-as-default">Step 4: Set Your Imported Ubuntu Distro as Default</h3>
<p>To use your imported Ubuntu distro, you need to set it as the default WSL distribution. You can do this by running the following command in powershell:</p>
<p><code>wsl.exe -d &lt;DistributionName&gt;</code></p>
<p>Replace <code>&lt;DistributionName&gt;</code> with the name of your imported Ubuntu distro. For example:</p>
<p><code>wsl.exe -d Ubuntu-old</code></p>
<p>This will launch your imported Ubuntu distro in PowerShell. You can also use Visual Studio Code or the Ubuntu app to access your imported distro.</p>
<p><strong><em>Note:</em></strong> You might find yourself logged in as the root user when you launch your imported distro. Use <code>su &lt;Username&gt;</code> to login to any user that was on the imported distro. Replace <code>&lt;UserName&gt;</code> with the actual username.</p>
<p><strong><em>optional settings:</em></strong><br />If you wish to set a user as the default user in your imported distro</p>
<p>The current <a target="_blank" href="https://docs.microsoft.com/en-us/windows/wsl/wsl-config#user-settings">Microsoft recommended</a> way of setting the default username in an instance is to create a <code>/etc/wsl.conf</code> or append to the already existing file, the following setting:</p>
<pre><code class="lang-plaintext">[user]
default=&lt;username&gt;
</code></pre>
<p><code>&lt;username&gt;</code> to be your selected default username.</p>
<p>Exit your distro/instance, then issue a <code>wsl --terminate &lt;distroname&gt;</code> from PowerShell or CMD. When you restart, the default user should be set.</p>
<p>This is safer and less error-prone than the registry-based methods.</p>
<p>If the optional setting doesn't work, other methods including this one were gotten from <a target="_blank" href="https://superuser.com/questions/1566022/how-to-set-default-user-for-manually-installed-wsl-distro/1627461#1627461">here</a></p>
<hr />
<p>That's it! You have successfully transferred your Ubuntu distro to a new device. Enjoy!</p>
]]></content:encoded></item></channel></rss>