Score:0

Mounting my PC Box network drive onto wsl2 with drvfs works manually but not in /etc/fstab

ae flag

I want to mount a Box drive onto wsl2 so that I can access the same locally/cloud synced files on two different systems (windows and linux). Box is a FAT32 file system, which I believe is supported by drvfs mount.

I can mount it just fine if I mount it from the .bashrc file using the following mount command:

sudo mount -t drvfs 'C:\Users\Jakda\Box' /mnt/box

I can then access /mnt/box via a symbolic link in my home directory.

The problem with this is I have to enter in my sudo password every time I open a WSL terminal, something I can't always do.

I've put this line in /etc/fstab

'C:\Users\Jakda\Box'    /mnt/box        drvfs     defaults     0       0

and when I run mount -a I get:

<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

I've been trying this for a while now and I don't know what to do.

hr flag
I'd try omitting the quotes, and replacing backslashes by their octal equivalent `\134`
Aaron Earle-Richardson avatar
ae flag
omg that was it thank you
hr flag
... if it worked, I guess I should add it as an answer
Score:1
hr flag

Processing of the /etc/fstab file in Linux is done by a function getmntent. According to its manual page:

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.

(by far the most commonly used of these is \040 for the space character - tabs and newlines, while legal in Linux pathnames, are rarely used in practice).

So remove the quotes and replace the backslashes by their octal escapes \134:

C:\134Users\134Jakda\134Box    /mnt/box        drvfs     defaults     0       0
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.