Mount EXT4 with WSL2 on Windows

Steps to Mount an ext4 Partition in WSL2

1. Open PowerShell

  • Press Win + X and select Windows PowerShell or Windows Terminal.

2. List Disks

Run the following command to list all disks:

Get-Disk

3. Identify the Partition

List the partitions on your disks:

Get-Partition

This will display all partitions, including their sizes and types. Look for the ext4 partition you want to access.

4. Unmount the Partition in Windows

If the partition is currently mounted in Windows (i.e., has a drive letter), unmount it:

  1. Press Win + X and select Disk Management.
  2. Right-click on the ext4 partition.
  3. Select Change Drive Letter and Paths.
  4. Click Remove to unassign the drive letter.

5. Mount the Partition in WSL2

Open PowerShell as Administrator and run:

wsl --mount \.\PHYSICALDRIVE# --partition #

Replace # with the appropriate disk and partition numbers.

Example: If your ext4 partition is on PHYSICALDRIVE2 and it's the first partition:

wsl --mount \.\PHYSICALDRIVE2 --partition 1

6. Access the Mounted Filesystem

Open your WSL2 terminal and navigate to the mounted filesystem. It’s typically located under /mnt/.

7. Unmount the Filesystem

When you're finished, unmount the filesystem using:

wsl --unmount \.\PHYSICALDRIVE#