Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

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

Writer Matthew Martinez

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.

3

1 Answer

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

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy