Skip to content

Commit 6842d33

Browse files
committed
Update Presentation.md and README.md
1 parent ad5c770 commit 6842d33

File tree

2 files changed

+164
-4
lines changed

2 files changed

+164
-4
lines changed

Presentation.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ paginate: true
44
color: #ffff
55
backgroundColor: #2A2A2A
66
header: '![width:100px height:100px](./img/logo.png)'
7-
footer: "**XX/XX/2022 - Nicolas F && Anthony F**"
7+
footer: "**03/04/2022 - Nicolas F && Anthony F**"
88
author: Xen0rInspire && Tony2464
99
---
1010
<style>

README.md

+163-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,23 @@
55
![WSL-Logo](/img/logo-wsl.png)
66
__________
77

8+
- [Windows Subsystem for Linux (known as WSL)](#windows-subsystem-for-linux-known-as-wsl)
9+
- [What is the WSL and how it works ?](#what-is-the-wsl-and-how-it-works-)
10+
- [WSL is not a virtual machine !](#wsl-is-not-a-virtual-machine-)
11+
- [WSL 1 vs WSL 2](#wsl-1-vs-wsl-2)
12+
- [The limits of WSL](#the-limits-of-wsl)
13+
- [Install WSL on Windows](#install-wsl-on-windows)
14+
- [Requirements](#requirements)
15+
- [Download WSL](#download-wsl)
16+
- [WSL distributions available at this time](#wsl-distributions-available-at-this-time)
17+
- [Some useful WSL features](#some-useful-wsl-features)
18+
- [Mount an EXT file system on Windows (or other filesystem)](#mount-an-ext-file-system-on-windows-or-other-filesystem)
19+
- [Mount an entire disk](#mount-an-entire-disk)
20+
- [Mount a partition from a disk](#mount-a-partition-from-a-disk)
21+
- [Add a desktop environment to your WSL](#add-a-desktop-environment-to-your-wsl)
22+
- [Some useful commands](#some-useful-commands)
23+
- [Appendix - Sources and References](#appendix---sources-and-references)
24+
825
## What is the WSL and how it works ?
926

1027
The WSL for **W**indows **S**ubsystem for **L**inux is a compatibility layer developed by Microsoft for running Linux binaries natively (ELF format) in a console environment on Windows 10 and Windows 11. This ingenious technology provides a Linux-compatible kernel interface and can interact directly with the Windows operating system with performances very close to a native Linux distribution. Moreover, it allows a user to choose a Linux distribution to install directly from the Microsoft Store (more info in below).
@@ -109,11 +126,23 @@ At this moment (when this article was written), you can install these distributi
109126

110127
You can install the distribution you want directly on the Windows Store !
111128

129+
Or you can install it via a console with the command :
130+
131+
``` PowerShell
132+
wsl --install --distribution DistribName
133+
```
134+
112135
## Some useful WSL features
113136

114-
### Mount an ext file system on Windows (non-persistent)
137+
### Mount an EXT file system on Windows (or other filesystem)
138+
139+
First, you must be running Windows 11 Build 22000 or higher and have admin privileges. This procedure only works on the WSL 2 and it is non-peristent, the filesystem will be unmounted after WSL shutdown.
115140

116-
First, you must be running Windows 11 Build 22000 or higher and have admin privileges. This procedure only works on the WSL 2.
141+
#### Mount an entire disk
142+
143+
To mount an entire disk, we first need to identify the physical disk.
144+
145+
In a windows console :
117146

118147
``` Powershell
119148
GET-CimInstance -query "SELECT * from Win32_DiskDrive"
@@ -123,13 +152,142 @@ This command should return a list of physical drives in this format :
123152

124153
`\\.\PHYSICALDRIVEX` X : number of the physical drive
125154

155+
Then we can mount it with the command :
156+
157+
``` Powershell
158+
wsl --mount \\.\PHYSICALDRIVEX
159+
```
160+
161+
> Default filesystem is ext4, we can specify the type of filesystem with the argument `t`. We can list the available filesystem with `cat /proc/filesystems`
162+
163+
The mounted disk should be now accessible via the Explorer in `\\wsl$\Distro\mnt\PHYSICALDRIVEX`
164+
165+
Or directly in the distro used : `/mnt/PHYSICALDRIVEX`
166+
167+
#### Mount a partition from a disk
168+
169+
To mount only a partition from a disk, we first need to identify the physical disk as before.
170+
In a windows console :
171+
172+
``` Powershell
173+
GET-CimInstance -query "SELECT * from Win32_DiskDrive"
174+
```
175+
176+
Then mount the physcial disk :
177+
126178
``` Powershell
127-
wsl --mount DiskPath
179+
wsl --mount \\.\PHYSICALDRIVEX
180+
```
181+
182+
Now we are going to list the available partitions with :
183+
184+
```Bash
185+
lsblk
186+
```
187+
188+
It should return something like this :
189+
190+
```Text
191+
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
192+
sdb 8:16 0 1G 0 disk
193+
├─sdb2 8:18 0 50M 0 part
194+
├─sdb3 8:19 0 873M 0 part
195+
└─sdb1 8:17 0 100M 0 part
196+
sdc 8:32 0 256G 0 disk /
197+
sda 8:0 0 256G 0 disk
198+
```
199+
200+
We can now mount the partition we want by specifying only the number of the partition. For instance if it's `sdb1`, we specify `1` :
201+
202+
```PowerShell
203+
wsl --mount \\.\PHYSICALDRIVEX --partition 1 --type <Filesystem>
128204
```
129205

130206
### Add a desktop environment to your WSL
131207

132208
This procedure only works on the WSL 2.
209+
WSL 2 allows us to run linux applications with GUI by default.
210+
211+
You could run a complete desktop environnement but we need a X server.
212+
There are plenty of tutos about that.
213+
214+
[X11 server with Xfce](https://www.youtube.com/watch?v=8SuERIEJJUA)
215+
216+
If you are in the kali team, they have built a nice tool called Win-KeX which provides a Kali Desktop Experience for WSL 2.
217+
218+
In the kali console you can install the tool with :
219+
220+
```Bash
221+
sudo apt install -y kali-win-kex
222+
```
223+
224+
To launch it in Window mode with sound support :
225+
226+
```Bash
227+
kex --win -s
228+
```
229+
230+
To launch it in Enhanced Session Mode :
231+
232+
```Bash
233+
kex --esm --ip -s
234+
```
235+
236+
### Some useful commands
237+
238+
Update WSL :
239+
240+
```Powershell
241+
wsl --update
242+
```
243+
244+
Stop WSL :
245+
246+
```Powershell
247+
wsl --shutdown
248+
```
249+
250+
Delete a distro :
251+
252+
```Powershell
253+
wsl --unregister Dstro
254+
```
255+
256+
Export a distro (Backup) :
257+
258+
```Powershell
259+
wsl --export distro filename.tar
260+
```
261+
262+
Import a distro (Restore) :
263+
264+
```Powershell
265+
wsl --import distro install_location filename.tar
266+
```
267+
268+
List distros and version :
269+
270+
```Powershell
271+
wsl -l -v
272+
```
273+
274+
List available distros to install :
275+
276+
```Powershell
277+
wsl --list --online
278+
```
279+
280+
Set WSL default version to 2 :
281+
282+
```Powershell
283+
wsl --set-default-version 2
284+
```
285+
286+
Set WSL default version to 2 :
287+
288+
```Powershell
289+
wsl --set-default-version 2
290+
```
133291

134292
## Appendix - Sources and References
135293

@@ -151,6 +309,8 @@ https://www.howtogeek.com/426749/how-to-access-your-linux-wsl-files-in-windows-1
151309

152310
https://www.it-connect.fr/wsl-comment-acceder-aux-fichiers-linux-depuis-windows-10/
153311

312+
https://www.kali.org/docs/wsl/win-kex/
313+
154314
<br>
155315

156316
**Official GitHub repositories of the WSL project :**

0 commit comments

Comments
 (0)