Skip to content

Mount Google Drive File System to WSL #2999

Closed

Description

@rjh336

Rich Turner (@bitcrazed) I plan to follow your recommended instructions to backup /home/<user> and installed packages from #2955.

However, I would like to compress the backup in a tar.gz archive per these instructions, and I would like to store that archive in my Google Drive File System (GDFS). My GDFS is located in my windows file system in the G: drive. However, when I try to view this drive, I am met with the following:

rjh336@LAPTOP-ETTS75F8:/mnt/g$ ls /mnt
c  d  g
rjh336@LAPTOP-ETTS75F8:/mnt/g$ cd /mnt/g
rjh336@LAPTOP-ETTS75F8:/mnt/g$ ls -la
ls: reading directory '.': Function not implemented
total 0

Upon trying to save an archive in that location, I see a similar error message:

rjh336@LAPTOP-ETTS75F8:~$ tar -cvpzf /mnt/g/backup.tar.gz --exclude=./test_src/exclude_folder ./test_src/
tar (child): /mnt/g/backup.tar.gz: Cannot open: Function not implemented
tar (child): Error is not recoverable: exiting now
./test_src/
./test_src/.folder_hidden/
./test_src/.folder_hidden/.hid_file
./test_src/.hidden
./test_src/file.txt
./test_src/folder_visible/

Is there a proper way to mount the Google File System from windows? Or perhaps a way to mount this drive directly on WSL? I checked the File system on G: and it says it is "FAT32". Any advice is greatly appreciated!

