如何使用 WSL 从 Windows 中具有 Ubuntu 文件系统的硬盘复制粘贴文件?

如何使用 WSL 从 Windows 中具有 Ubuntu 文件系统的硬盘复制粘贴文件?

我有一个固态硬盘我在其中安装了 Ubuntu 20.04。但我无法再使用 SSD。更多详细信息请见此处:Ubuntu 冻结(即使在实时会话中)

现在我买了一个SATA 转 USB A 线缆。现在,如何使用 WSL 将文件从 SSD 复制粘贴到我的 Windows 10 笔记本电脑?

我正在尝试这些说明:https://docs.microsoft.com/en-gb/windows/wsl/wsl2-mount-disk

wsl --mount <DiskPath>没有作用。

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.

答案1

在撰写本文时,--mount仅适用于 Windows 11 WSL 版本。

现在,随着申请材料WSL 1.0.0 版本,此功能也适用于更新的 Windows 10 版本。这需要具有 UBR(更新版本修订版)2311或更高版本的 Windows 10。目前可通过选项更新 KB5020030

您可以使用以下命令从 PowerShell 确认您的 UBR:

(Get-ComputerInfo).WindowsUBR

请记住,这仅适用于 Windows 10。 全部Windows 11 上的 WSL 版本支持该--mount命令。

更新 Windows 后,安装最新的 Windows Subsystem for Linux 应用程序包来自 Microsoft Store。如果您无法使用 Microsoft Store,请使用这个答案

安装最新的 WSL 后,请使用以下命令确认:

wsl --version

wsl --help还应显示该--mount选项可用。

相关内容