1
0
mirror of https://github.com/avinal/avinal.github.io.git synced 2026-07-04 07:40:09 +05:30

fix markdown error and 404

This commit is contained in:
2022-09-14 21:38:20 +05:30
parent f15f4b825f
commit 2a66c43f5e
9 changed files with 89 additions and 110 deletions
+23 -23
View File
@@ -1,12 +1,12 @@
---
title: Move WSL 2 Safely to another Drive
date: 2020-12-31 19:07
tags: wsl, wsl2
tags: [wsl, wsl2]
category: development
description: It is real pain when you have small SSD and Windows Subsystem for Linux
description: 'It is real pain when you have small SSD and Windows Subsystem for Linux
(WSL) is growing exponentially in size. There is no easy way to move the
WSL installation to another drive. Here in this blog I will discuss how
to tackle this problem with bite size steps.
to tackle this problem with bite size steps.'
---
# Move WSL 2 Safely to another Drive
@@ -28,9 +28,9 @@ to tackle this problem with bite size steps.
2. Check if the WSL 2 installation you are planning to move is is
currently running/stopped.
``` powershell
PS C:\Users\Avinal> wsl -l -v
PS C:\Users\Avinal>
```powershell
PS C:\\Users\\Avinal> wsl -l -v
PS C:\\Users\\Avinal>
NAME STATE VERSION
* Ubuntu Running 2
Kali Stopped 2
@@ -39,42 +39,42 @@ to tackle this problem with bite size steps.
3. If its running then you must stop the particular WSL distribution.
(*Ubuntu* used as example)
``` powershell
PS C:\Users\Avinal> wsl -t Ubuntu
```powershell
PS C:\\Users\\Avinal> wsl -t Ubuntu
```
4. Export to some folder. (Here exporting *Ubuntu* as *ubuntu-ex.tar*
to *Z:wsl2*)
``` powershell
PS C:\Users\Avinal> wsl --export Ubuntu "Z:\export\ubuntu-ex.tar"
```powershell
PS C:\\Users\\Avinal> wsl --export Ubuntu "Z:\\export\\ubuntu-ex.tar"
```
5. Unregister previous WSL installation
``` powershell
PS C:\Users\Avinal> wsl --unregister Ubuntu
```powershell
PS C:\\Users\\Avinal> wsl --unregister Ubuntu
```
6. Create a new folder and import your WSL installation to that folder.
``` powershell
PS C:\Users\Avinal> New-Item -Path "Z:\wsl2" -ItemType Directory
```powershell
PS C:\\Users\\Avinal> New-Item -Path "Z:\\wsl2" -ItemType Directory
Directory: Z:\
Directory: Z:\\
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 31-12-2020 21:03 wsl2
PS C:\Users\Avinal> wsl --import Ubuntu "Z:\wsl2" "Z:\export\ubuntu-ex.tar"
PS C:\\Users\\Avinal> wsl --import Ubuntu "Z:\\wsl2" "Z:\\export\\ubuntu-ex.tar"
```
7. Check after import is complete
``` powershell
PS C:\Users\Avinal> wsl -l -v
PS C:\Users\Avinal>
```powershell
PS C:\\Users\\Avinal> wsl -l -v
PS C:\\Users\\Avinal>
NAME STATE VERSION
* Ubuntu Running 2
Kali Stopped 2
@@ -82,16 +82,16 @@ PS C:\Users\Avinal>
8. Mark one of your WSL distribution as *(default)*.
``` powershell
PS C:\Users\Avinal> wsl -s Ubuntu
```powershell
PS C:\\Users\\Avinal> wsl -s Ubuntu
```
9. After exporting your default user will be set as
<i style="color:red">root</i> , to change it to your desired
username, run following command
``` powershell
PS C:\Users\Avinal> ubuntu config --default-user user_name
```powershell
PS C:\\Users\\Avinal> ubuntu config --default-user user_name
```
10. Finally run `wsl` and you have successfully moved your WSL 2