V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
hellos
V2EX  ›  Windows

请问 WSL 怎样取消(自动)挂载 Windows 系统中的分区?

  •  
  •   hellos · Jul 10, 2020 · 3488 views
    This topic created in 2129 days ago, the information mentioned may be changed or developed.

    打开 WSL 后,Windows 中的 C 盘 D 盘等是自动挂载到 /mnt 下的,当使用 find 、grep 等命令的时候,会去 Windows 下查找文件,有没有方法取消挂载呢? 我试过 umount 但是并没有什么效果,会提示 umount: /mnt/d: not mounted.

    hellos
        2
    hellos  
    OP
       Jul 10, 2020
    @codehz 多谢。
    tolerance
        3
    tolerance  
       Jul 10, 2020   ❤️ 1
    搜一下 find 、grep 排除指定目录
    hellos
        4
    hellos  
    OP
       Jul 10, 2020
    @tolerance 谢谢,这样也不错,而且 find 中有个-mount 参数,可以直接过滤挂载的磁盘
    murmur
        5
    murmur  
       Jul 10, 2020
    我在 wsl1 里也遇到了这个问题,是 npm 找到了 windows 版的 npm,然后各种出错

    我尝试了各种解除 mount 的方式无果,最后在脚本里加了自动从环境变量删掉 windows 目录的代码
    hellos
        6
    hellos  
    OP
       Jul 11, 2020
    @murmur 用 1 楼方法可以不自动挂载,但是只是不自动挂载 C 、D,其他分区( E 、F )还是会挂载
    hellos
        7
    hellos  
    OP
       Jul 11, 2020
    @hellos 更正:所有的分区都不挂载
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1823 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 42ms · UTC 16:17 · PVG 00:17 · LAX 09:17 · JFK 12:17
    ♥ Do have faith in what you're doing.