
我想將 Box 磁碟機安裝到 wsl2 上,以便我可以在兩個不同的系統(Windows 和 Linux)上存取相同的本機/雲端同步檔案。 Box是FAT32檔案系統,我相信drvfs掛載支援它。
如果使用以下掛載命令從 .bashrc 檔案掛載它,我就可以很好地掛載它:
sudo mount -t drvfs 'C:\Users\Jakda\Box' /mnt/box
然後我可以透過主目錄中的符號連結存取 /mnt/box。
問題是每次打開 WSL 終端機時我都必須輸入 sudo 密碼,但我不能總是這樣做。
我已經把這一行放入/etc/fstab
'C:\Users\Jakda\Box' /mnt/box drvfs defaults 0 0
當我跑步時mount -a
我得到:
<4>WARNING: mount: waiting for virtio device...
<3>init: (110) ERROR: MountPlan9WithRetry:285: mount drvfsa on /mnt/box (cache=mmap,rw,msize=262144,trans=virtio,aname=drvfs;path='C:\Users\Jakda\Box';symlinkroot=/mnt/) failed: 2
mount: No such file or directory
我已經嘗試這個有一段時間了,但我不知道該怎麼辦。
答案1
Linux 中檔案的處理/etc/fstab
是由函數完成的getmntent
。根據其手冊頁:
GETMNTENT(3) Linux Programmer's Manual GETMNTENT(3)
.
.
.
DESCRIPTION
These routines are used to access the filesystem description file
/etc/fstab and the mounted filesystem description file /etc/mtab.
.
.
.
Since fields in the mtab and fstab files are separated by whitespace,
octal escapes are used to represent the characters space (\040), tab
(\011), newline (\012), and backslash (\\) in those files when they oc‐
cur in one of the four strings in a mntent structure. The routines ad‐
dmntent() and getmntent() will convert from string representation to
escaped representation and back. When converting from escaped repre‐
sentation, the sequence \134 is also converted to a backslash.
(到目前為止,最常用的是\040
空格字元——製表符和換行符,雖然在 Linux 路徑名中是合法的,但在實踐中很少使用)。
因此,刪除引號並用八進制轉義符替換反斜線\134
:
C:\134Users\134Jakda\134Box /mnt/box drvfs defaults 0 0