4

I am using ubuntu app inside of windows 10. I can access most of windows files using bash. The windows documents are inside of /mnt/c. Thats ok.

I can access "Google Drive" folder in Command Prompt (cmd.exe) with entering G: command in Windows 10. (Google Drive Commercial, drive file stream) It is also ok. My question is

Is there any way to access "Google Drive" folder using bash?

Attempt 1:

I made a shortcut of "Google Drive" folder in Windows' desktop. I open the bash, and write cd /mnt/c/Users/Taygun Bulmus/Desktop. But it is not a directory.

Related questions:

how to read sh files on Ubuntu built in Windows 10 developer mode,

Windows Linux Subsystem - Accessing Files outside of Ubuntu

EDIT 1:

It is still open issue for wsl community (17/03/2020):

Mount Google Drive File System to WSL #2999

Taygun Bulmuş
  • 113
  • 1
  • 8

5 Answers5

3

This works now:

On WSL 2, Windows 20H2 (set to German), Google Drive Version 47.0.19.0

windows@DESKTOP-I608RI4:/mnt/g/Meine Ablage/Data$ echo hello > hello-cr.txt
windows@DESKTOP-I608RI4:/mnt/g/Meine Ablage/Data$ ls
masterxilo
  • 2,503
  • 1
  • 30
  • 35
  • 1
    Yep, I do the same, however when some time passes (I talk about days), for some reason that I do not know, Google drive restarts or updates (or so I think) which closes the link between WSL and Google drive, and I must restart WSL, do you think of some way to reestablish the link without restarting WSL? – Cristian Rodríguez Jul 03 '22 at 00:46
  • Additionally, I have tried to create a soft link from Windows but this is inherited to Ubuntu then the same if it is restarted (or whatever) GD it is dismantled in WSL and the link stops working in WSL – Cristian Rodríguez Jul 03 '22 at 00:54
3

I don't if you're experiencing the exact same issue, but I know my mount works properly for a while and then doesn't work anymore from the WSL only. An ls command revealed this beauty: Cannot add an embedded picture yet

Following this post I remounted the drive and everything seems to work now :) the command was:

sudo mount -t drvfs G: /mnt/g
  • thank you! My scenario was that Drive would work for a while, then if I closed WSL and put the computer to sleep, then tried to open WSL again and access my drive, it would give the error "'/mnt/g': Invalid argument" when trying to cd into Drive. – john_m_kenny Apr 12 '23 at 11:18
  • This works for mounting, but everything is owned by root. How can I get around this? – JoshB Jul 10 '23 at 10:13
1

Unfortunately, there is not any solution for google drive for commercial use: "Drive File Stream" (see this REF). For personal use, you can specify a folder that you can access from bash.

Open bash,

cd /mnt/c/[%Your Synced Google Drive Folder%]
Taygun Bulmuş
  • 113
  • 1
  • 8
0

For access folder use command: cd /mnt/<drive>/address_folder'

Wemerson Nino
  • 109
  • 2
  • 4
0

go to C:\Windows\System32 and create a shortcut of wsl.exe. Then you can change the "start in" property of the shortcut to your drive path and voilà.

Dharman
  • 30,962
  • 25
  • 85
  • 135