wsl 没有 --mount 选项。那么如何使用 wsl 挂载驱动器呢?

Dic*_*ick 5 mount windows-10 windows-subsystem-for-linux

我在这里关注教程:https://docs.microsoft.com/en-us/windows/wsl/wsl2-mount-disk

我可以通过运行以下命令来获取驱动器列表:GET-CimInstance -query "SELECT * from Win32_DiskDrive"它会产生以下输出:

PS C:\WINDOWS\system32> GET-CimInstance -query "SELECT * from Win32_DiskDrive"

DeviceID           Caption                           Partitions Size         Model
--------           -------                           ---------- ----         -----
\\.\PHYSICALDRIVE0 SK hynix SC311 SATA 512GB         3          512105932800 SK hynix SC311 SATA 512GB
\\.\PHYSICALDRIVE1 Generic STORAGE DEVICE USB Device 0                       Generic STORAGE DEVICE USB Device
\\.\PHYSICALDRIVE2 Generic STORAGE DEVICE USB Device 3          127861977600 Generic STORAGE DEVICE USB Device
\\.\PHYSICALDRIVE3 Generic STORAGE DEVICE USB Device 0                       Generic STORAGE DEVICE USB Device
Run Code Online (Sandbox Code Playgroud)

我认为我尝试安装的驱动器是\\.\PHYSICALDRIVE2我尝试安装的 128GB SD 卡。

但是,当我尝试运行此命令时:wsl --mount \\.\PHYSICALDRIVE2我收到以下错误,指出没有--mount选项:

Invalid command line option: --mount
Copyright (c) Microsoft Corporation. All rights reserved.

Usage: wsl.exe [Argument] [Options...] [CommandLine]

Arguments for running Linux binaries:

    If no command line is provided, wsl.exe launches the default shell.

    --exec, -e <CommandLine>
        Execute the specified command without using the default Linux shell.

    --
        Pass the remaining command line as is.

Options:
    --cd <Directory>
        Sets the specified directory as the current working directory.
        If ~ is used the Linux user's home path will be used. If the path begins
        with a / character, it will be interpreted as an absolute Linux path.
        Otherwise, the value must be an absolute Windows path.

    --distribution, -d <Distro>
        Run the specified distribution.

    --user, -u <UserName>
        Run as the specified user.

Arguments for managing Windows Subsystem for Linux:

    --help
        Display usage information.

    --install [Options]
        Install additional Windows Subsystem for Linux distributions.
        For a list of valid distributions, use 'wsl --list --online'.

        Options:
            --distribution, -d [Argument]
                Downloads and installs a distribution by name.

                Arguments:
                    A valid distribution name (not case sensitive).

                Examples:
                    wsl --install -d Ubuntu
                    wsl --install --distribution Debian

    --set-default-version <Version>
        Changes the default install version for new distributions.

    --shutdown
        Immediately terminates all running distributions and the WSL 2
        lightweight utility virtual machine.

    --status
        Show the status of Windows Subsystem for Linux.

    --update [Options]
        If no options are specified, the WSL 2 kernel will be updated
        to the latest version.

        Options:
            --rollback
                Revert to the previous version of the WSL 2 kernel.

Arguments for managing distributions in Windows Subsystem for Linux:

    --export <Distro> <FileName>
        Exports the distribution to a tar file.
        The filename can be - for standard output.

    --import <Distro> <InstallLocation> <FileName> [Options]
        Imports the specified tar file as a new distribution.
        The filename can be - for standard input.

        Options:
            --version <Version>
                Specifies the version to use for the new distribution.

    --list, -l [Options]
        Lists distributions.

        Options:
            --all
                List all distributions, including distributions that are
                currently being installed or uninstalled.

            --running
                List only distributions that are currently running.

            --quiet, -q
                Only show distribution names.

            --verbose, -v
                Show detailed information about all distributions.

            --online, -o
                Displays a list of available distributions for install with 'wsl --install'.

    --set-default, -s <Distro>
        Sets the distribution as the default.

    --set-version <Distro> <Version>
        Changes the version of the specified distribution.

    --terminate, -t <Distro>
        Terminates the specified distribution.

    --unregister <Distro>
        Unregisters the distribution and deletes the root filesystem.
Run Code Online (Sandbox Code Playgroud)

我使用的 WSL 版本:

PS C:\WINDOWS\system32> wsl -l -v
  NAME      STATE           VERSION
* Ubuntu    Stopped         2
Run Code Online (Sandbox Code Playgroud)

如何使用 wsl 正确安装驱动器?

Dan*_*l B 2

你不\xe2\x80\x99t。根据微软页面:

\n
\n

先决条件

\n

您需要使用 Windows 11 Build 22000 或更高版本才能访问此功能。您可以加入 Windows 预览体验成员计划来获取最新的预览版本。

\n
\n

在此之前,请使用 \xe2\x80\x9creal\xe2\x80\x9d VM。因为Hyper-V在这方面也很不足,所以我建议研究VirtualBox和VMware Player(或者Workstation,如果你有太多钱的话)。

\n

  • 请注意,微软文档在这个特定主题上有点误导。Build 22000 是第一个普遍可用(*非*预览版)的 Windows 11 版本。因此,任何“已发布”的 Win 11 版本都具有此功能。不再需要预览/内部版本。 (3认同)