在 WSL 中为 Linux 挂载磁盘
If you want to access a Linux disk format that isn't supported by Windows, you can use WSL 2 to mount your disk and access its content. This tutorial will cover the steps to identify the disk and partition to attach to WSL2, how to mount them, and how to access them.
If you are connecting an external drive and do not have success with these mounting instructions, you may want to try the instructions to Connect USB devices. The wsl --mount
command does not currently support USB/flash drives/SD card readers, (learn more about this issue).
[!NOTE] Administrator access is required to attach a disk to WSL 2. The WSL 2
mount
command does not support mounting a disk (or partitions that belong to the disk) that is currently in use.wsl --mount
always attaches the entire disk even if only a partition is requested. You can't mount the Windows installation disk.
Prerequisites
You will need to be on Windows 11 Build 22000 or later, or be running the Microsoft Store version of WSL. To check your WSL and Windows version, use the command: wsl.exe --version