Activity

  1. therealkenc commented on Mar 6, 2018

    @therealkenc

    Variation on #2896 (VirtualBox additions shared folder) #2163 (WebDAV) #1962 (Windows NFS and/or Dokany) #579 (EXT2FSD). WSL DrvFS can only grok certain Windows filesystems presently.

  2. deven commented on Apr 16, 2018

    @deven

    I currently have Windows 10 build 16299. I installed Google Drive File Stream, and my Google Drive is visible as I: under Windows. When I launch a WSL bash shell, this is getting automatically mounted as "/mnt/i". While I also get the "Function not implemented" error, I have found that I can nevertheless change into subdirectories and read/write files via DrvFS to Google Drive, I can even do "ls -l" on a specific file without getting any errors.

    I just can't read directory entries, which obviously makes the filesystem a little difficult to use!

    Running strace shows that getdents() is the system call which is failing:

    openat(AT_FDCWD, ".", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
    getdents(3, 0x21f6890, 32768) = -1 ENOSYS (Function not implemented)

    If just this syscall could be fixed for the Google Drive File Stream filesystem, it might work perfectly.

  3. taylorpaul commented on Apr 24, 2018

    @taylorpaul

    I am encountering the same issue!

  4. YenForYang commented on May 3, 2018

    @YenForYang

    This issue is probably also similar to "ls: reading directory '.': Invalid argument (share mounted via drvfs) #1954"

    For me:

    richard@Richard-Works:/mnt$ ls
    ls: cannot access 'g': Invalid argument
    c  d  g  z
    --------------------------
    richard@Richard-Works:/mnt$ cd /mnt/g
    --------------------------
    richard@Richard-Works:/mnt/g$ ls
    ls: cannot open directory '.': Invalid argument
    --------------------------
    richard@Richard-Works:/mnt/g$ cd ..
    --------------------------
    richard@Richard-Works:/mnt$ sudo mount -t drvfs G: /mnt/g
    --------------------------
    richard@Richard-Works:/mnt$ cd g
    --------------------------
    richard@Richard-Works:/mnt/g$ ls
    ls: reading directory '.': Function not implemented
    
    

    Quoting Sven Groot (@SvenGroot) from that issue,

    All of these issues are caused by file systems that either do not support some of the functionality DrvFs is trying to use, or behave in unexpected ways. Officially, DrvFs currently support NTFS, ReFS, FAT, CDFS, and SMB.

    Which is unfortunate, as the list doesn't include FAT32, though this was in June last year.

  5. SvenGroot commented on May 3, 2018

    @SvenGroot
    Member

    YenForYang By FAT I meant the FAT driver in Windows. WSL definitely works with FAT32, and all the FAT variations Windows supports.

    I do expect this is another case where the Google Drive file system driver is missing some support or behaving in an unexpected way.

  6. jvallery commented on Jul 18, 2018

    @jvallery

    Any update on this? This would be killer if I could work with the files on my G Drive via WSL.

  7. bastiao commented on Oct 18, 2018

    @bastiao

    This will be really nice to have!

  8. h3xcat commented on Nov 20, 2018

    @h3xcat

    I found that if you share the drive over the network, you can mount the share from different computer and run commands within drive folders without problems. But I was unable to mount it using localhost, it knows that you're trying to mount the local drive and just mounts it as regular drive.

    Edit:
    I believe it's not working on localhost due to named pipes, and I don't think it's something you're normally able to disable without breaking all bunch of other things

  9. chris2crawford commented on Jan 20, 2019

    @chris2crawford

    Here is a way to mount GFS in WSL based on https://superuser.com/questions/1353169/getting-sshfs-working-on-wsl-or-finding-an-alternative The trick is to use https://www.nsoftware.com/sftp/netdrive/ to ssh to GFS from Windows and convert it to a filesystem that can be mounted under WSL.

    1. Install OpenSSH Server under Win10
      Win10 Settings -> Apps -> Manage optional features -> Add feature -> OpenSSH Server
      restart if necessary
      open Services -> OpenSSH -> Properties -> Startup Type -> Automatic (delayed)
    2. Install and run SFTPNetDrive, right click on icon in hidden icons -> Main window (or maybe already open) -> Profile -> new profile ( server: localhost, user: *** pwd:*** Drive Letter: F (or another)
      Advanced -> ( Protocol -> uncheck compression; Specified folder: G:\ ) )
    3. in Bash (wsl): sudo mkdir /mnt/f; sudo mount -t drvfs F: /mnt/f
      I'm not sure how stable it is, but I was able to open files in WSL.
  10. h3xcat commented on Feb 11, 2019

    @h3xcat

    I switched to RaiDrive, haven't gotten any problems yet. And upload speeds are way better than using Google File Stream.

  11. chris2crawford commented on Feb 23, 2019

    @chris2crawford

    from: Riyad Muradov

    1. Install RaiDrive, map your GDrive to a network drive.
    2. In the explorer, go to Network, you should find the network location named RaiDrive-username.
    3. In Bash, create a new directory and mount the network location:
      $ sudo mkdir /mnt/mydrive
      $ sudo mount -t drvfs '\RaiDrive-username' /mnt/mydrive

    I agree the performance is much better than SFTPNetDrive. I got the following error on the last command:

    mount: /mnt/mydrive: wrong fs type, bad option, bad superblock on \RaiDrive-crawf, missing codepage or helper program, or other error

    However, just using the windows drive worked fine:
    $ sudo mount -t drvfs Z: /mnt/mydrive

  12. katherinelauck commented on May 12, 2019

    @katherinelauck

    Just fixed the same exact thing on my own Win10/WSL Ubuntu with chris2crawford 's solution. I would prefer to access GFS directly because of its ability to cache files. Has anyone feature requested this to GFS?

  13. dos-gruut commented on Jun 6, 2019

    @dos-gruut

    Hi guys, I have a simple way to do this, even this way is not actually to mount the drive. But basically, you can read or write on it.

    I just wanted to copy a file from WSL into the Google Drive file stream. (For example, G: \ My drive \ hobby)
    So, I wrote a copy-to-drive.sh which contains just one line code below.

    cmd.exe --% /c copy 'C:\Users\dos\workspace\hobby\sample.txt' 'g:\My Drive\hobby'
    

    Yes, you can invoke the windows cmd on the WSL.
    I hope this can help you guys.

  14. therealkenc commented on Jun 6, 2019

    @therealkenc

    Yes, you can invoke the windows cmd on the WSL.

    With recent WSL you should be able to go the other direction too under powershell with something like:

    $ powershell.exe -Command "copy C:\\some\\path\\to\\file \\\\wsl$\\Ubuntu-18.04\\some\\directory"
    

    Another (similar in spirit) way to go would be set up ssh.exe on Windows and use scp.exe, or even go the other direction and set a sshd server on Windows. Whatever it takes so long as the file is being read/written on the Windows side and not going through WSL drvfs.

    It is also possible to use some nested IFS ideas as suggested earlier. Nothing wrong with that in principle, but going that way is stacking one (at least potential) path to failure upon another. If it "works" so much the better, but just be aware there are a lot of unknown/untested/unsupported moving parts involved going that route. Going through interop is at least in theory a solution that should work by design.

  15. Masterxilo commented on Jul 13, 2019

    @Masterxilo
  16. 75 remaining items

  17. Liryna commented on Sep 8, 2021

    @Liryna

    Vinh Nguyen (@vinhdizzo) could you share the exact command line you used to mount the drive ?

  18. vinhdizzo commented on Sep 8, 2021

    @vinhdizzo

    Liryna when I launch bash, the G drive is already mounted as /mnt/g, so I didn't need to mount. I could unmount and remount, and I get the following:

    $ sudo umount /mnt/g
    $ sudo umount g
    $ cd /mnt/g
    $ ls -lrtha
    ls: reading directory '.': Invalid argument
    total 0
    
  19. Liryna commented on Sep 8, 2021

    @Liryna

    Vinh Nguyen (@vinhdizzo) what happens if you try to mount by using the same commande line in other answers?

  20. vinhdizzo commented on Sep 8, 2021

    @vinhdizzo

    Liryna Here's what I get:

    $ sudo mount -t drvfs '\\localhost\G' /mnt/g
    mount: /mnt/g: special device \\localhost\G does not exist.
    $ sudo mount -t drvfs '\\192.168.1.123\G' /mnt/g
    mount: /mnt/g: special device \\192.168.1.123\G does not exist.
    $ sudo mount -t drvfs '\\192.168.1.123\G$' /mnt/g
    mount: /mnt/g: special device \\192.168.1.123\G$ does not exist.
    

    C drive is OK:

    sudo mount -t drvfs '\\192.168.1.123\c' /mnt/g
    

    That was the only command I saw in the thread that is based on Google Drive and not other third party tools. Did you want me to try anything else? Thanks!

  21. Liryna commented on Sep 8, 2021

    @Liryna

    Vinh Nguyen (@vinhdizzo) please give a try to:
    sudo mount -t drvfs G: /mnt/g

  22. vinhdizzo commented on Sep 8, 2021

    @vinhdizzo

    Liryna sorry I did try that first but forgot to paste it. This is what I get:

    $ sudo mount -t drvfs G: /mnt/g
    $ cd /mnt/g
    $ ls
    ls: reading directory '.': Invalid argument
    
  23. sudeshjethoe commented on Sep 29, 2022

    @sudeshjethoe

    this works for me, but sometimes it helps to unmount first, e.g. umount /mnt/g (as root ofcourse)

  24. pgwilliams commented on Oct 31, 2022

    @pgwilliams

    I've no idea when this started working (it wasn't the last time I checked - perhaps 6 months ago) but today it's working fine. Within my WSL Ubuntu I navigated to /mnt/ and there was my G drive (mapped as G:), and from there I went to /mnt/g/My Drive/ and all my files were there as expected. Happy Customer 😄 👍

  25. ilsaloving commented on Dec 6, 2022

    @ilsaloving

    This only works for your personal documents. If you want to use a Shared Drive, it is completely inaccessible. In fact, it is unusable from anything other than explorer. I tried several different tools in addition to WSL, and they all either displayed nothing, or just a .lnk to some inaccessible location.

  26. chris2crawford commented on Dec 6, 2022

    @chris2crawford
  27. mujina93 commented on Jan 10, 2023

    @mujina93

    Just want to signal: I updated WSL from v1 to v2. Before, when I fired up the Google Drive app, I found G: automatically mounted at /mnt/g (this allowed me for example to right click > open windows terminal with wsl in any folder within G:).

    Now, with WSL2, it doesn't work anymore.

    Mounting manually with sudo mount -t drvfs G: /mnt/g works, but downgrading from "it works out of the box" to having to having to do things manually is a bit annoying.

  28. steinbergnet commented on Jan 21, 2023

    @steinbergnet
  29. literakl commented on Jan 21, 2023

    @literakl

    I have used Debian to search files on G drive successfully but suddenly it stopped working. Tried Google drive restart without luck:

    literakl@DESKTOP-590U5T0:/$ ls -l /mnt/
    ls: cannot access '/mnt/g': Invalid argument
    ls: cannot access '/mnt/l': Invalid argument
    total 0
    drwxrwxrwx 1 literakl literakl 512 Jan 14 09:11 c
    d????????? ? ? ? ? ? g

    Edice Windows 10 Home
    Verze 22H2
    Datum instalace ‎30.‎11.‎2022
    Build operačního systému 19045.2486
    Výkon Windows Feature Experience Pack 120.2212.4190.0

  30. microsoft-github-policy-service commented on Feb 1, 2024

    @microsoft-github-policy-service
    Contributor

    This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

    Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions