Results 1 to 7 of 7

Thread: How do I transfer my files to google drive mount via terminal, Ubuntu 19.04

  1. #1
    Join Date
    Sep 2019
    Beans
    12

    How do I transfer my files to google drive mount via terminal, Ubuntu 19.04

    Under SettingsOnline Accounts I am able to connect my gmail account, which allows me to mount my google drive as a network drive. The path of the mount was found by opening a terminal within the mount window. It is given by:
    /run/user/1000/gvfs/google-drive:host=gmail.com,user=gmail_user_name


    I am trying to write a crontab background process which syncs specified folders from my home directory every so often. I do so by using the following bash script to transfer specified directories into the mounted network drive.

    Code:
    #!/bin/bash
    googledrive_dir=/run/user/1000/gvfs/google-drive:host=gmail.com,user=gmail_user_name
    dir_cat='Admin'
    
    for name in $dir_cat
    do
        rsync -avhz ~/$name $googledrive_dir/--delete
    done
    
    
    Upon running the bash script, the files inside the directories within each specified folder in dir_cat are deleted. And I get an output error, shown below:


    Code:
    sending incremental file list
    rsync: failed to set times on "/run/user/1000/gvfs/google-drive:host=gmail.com,user=google_user_name/Admin":Operation not supported (95)
    deleting Admin/19sZNc-h9o1u65ZT5ANXyKXgQVEzU92Th
    Admin/
    Admin/cubicle_name_tag.odt
    rsync: mkstemp "/run/user/1000/gvfs/google-drive:host=gmail.com,user=google_user_name/Admin/.cubicle_name_tag.odt.Que9bQ" failed:Operation not supported (95)
    
    sent 11.68K bytes  received 377 bytes  3.44K bytes/sec
    total size is 13.12K  speedup is 1.09
    rsync error: some files/attrs were not transferred (see previous errors)(code 23) at main.c(1207)[sender=3.1.3]
    
    
    
    I found that by replacing the '-a' with '-r', rsync first deletes all the contents in the specified folders before copying over the files. This process is time consuming and computationally wasteful.

    How should I go about this?


  2. #2
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: How do I transfer my files to google drive mount via terminal, Ubuntu 19.04

    I don't use cloudy storage, except my own storage 100% owned by me. Don't know a thing about box, google, msft, amazon or any other cloudy storage, but ....

    rsync -avz [source] [target]
    is the normal command I use for this. However, if both the source and target appear to be local, then rsync assumes that just doing the copy is faster than performing the block-by-block comparison. You can tell rsync to use timestamps and file sizes over just copying everything for local-to-local copies. The rsync manpage has those options.

    There are rsync options to delete-before and delete-after and files that have been removed from the source that are still in the target too.

    GVFS is just about the slowest remote storage protocol out there, except, perhaps sshfs.
    https://ubuntuforums.org/showthread.php?t=2337462 is where people complain about poor performance too. Looks like they use the web interface to get the best performance. https://www.omgubuntu.co.uk/2017/04/...camlfuse-linux is a different FUSE option which might be faster? IDK.

  3. #3
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Re: How do I transfer my files to google drive mount via terminal, Ubuntu 19.04

    rsync: failed to set times on "/run/user/1000/gvfs/google-drive:host=gmail.com,user=google_user_name/Admin":Operation not supported (95)
    deleting Admin/19sZNc-h9o1u65ZT5ANXyKXgQVEzU92Th
    This happens when the remote device doesn't support standard *nix protocols. It's possible the Google drive is formatted with NTFS or some other filesystem.

    Using the -a switch will overwrite any files that have changed and leave untouched those which have not been changed. Unfortunately for you, since the modification times on the remote drive are not available to rsync, it has to transfer all the files again.

    One kludgy solution to this problem is to use tar to create a compressed archive of the files you want to back up and transfer the tar archive.

    Code:
    cd /
    tar czpf Admin.tgz Admin
    rsync -avz Admin.tgz /run/user/1000/gvfs/google-drive:host=gmail.com,user=gmail_user_name
    Maybe some version of that will work for you.

    You might want to create versioned archives with filenames that include dates like
    Code:
    tar czpf Admin-$(date +%Y%m%d).tgz Admin
    I keep five backups and delete the oldest one every day.
    Code:
    rm -f /path/to/archive/dir/Admin-$(date +%y%m%d --date='5 days ago').tgz
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  4. #4
    Join Date
    Oct 2010
    Location
    The United States
    Beans
    843
    Distro
    Ubuntu

    Re: How do I transfer my files to google drive mount via terminal, Ubuntu 19.04

    I may have misunderstood something, but if you want to move files to Google Drive couldn't you connect to Google as an online account and move files locally?
    I am running Ubuntu 18.04 with Gnome shell. I connected to Google as an offline account. When I look in:

    Code:
    /run/user/1000/gvfs
    I see both my Google Drive and my NAS which I mount as a Samba share. I can move files to and from the gvfs folders via the terminal.

    OOPS I guess I did not read the first post carefully enough.
    Last edited by GrouchyGaijin; September 17th, 2019 at 08:22 PM. Reason: Did not read well enough
    Thank you,
    GG -----------

  5. #5
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: How do I transfer my files to google drive mount via terminal, Ubuntu 19.04

    As soon as there is a "gvfs" in the path, it will be slow. That applies to local storage or remote storage.

    Almost always, the performance solution to this is to do anything you can to avoid GVFS in the access for any storage. That usually means simply avoid making the initial access using a GUI. I like to say "use real mounts" for storage. That usually means there are 3 viable options.
    1. /etc/fstab
    2. sudo mount ..... on a command line or in a script
    3. autofs - which effectively uses the same mount as the fstab method

    None of those have GUI equivalents. Each has pros/cons. All also require the correct disk/access driver be loaded. For google-drive, it appears the ocamlfuse driver is needed? IDK. I found some articles saying there is a PPA for this driver, but none of the links are to sites I know as reputable. YMMV.

    The Gnome project was trying to fix the gvfs performance issues the last year, but I've not seen anything other than vague announcements they were going to do something. No results announced that I've seen. https://www.phoronix.com/scan.php?pa....33.1-Released was the last I found.
    Last edited by TheFu; September 18th, 2019 at 02:56 PM.

  6. #6
    Join Date
    Sep 2019
    Beans
    12

    Re: How do I transfer my files to google drive mount via terminal, Ubuntu 19.04

    Awesome, thanks for the advice. Will check ocamlfuse out, thanks for the recommendation!

  7. #7
    Join Date
    Sep 2019
    Beans
    12

    Re: How do I transfer my files to google drive mount via terminal, Ubuntu 19.04

    UPDATE: google-drive-ocamlfuse works brilliantly with rsync -azv --delete source destination.
    Thanks for the reccomendations!!

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •