当前位置: 首页 > news >正文

工程师 - Windows下使用WSL来访问本地的Linux文件系统

Access Linux filesystems in Windows and WSL 2
从 Windows Insiders 预览版构建 20211 开始,WSL 2 将提供一项新功能:wsl --mount。这一新参数允许在 WSL 2 中连接并挂载物理磁盘,从而使您能够访问 Windows 本身不支持的文件系统(如 ext4)。
Starting with Windows Insiders preview build 20211, WSL 2 will be offering a new feature: wsl --mount. This new parameter allows a physical disk to be attached and mounted inside WSL 2, which enables you to access filesystems that aren’t natively supported by Windows (such as ext4).
因此,如果你使用不同的磁盘进行 Windows 和 Linux 双启动,现在就可以从 Windows 访问 Linux 文件了!
So, if you’re dual booting with Windows & Linux using different disks, you can now access your Linux files from Windows!
Getting started
要挂载磁盘,请打开具有管理员权限的 PowerShell 窗口并运行:
To mount a disk, open a PowerShell window with administrator privileges and run:
wsl --mount <DiskPath>
要在 Windows 中列出可用磁盘,请运行:
To list the available disks in Windows, run:
wmic diskdrive list brief
要从 WSL 2 中卸载和分离磁盘,请运行:
To unmount and detach the disk from WSL 2, run
wsl --unmount <Diskpath>
磁盘路径可在 “DeviceID ”列中找到。通常是 \.\.\PHYSICALDRIVE* 格式。下面是一个将特定硬盘分区挂载到 WSL 并浏览其文件的示例。
The disks paths are available under the ‘DeviceID’ columns. Usually under the \\.\\\.\PHYSICALDRIVE* format. Below is an example of mounting a specific partition of a given hard disk into WSL and browsing its files.
Accessing these files with File Explorer
挂载后,也可以通过 Windows 资源管理器访问这些磁盘,方法是导航到\\wsl$,然后导航到挂载文件夹。
Once mounted, it’s also possible to access these disks through the Windows explorer by navigating to \\wsl$ and then to the mount folder.
Limitations
默认情况下,wsl --mount 会尝试将磁盘挂载为 ext4。要指定文件系统,或了解更多高级方案,请查看"在 WSL 2 中挂载磁盘"。
By default, wsl --mount attempts to mount the disk as ext4. To specify a filesystem, or for more advanced scenarios, check out Mount a disk in WSL 2.
另外请注意,此功能有一个限制,即只能将物理磁盘连接到 WSL 2。目前还无法附加单个分区。有关限制的更多详情,请点击此处。
Also please note that this feature comes with the limitation that only physical disks can be attached to WSL 2. At this time, it’s not possible to attach a single partition. More details on the limitations here.
参考;
Access Linux filesystems in Windows and WSL 2 - Windows Command Line (microsoft.com)
http://www.lryc.cn/news/448957.html

相关文章:

  • SQL高可用优化-优化SQL中distinct和Where条件对索引字段进行非空检查语句
  • openharmony源码编译
  • H.264编解码工具 - NVIDIA CUDA
  • 数学建模小练习
  • Java爬虫:获取SKU详细信息的艺术
  • 心理咨询展示网站建设渠道拓展
  • naocs注册中心,配置管理,openfeign在idea中实现模块间的调用,getway的使用
  • 先进封装技术 Part02---TSV科普
  • 【数据挖掘】2023年 Quiz 1-3 整理 带答案
  • 老古董Lisp实用主义入门教程(12):白日梦先生的白日梦
  • UE5 Windows热更新解决方案思路(HotPatcher+Tomcat+RuntimeFilesDownloader)
  • 进程管理工具:非daemon进程管理工具supervisor
  • c++模拟真人鼠标轨迹算法
  • android12/13/14版本wms最新面试题:dumpsys window和sf一定会一致么?
  • Python脚本示例,你可以使用这个脚本来自动化登录网站、选择页面元素和提交表单
  • 安卓13设置动态修改设置显示版本号 版本号增加信息显示 android13增加序列号
  • 从 Oracle 集群到单节点环境(详细记录一次数据迁移过程)之三:在目标服务器上恢复数据
  • 相互作用感知的 3D 分子生成 VAE 模型 - DeepICL 评测
  • Java实现随机抽奖的方法有哪些
  • grafana加载缓慢解决方案
  • 【湖南步联科技身份证】 身份证读取与酒店收银系统源码整合———未来之窗行业应用跨平台架构
  • 多路复用和事件轮询机制
  • Android常用C++特性之std::abs
  • LabVIEW提高开发效率技巧----使用状态机架构
  • Feign:服务挂了也不会走fallback
  • 网络编程操作—函数
  • 博客摘录「 GD32的flash读、擦除、写操作」2024年9月2日
  • 【性能优化】低配starRocks常驻内存优化
  • 科研绘图系列:R语言树结构聚类热图(cluster heatmap)
  • 微信小程序操作蓝牙