# 在 WSL 中掛載 windows 檔案系統 根據 [WSL 跨文件系統配置](https://learn.microsoft.com/en-us/windows/wsl/wsl-config) 介紹中 [Automount Settings](https://learn.microsoft.com/en-us/windows/wsl/wsl-config#automount-settings)章節的描述,WSL 會自動將 windows 檔案系統通過 DrfFS 檔案系統掛載到 /mnt 路徑下。 如需將 windows 檔案系統挂載到 WSL 的指定位置,首先需要停用自動掛載:編輯 /etc/wsl.conf 檔案,添加以下内容: ```txt [automount] enabled=false ``` 然後,在 /etc/fstab 檔案中配置掛載: ```txt C: /mnt/c drvfs errors=remount-ro 0 1 F: /path/to/mount/point drvfs defaults,uid=<loginuid>,gid=<logingid> 0 0 ``` > 注意需要挂在 C 盤符到 /mnt/c ,權限設置參考 Ubuntu 中的 fstab,否則 WSL 啓動時會報錯;然後掛載指定的盤符到指定的掛載點,權限設置參考[鳥哥的 Linux 私房菜 14.1.3 實作 Quota 流程-1:檔案系統的支援與觀察(/etc/fstab, /etc/mtab)章節](https://linux.vbird.org/linux_basic/centos7/0420quota.php#quota_flow_1) 修改完 /etc/fstab 後,務必要驗證一下!若有發生錯誤得要趕緊處理! ```shell= # umount /mnt/c # umount /mnt/f # mount -a $ df -h |grep mnt/c drvfs 500G 100G 400G 25% /mnt/c $ df -h |grep home drvfs 151G 98M 151G 1% /path/to/mount/point ``` 以後再啓動 WSL,就以上面的配置掛載 windows 檔案系統了。
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up