Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to mount a Google cloud disk to Linux as a virtual disk

2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how to mount Google Drive to Linux as a virtual disk. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.

1、Google-drive-ocamlfuse

google-drive-ocamlfuse treats Google Drive as a FUSE-type file system written in the OCam language. FUSE stands for User-Mode File System in Userspace, which allows non-administrator users to create virtual file systems in userspace. google-drive-ocamlfuse lets you mount Google Drive to Linux as a disk. Support read and write operations for ordinary files and directories, support read-only operations for Google dock, forms and presentations, support multiple Googe cloud drive users, duplicate file processing, support access to recycle bin, and more.

Install google-drive-ocamlfuse

google-drive-ocamlfuse can be found directly on Arch AUR, so you can install it using AUR helper programs such as Yay.

$ yay -S google-drive-ocamlfuse

On the Ubuntu system:

$ sudo add-apt-repository ppa:alessandro-strada/ppa$ sudo apt-get update$ sudo apt-get install google-drive-ocamlfuse

Install beta version of ***:

$ sudo add-apt-repository ppa:alessandro-strada/google-drive-ocamluse-beta $ sudo apt-get update$ sudo apt-get install google-drive-ocamlfuse usage

After installation, enter the following command directly in the terminal to start the google-drive-ocamlfuse program:

$ google-drive-ocamlfuse

When you run this command *** times, the program will open your browser and ask you to confirm that you are authorized to operate on Google Drive files. Once you confirm authorization, the configuration files and directories required to mount Google Drive are automatically created.

After successful authorization, you will see the following message in the terminal.

Access token retrieved correctly.

All right, we're ready to move on. Close the browser and create a mount point for our Google Drive.

$ mkdir ~/mygoogledrive

*** To mount Google Drive, use the following command:

$ google-drive-ocamlfuse ~/mygoogledrive

Congratulations! You can access files on Google Drive using Terminal or File Manager.

Use terminal:

$ ls ~/mygoogledrive

Using File Manager:

If you have more than one account, you can use the label command to distinguish between different accounts, like this:

$ google-drive-ocamlfuse -label label [mountpoint]

When this is done, you can uninstall Google Drive using the following command:

$ fusermount -u ~/mygoogledrive

For more information, you can refer to the man manual.

$ google-drive-ocamlfuse --help

Of course you can also check out the official documentation and the project's GitHub project for more.

2. GCSF

GCSF is a Google Drive-based FUSE file system written in the Rust language. GCSF gets its name from the Romania "Google C onduce S istem de F iiere," which translates into English as "Google Drive Filesystem." With GCSF, you can mount Google Drive on Linux like a virtual disk and manipulate it through terminals and file managers. You must be wondering how this differs from other Google Drive FUSE projects, such as google-drive-ocamlfuse. GCSF developers responded to similar comments on Reddit: "GCSF is meant to be faster in some ways (recursive listing of files, reading large files from Google Drive). When files are cached, their caching strategy also makes them read faster (4-7 times faster than google-drive-ocamlfuse) after consuming more memory."

Installing GCSF

GCSF can be found on AUR, and for Arch users it can be installed directly using AUR Assistant, such as Yay.

$ yay -S gcsf-git

For other distributions, install as follows.

First of all, you have to make sure that Rust is installed on your system.

Installing Rust on Linux

Ensure that the pkg-config and fuse packages are installed. They can be found in the default repositories of most Linux distributions. For example, in Ubuntu and its derivatives, you can install it using the following command:

$ sudo apt-get install -y libfuse-dev pkg-config

When all dependencies are installed, you can install GCSF using the following command:

$ cargo install gcsf How to use

First, we need to authorize the operation of Google Drive, simply enter the following command:

$ gcsf login ostechnix

You must specify a session name. Use your own session name instead of ostechnix. You'll see a prompt like the one below and an authorization verification link for your Google Drive account.

Copy and open the URL in your browser and click "allow" to grant access to your Google Drive account. When authorization is complete, your terminal will display the following message.

Successfully logged in. Credentials saved to "/home/sk/.config/gcsf/ostechnix".

GCSF saves the configuration file at $XDG_CONFIG_HOME/gcsf/gcsf.toml, usually at $HOME/.config/gcsf/gcsf.toml. Authorization credentials are also stored in this directory.

Next, create a directory to mount Google Drive.

$ mkdir ~/mygoogledrive

After that, modify the/etc/fuse.conf file:

$ sudo vi /etc/fuse.conf

Comment out the following lines to allow non-administrators to mount with the allow_other or allow_root mount options.

user_allow_other

Save and close the file.

*** In one step, mount Google Drive using the following command:

$ gcsf mount ~/mygoogledrive -s ostechnix

Example output:

INFO gcsf > Creating and populating file system... INFO gcsf > File sytem created.INFO gcsf > Mounting to /home/sk/mygoogledriveINFO gcsf > Mounted to /home/sk/mygoogledriveINFO gcsf::gcsf::file_manager > Checking for changes and possibly applying them.INFO gcsf::gcsf::file_manager > Checking for changes and possibly applying them.

Repeat, replace ostechnix with your own session name. You can use the following command to view existing sessions:

$ gcsf listSessions:- ostechnix

You can now work with Google Drive using Terminal and File Manager.

Use terminal:

$ ls ~/mygoogledrive

Using File Manager:

If you don't know where you're mounting Google Drive, you can use df or mount, as shown below.

$ df -hFilesystem Size Used Avail Use% Mounted onudev 968M 0 968M 0% /devtmpfs 200M 1.6M 198M 1% /run/dev/sda1 20G 7.5G 12G 41% /tmpfs 997M 0 997M 0% /dev/shmtmpfs 5.0M 4.0K 5.0M 1% /run/locktmpfs 997M 0 997M 0% /sys/fs/cgrouptmpfs 200M 40K 200M 1% /run/user/1000GCSF 15G 857M 15G 6% /home/sk/mygoogledrive $ mount | grep GCSFGCSF on /home/sk/mygoogledrive type fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000,allow_other)

When this is done, you can uninstall Google Drive using the following command:

$ fusermount -u ~/mygoogledrive Thank you for reading! About "how to mount Google Drive to Linux as a virtual disk" this article is shared here, I hope the above content can be of some help to everyone, so that everyone can learn more knowledge, if you think the article is good, you can share it to let more people see it!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report