如何在 Windows 10 WSL 中的 ext4 分区上挂载 Ubuntu /home 目录?

Aur*_*mas 5 ubuntu windows-subsystem-for-linux

我想将实际的 Ubuntu/home目录(该目录位于我的驱动器上的 ext4 分区上)挂载到 WSL。

基本上,我需要那里的一切,并且我希望与 ext4 和一些工具有更好的兼容性。另请参阅此问题,了解在现有 WSL Ubuntu 目录中编辑文件时出现的一些问题示例/home

是否可以?如何?

Ast*_*ara 0

使用 Samba 导出您的主分区并将其安装在 Windows 中(我就是这样做的)。

为了澄清,如果您不想安装/home到驱动器,请创建 /home一个符号链接\\yourmachine\home(假设您已将主驱动器导出为/home)。

例如,我/Documents指向//Bliss/Documents
Under cygwin+bash,我看到(在我的根目录中):Documents -> //Bliss/Documents/

在 Windows 中,使用dir,该文件如下所示:<SYMLINKD> Documents [\\Bliss\Documents]
(Bliss 是我的服务器的名称)。

在 Windows 中,我通过 cd'ing 到 root 在 root 中创建它,然后:(
来自 bash - 注意 Windows 路径名周围的单引号和反斜杠)

cmd /c mklink /d Documents '\\Bliss\Documents'
Run Code Online (Sandbox Code Playgroud)