Tutorial on how to use centos7 vps to mount Google hard drive as a local disk

888u

Last update at :2024-05-03,Edit by888u


Source: http://www.hostloc.com/forum.php?mod=viewthread&tid=351435


OpenVZ architecture is not supported

This tutorial is not very detailed. Some errors will be encountered during the mounting process. Various errors encountered and their solutions are recorded.

Using vultr centos 7.


1. Principle

Mounting a network disk under Linux is based on the Filesystem in Userspace, and there are actually many based on Fuse. There are a lot of them on the Internet. I will use GDriveFS as an example to explain how to use Linux to mount a network disk. You can find the code for mounting other network disks in Git. The reason I use this as an example is just that it is in Python. . .

Let’s first look at the results below after I mounted the vps. .


2. Mounting process

I only have Centos chicks here. Let me use it to explain it.


1) GDriveFS is developed with Python 2.7. You need to install Python 2.7 or above. Many Centos 6.x come with 2.6.6. The first thing to do is to upgrade to 2.7 or above. .

Please refer to http://blog.csdn.net/jcjc918/article/details/11022345 for how to upgrade, I will not repost it.

https://blog.fazero.me/2016/10/13/centos-update-python/

Borrow fazero’s one-click upgrade script (lazy)

Please fix the problem yourself after upgrading yum.


2) Install GDriveFS

There is a complete tutorial at https://github.com/dsoprea/GDriveFS. Let me translate it into Chinese and remind you of the following points.

First, you need to install the libfuse library to run it. The official omits this step, so I will add it here.


Please run the 64-bit version

yum install fuse-devel.x86_64 fuse.x86_64

32-bit installation

yum install fuse-devel.i686 fuse.i686


Run

pip install gdrivefs

[Note 1][Note 2][Note 3]Please solve the above problems before running this code.


After the installation is complete, first run

gdfstool auth -u


turn out

To authorize FUSE to use your Google Drive account, visit the following URL to produce an authorization code:

https://accounts.google.com/o/oauth2/auth

scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.file&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type= code&client_id=626378760250.apps.googleusercontent.com&access_type=offline

Copy the URL that appears on your terminal (not the URL above) to the browser, and the authorization page will appear.



After authorization, a text box will appear containing the authorization code. Copy this authorization code (must be complete)


gdfstool auth -a /var/cache/gdfs.creds "4/WUsOa-m2RhgQtf9_NFAMMbRC.cj4LQYdXfshQV0ieZDAqA-C7ecwI"

Replace the quotation marks with your authorization code.

[Authorization code recorded] appears. It means it was recorded successfully.


3) Mount the network disk

mkdir /mnt/gdrivefs

gdfstool mount /var/cache/gdfs.creds /mnt/gdrivefs

For other mounting methods, please see Git.

Then enjoy your big network disk.


4) Things to note

sudo gdfs -o big_writes /var/cache/gdfs.creds /mnt/gdrivefs can achieve 64K blocks and speed up reading and writing, but Apple does not support it! You can check the permissions and other issues by yourself on Git. If you are not satisfied, modify the Python code by yourself.


BTW.

1. There are many visual tools under OSX, such as Expandrive. For other information, please see http://alternativeto.net/software/expandrive. Basically, there is a fee.

2. Google Drive Api's is. 1,000,000,000 requests/day. Default Per-user limit is (you can increase it) 10 requests/second/user

Google drive access is limited and cannot be used for personal use. If you want to open it up, you can use it by making a local cache.



Note 1: An error occurred: [pip: command not found], solution:

yum -y install epel-release

yum -y install python-pip

yum clean all


Note 2: The prompt [You should consider upgrading via the 'pip install --upgrade pip' command.] appears, solve it

pip install --upgrade pip


Note 3: An error occurred [error: command 'gcc' failed with exit status 1], resolved

yum -y install gcc gcc-c++ kernel-devel

yum -y install python-devel libxslt-devel libffi-devel openssl-devel



Recommended site search: Ministry of Industry and Information Technology domain name registration, virtual host space, registered domain name, virtual host 99idc, Tencent cloud server, virtual host Hong Kong host, US virtual host purchase, registration-free space and free Internet, free asp space application ,.net virtual host,

Tutorial on how to use centos7 vps to mount Google hard drive as a local disk

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码