LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 08-10-2014, 01:22 AM   #1
DaneM
Member
 
Registered: Oct 2003
Location: Chico, CA, USA
Distribution: Linux Mint
Posts: 881

Rep: Reputation: 130Reputation: 130
[HOWTO] rsync with Google Drive


Edit: This HOWTO is now available on the LQ Wiki! Please check it out here: http://wiki.linuxquestions.org/wiki/...h_Google_Drive

Hi, folks.

DISCLAIMER: Uploading to a cloud storage system implies that you trust the maintainers of that system and everyone in-between to not mess with/read your data. If this is a concern for you, but you want to upload to Google Drive, anyway, please consider using some of the encryption methods mentioned here (or another encryption method of your choosing): http://how-to.linuxcareer.com/using-...ages-and-files
Thanks to mostlyharmless for the tips!

It took me a while to find a good, simple, reliable way to backup my stuff to Google drive, using rsync; so I've decided to share my method with the good people at LQ. In short, the answer is to use "gsync" (NOT "grsync", which is different and broken/incomplete). It supports (so far as I can tell) ALL the same options as rsync (glee!), and lets you do it with Google Drive! You can upload to, and download from GD in this way, by picking which to use as SOURCE/DESTINATION folders.

First, go here and follow the installation instructions:
https://github.com/iwonbigbro/gsync/...ter/README.rst

DO NOT NEGLECT THE BIT ABOUT AUTHENTICATING!! If you do, none of the gsync stuff, below, will work!

For reference, here's the command I use to backup my stuff between my LOCAL hard drives--from "/mnt/PERSONAL/" to "/mnt/PERSONAL2":

Code:
sudo rsync -c -r -t -p -o -g -v --progress --delete -l -s /mnt/PERSONAL/ /mnt/PERSONAL2
You can check what the options do using "man rsync." I don't always use the "-c" option, since it's slow (but more thorough for checking the data). This command will delete files that are missing from the destination, and overwrite duplicates. Use with care! Note the trailing slash on the source folder; this is important! A trailing slash on the source folder means to copy the stuff IN the folder to the destination. No slash means to copy the folder, itself, to the destination. The destination folder ignores trailing slashes. (Thanks to suicidaleggroll for this clarification.)

The "gsync" version is this--from "/mnt/PERSONAL/Dane/IMPORTANTSTUFF" to "drive://IMPORTANTSTUFF":

Code:
sudo gsync -c -r -t -p -o -g -v --progress --delete -l -s /mnt/PERSONAL/Dane/IMPORTANTSTUFF/ drive://IMPORTANTSTUFF
Please note that you should probably not upload an entire 1TB+ drive to GD unless you have and want to use up all that storage space on the cloud. Therefore, I've specified the subdirectory of "/mnt/PERSONAL/Dane/IMPORTANTSTUFF" to represent the important files/folders that I absolutely have to have backed-up remotely. You'll need to run a separate command for each folder (including subdirectories) that you want to upload in this fashion; make sure to change both the source and destination in the command when you do. (I haven't yet figured out how to do them all as a batch job, short of writing a script for it.) Also, I use root (sudo) for this and the rsync command because it helps manage permissions properly--but if you're certain that the current user/login owns all the files involved, you don't need it (and probably shoudn't use it, as a general security/safety precaution).

Finally, if you want to be able to walk away from it and know how long it actually took when you come back, you can prepend the "time" command to the beginning of the gsync or rsync command, like so:

Code:
sudo time gsync -c -r -t -p -o -g -v --progress --delete -l -s /mnt/PERSONAL/Dane/IMPORTANTSTUFF/ drive://IMPORTANTSTUFF
Enjoy!

--Dane

Last edited by DaneM; 08-13-2014 at 02:53 PM. Reason: Added disclaimer, corrected trailing slash info.
 
Old 08-11-2014, 02:51 PM   #2
mostlyharmless
Senior Member
 
Registered: Jan 2008
Distribution: Arch/Manjaro, might try Slackware again
Posts: 1,851
Blog Entries: 14

Rep: Reputation: 284Reputation: 284Reputation: 284
Very helpful for many people without doubt, perhaps you should also point out that you are relying on data protection/privacy on Google. You might want to consider an optional pipe through encryption.
 
Old 08-11-2014, 03:15 PM   #3
DaneM
Member
 
Registered: Oct 2003
Location: Chico, CA, USA
Distribution: Linux Mint
Posts: 881

Original Poster
Rep: Reputation: 130Reputation: 130
Thanks for your kind words, mostlyharmless. I like your suggestion about encryption. I haven't messed with that very much; what would you suggest?

