You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: WSL/compare-versions.md
+50-14Lines changed: 50 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Comparing WSL 2 and WSL 1
3
-
description: Compare version 1 and version 2 of the Windows Subsystem for Linux. Learn whats new in WSL 2 - actual Linux kernel, faster speed, full system call compatibility. WSL 1 works better if your storing files across operating file systems. You can expand the size of your WSL 2 Virtual Hardware Disk (VHD).
description: Compare version 1 and version 2 of the Windows Subsystem for Linux. Learn whats new in WSL 2 - actual Linux kernel, faster speed, full system call compatibility. WSL 1 works better if your storing files across operating file systems. You can expand the size of your WSL 2 Virtual Hard Disk (VHD).
WSL 2 distributions currently cannot reach IPv6-only addresses. We are working on adding this feature.
157
157
158
-
## Expanding the size of your WSL 2 Virtual Hardware Disk
158
+
## Expanding the size of your WSL 2 Virtual Hard Disk
159
159
160
-
WSL 2 uses a Virtual Hardware Disk (VHD) to store your Linux files. If you reach its max size you may need to expand it.
160
+
WSL 2 uses a Virtual Hard Disk (VHD) to store your Linux files. In WSL 2, a VHD is represented on your Windows hard drive as a *.vhdx* file.
161
161
162
-
The WSL 2 VHD uses the ext4 file system. This VHD automatically resizes to meet your storage needs and has an initial maximum size of 256GB. If your distribution grows in size to be greater than 256GB, you will see errors stating that you've run out of disk space. You can fix this error by expanding the VHD size.
162
+
The WSL 2 VHD uses the ext4 file system. This VHD automatically resizes to meet your storage needs and has an initial maximum size of 256GB. If the storage space required by your Linux files exceeds this size you may need to expand it. If your distribution grows in size to be greater than 256GB, you will see errors stating that you've run out of disk space. You can fix this error by expanding the VHD size.
163
163
164
164
To expand your maximum VHD size beyond 256GB:
165
165
@@ -174,18 +174,54 @@ To expand your maximum VHD size beyond 256GB:
174
174
175
175
4. Resize your WSL 2 VHD by completing the following commands:
176
176
- Open Windows Command Prompt with admin privileges and enter:
177
-
-`diskpart`
178
-
-`Select vdisk file="<pathToVHD>"`
179
-
-`expand vdisk maximum="<sizeInMegaBytes>"`
177
+
178
+
```powershell
179
+
diskpart
180
+
DISKPART> Select vdisk file="<pathToVHD>"
181
+
DISKPART> detail vdisk
182
+
```
183
+
184
+
- Examine the output of the **detail** command. The output will include a value for **Virtual size**. This is the current maximum. Convert this value to megabytes. The new value after resizing must be greater than this value. For example, if the **detail** output shows **Virtual size: 256 GB**, then you must specify a value greater than **256000**. Once you have your new size in megabytes, enter the following command in **diskpart**:
185
+
186
+
```powershell
187
+
DISKPART> expand vdisk maximum=<sizeInMegaBytes>
188
+
```
189
+
190
+
- Exit **diskpart**
191
+
192
+
```powershell
193
+
DISKPART> exit
194
+
```
180
195
181
196
5. Launch your WSL distribution (Ubuntu, for example).
182
197
183
-
6. Make WSL aware that it can expand its file system's size by running these commands from your Linux distribution command line:
184
-
-`sudo mount -t devtmpfs none /dev`
185
-
-`mount | grep ext4`
186
-
- Copy the name of this entry, which will look like: `/dev/sdXX` (with the X representing any other character)
187
-
-`sudo resize2fs /dev/sdXX`
188
-
- Use the value you copied earlier. You may also need to install resize2fs: `apt install resize2fs`
198
+
6. Make WSL aware that it can expand its file system's size by running these commands from your Linux distribution command line.
199
+
200
+
> [!NOTE]
201
+
> You may see this message in response to the first **mount** command: **/dev: none already mounted on /dev**. This message can safely be ignored.
202
+
203
+
```powershell
204
+
sudo mount -t devtmpfs none /dev
205
+
mount | grep ext4
206
+
```
207
+
208
+
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**:
209
+
210
+
```powershell
211
+
sudo resize2fs /dev/sdb <sizeInMegabytes>M
212
+
```
213
+
214
+
> [!NOTE]
215
+
> You may need to install **resize2fs**. If so, you can use this command to install it: `sudo apt install resize2fs`.
216
+
217
+
The output will look similar to the following:
218
+
219
+
```bash
220
+
resize2fs 1.44.1 (24-Mar-2018)
221
+
Filesystem at /dev/sdb is mounted on /; on-line resizing required
222
+
old_desc_blocks = 32, new_desc_blocks = 38
223
+
The filesystem on /dev/sdb is now 78643200 (4k) blocks long.
224
+
```
189
225
190
226
> [!NOTE]
191
227
> In general do not modify, move, or access the WSL related files located inside of your AppData folder using Windows tools or editors. Doing so could cause your Linux distribution to become corrupted.
0 commit comments