I got the idea to make a backup of the VPS server on CentOS 7 in a Google drive, it’s not to be wasted 15 gigs of free space. I searched a bit and found a couple of articles on this topic, the topic was not new, and at first I put the utility from the good corporation itself, here is an article on this topic
Backing up a Directory for Google Drive on CentOS 7 .
But this does not suit me, as there is a script that runs on a schedule, and in it I decided to check the files by date of creation and not produce a million archives, and for this you need to mount Google Drive in a folder.
The utility from Google can only upload and download files, check by date and delete everything older than 3 days failed.
')
Salvation was found in google-drive-ocamlfuse, there are many articles on this topic, but there is one, but the utility requires a GUI interface, and in particular any browser. The browser is transmitted with the generated link.
Google as it is known authorizes users by OAuth. In my VPS, of course, not what GUI are we talking about, only the console.
An article came to the rescue with github Headless Usage & Authorization . I offer you my free translation.
1. Install the instructions
google-drive-ocamlfuse2. Enter your google accaunt. Go to
https://code.google.com/apis/console/ and create a new project in the upper left corner (Project → Create project).
3. In the left panel, look for the Drive-API Library (Library → Drive API) and enable it (Enable).
4. Next, go to Credentials. Create a new user Create credentials → OAuth client ID. Choose Other in the proposed options. We get the ID and secret key.
5. Return to the console and write:
google-drive-ocamlfuse -headless -label me -id
6. Get a message in which there is a link:
Please, open the following URL in a web browser: https://accounts.google.com/o/oauth2/auth?client_id=
Copy the link into the browser and get the verification code.
7. Copy the received verification code and paste it back:
Please enter the verification code: hfal8as8dyv7f79asdf7g7gd7s9d7fy7dfy7dgfydb
8. That's it.After this, a folder with the application (~ / .gdfuse / me /) will be created, and we will use it to mount our disk. Mount to folder:
mkdir /my_mnt_dir ./google-drive-ocamlfuse -label me /my_mnt_dir
Unmount the folder:
fusermount -u mountpoint
The original instructions describe the actions that need to be done when errors occur, but I did it the first time.