=========================================================================
First sorry about my English, hope you can understand it! Press
$ Windows + S
to open search, then type feature, select Turn Windows features on or off
Check the Windows Subsystem for Linux option. Check the Vitual machine platform option. Click OK, dont restart
Press
$ Windows + X then $ A
to open powershell as admin, then type:
$ Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
Restart, then open powershell as admin again, then type:
$ choco install --force lxrunoffline
Restart, then open powershell as admin again, then type:
$ wsl --set-default-version 2
Download bZImage and paste to C:\Users :
$ https://github.com/nathanchance/WSL2-Linux-Kernel/releases
In your user folder (me C:\Users\LeCmnGend), create text file and rename to **.wslconfig **
Open it and paste (wsl config option you can search in google), save and close: (case sensitive C is different with c, if user name like: some One, you have to replace exactly some One (someOne or some one not work)
$ [wsl2]
kernel = C:\\Users\\bzImage
processors=16
memory=10.4GB
swap=10GB
swapFile=C:\\Users\\<your-user>\\swap.vhdx
localhostForwarding=true
Open store then install Ubuntu, then type to pws to check version:
$ wsl -l -v
Mine show:
$
NAME STATE VERSION
* Ubuntu Running 2
================================================
Type:
$ Windows + R
then type cmd , Ctrl + shift + enter , to run as admin, it should show:
$ C:\Windows\system32>
then type:
$ whoami
it should show something \ <your_user> , then type:
$
icacls E:\WSL2 /grant "LeCmnGend:(OI)(CI)(F)"
lxrunoffline move -n Ubuntu -d E:\WSL2
It should show ext4.vdhx in E:\wsl folder (mean success)
==========================================
Turn off ubuntu first: (pws admin):
$ wsl --shutdown
Open cmd admin then type: (for me 299GB is enough, set this value by yours)
$
diskpart
select vdisk file="E:\WSL2\ext4.vhdx"
detail vdisk
expand vdisk maximum=299000
Now check again:
$
detail vdisk
exit
Mine show Virtual size: 291 GB , Close cmd.
$
sudo mount -t devtmpfs none /dev
mount | grep ext4
You may see this message in response to the first mount command: "/dev: none already mounted on /dev."
This message can safely be ignored.
Copy the name of this entry, which will look like:
$ /dev/sdX
(with the X representing any other character). In the following example the value of X is b : Then type
$
sudo resize2fs /dev/sdb <sizeInMegabytes>M
The output should show similar:
$
resize2fs 1.44.1 (24-Mar-2021)
Filesystem at /dev/sdb is mounted on /; on-line resizing required
old_desc_blocks = 32, new_desc_blocks = 38
The filesystem on /dev/sdb is now 78643200 (4k) blocks long.
Create a network drive Z for easy to track linux dir:
Open this PC , right click to the space, select Add a network location , click next , click on choose a .. then next Then type:
$
\\wsl$\Ubuntu
Ensure you are ticked all, in a both ssd and hdd disk like me