I've always found gpg to be a bit too...arcane...for quick-and-dirty encryption, and I've lost my private key a couple of times (partly due to not knowing where it's stored); so I'm hesitant to use any kind of encryption whose key/password I can't just remember. I know it's not as secure as a 128-bit string, but I'm sure it's a lot better than nothing.

Last edited by DaneM; 08-11-2014 at 03:17 PM.
 
1 members found this post helpful.
Old 08-12-2014, 07:53 AM   #4
mostlyharmless
Senior Member
 
Registered: Jan 2008
Distribution: Arch/Manjaro, might try Slackware again
Posts: 1,851
Blog Entries: 14

Rep: Reputation: 284Reputation: 284Reputation: 284
Well, there's always a balance between securing data and being able to retrieve it isn't there? I've lost data by misplacing/losing a GPG key too. Maybe something simpler using OpenSSL, as in the examples here:

http://how-to.linuxcareer.com/using-...ages-and-files

Even if not, just a disclaimer about it would be good.
 
1 members found this post helpful.
Old 08-12-2014, 10:27 AM   #5
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Quote:
Originally Posted by DaneM View Post
Note the trailing slash on the source folder, but NOT the destination folder; this is important! Please see the man page (or a Linux/Unix web page on rsync) for what the trailing slashes do/don't do.
The trailing slash is only important on the source, it makes no difference on the destination.
 
1 members found this post helpful.
Old 08-12-2014, 01:04 PM   #6
DaneM
Member
 
Registered: Oct 2003
Location: Chico, CA, USA
Distribution: Linux Mint
Posts: 881

Original Poster
Rep: Reputation: 130Reputation: 130
mostlyharmless: Added disclaimer and link. Thanks for the info! This looks VERY useful.

suicidaleggroll: Corrected info about trailing slashes. Thanks for clarifying!

--Dane
 
Old 08-12-2014, 01:30 PM   #7
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Nice HOWTO.
Problem is that the forums are not really the best place for it, would be nice if you could add it to the LQ Wiki or make a LQ Article from it.
 
Old 08-12-2014, 02:26 PM   #8
DaneM
Member
 
Registered: Oct 2003
Location: Chico, CA, USA
Distribution: Linux Mint
Posts: 881

Original Poster
Rep: Reputation: 130Reputation: 130
I haven't done that, before. Where do I go?
 
Old 08-13-2014, 05:19 AM   #9
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
You can find the LQ Wiki on the right side in the main menu. For work in the Wiki you have to create a new user (you can take your current username), after that just create your article in the appropriate section.
 
1 members found this post helpful.
Old 08-13-2014, 02:31 PM   #10
DaneM
Member
 
Registered: Oct 2003
Location: Chico, CA, USA
Distribution: Linux Mint
Posts: 881

Original Poster
Rep: Reputation: 130Reputation: 130
Thanks, TobiSGD.
 
Old 08-13-2014, 02:53 PM   #11
DaneM
Member
 
Registered: Oct 2003
Location: Chico, CA, USA
Distribution: Linux Mint
Posts: 881

Original Poster
Rep: Reputation: 130Reputation: 130
Posted!

http://wiki.linuxquestions.org/wiki/...h_Google_Drive
 
Old 08-13-2014, 03:57 PM   #12
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Thanks for contributing!
 
Old 11-20-2014, 08:45 PM   #13
vonedaddy
Member
 
Registered: Aug 2004
Location: Philadelphia,PA
Posts: 185

Rep: Reputation: 17
This is great, thanks!

I am having a small issue. It seems all the directory structure is being created but non of the actual files. I am using all the same options you are using.

gsync -t -i -r -p -o -g -v --progress --delete -l -s /vault/ drive://

Any ideas?

If I stop it, I get:

Interrupted
sent 0 bytes received 0 bytes 0.00 bytes/sec

Last edited by vonedaddy; 11-20-2014 at 08:47 PM.
 
Old 11-20-2014, 08:58 PM   #14
vonedaddy
Member
 
Registered: Aug 2004
Location: Philadelphia,PA
Posts: 185

Rep: Reputation: 17
Found a fix here:

https://github.com/iwonbigbro/gsync/issues/69

Quote:

body = {}
for k, v in properties.iteritems():
body[k] = _Drive.utf8(v)
...to:

body = {}
for k, v in properties.iteritems():
if v is not None:
body[k] = _Drive.utf8(v)
...solves the problem, per #66.

It does, however, produce this when it runs into a file that ends in a ~ character:

Monsters/Lvl. 3 - Undead Horrid Housecat~
0 0% 0.00B/s 0:00:00DEBUG: 'Exception': File "/usr/local/lib/python2.7/dist-packages/libgsync/drive/__init__.py", line 712, in update
status, res = req.next_chunk()
File "/usr/local/lib/python2.7/dist-packages/oauth2client/util.py", line 132, in positional_wrapper
return wrapped(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/apiclient/http.py", line 874, in next_chunk
return self._process_response(resp, content)
File "/usr/local/lib/python2.7/dist-packages/apiclient/http.py", line 901, in _process_response
raise HttpError(resp, content, uri=self.uri)
 
Old 11-21-2014, 11:12 PM   #15
DaneM
Member
 
Registered: Oct 2003
Location: Chico, CA, USA
Distribution: Linux Mint
Posts: 881

Original Poster
Rep: Reputation: 130Reputation: 130
I posted that fix (based on a post elsewhere). :-)

The program is, however, experiencing a more serious bug: its app authentication key is the same one used for everyone using the program. This is normal for Google-interfacing applications, but there's a data transfer limit on any one key. This means that, once all the gsync users have exceeded that limit, then nobody can use gsync, anymore, until the quota resets. There's an open bug about it, but I don't know if it's being worked on, currently. It's really unfortunate, because I love gsync's functionality.

Good luck!

--Dane
 
  


Reply

Tags
backup, cloud storage, google drive, gsync, rsync



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] HowTo? Make rsync copy file names but not contents haertig Linux - Software 2 07-12-2014 04:05 PM
LXer: Google Adds Your Google Drive Files To SERPs LXer Syndicated Linux News 0 10-16-2012 01:40 PM
What does Google Apps moving to google drive mean to us? dougnc Linux - General 11 09-13-2012 01:58 PM
Rsync'd my entire drive to an external drive, grub-installed and FAILED to load GUI rootaccess Linux - General 1 03-15-2012 01:09 PM
LXer: Ubuntu, Google, and the Future of Linux. And rsync too. LXer Syndicated Linux News 0 11-27-2009 11:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration