1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Linux MintでGoogle Driveをマウントする

Posted at

はじめに

Linux MintでGoogle Driveを直接ファイルシステムとしてマウントする方法を解説します。
この方法により、Google Driveを通常のローカルフォルダのように扱うことができます。
rcloneを使用したCLIでの操作の為、他のディストリビューションでもある程度効果が期待できます。

動作環境

  • OS: Linux Mint 22.1 x86_64
  • Shell: zsh 5.9
  • Terminal: gnome-terminal

方法1: rclone を使用(推奨)

1. rcloneのインストール

sudo apt update
sudo apt install rclone

2. Google Driveの設定

rclone config

設定手順:

  1. n を入力(新しいリモートを作成)
  2. 名前を入力(例:drive
  3. ストレージタイプで drive を選択
  4. client_idclient_secret は空白のままEnter
  5. scope1(フルアクセス)を選択
  6. root_folder_id は空白のままEnter
  7. service_account_file は空白のままEnter
  8. 高度な設定は n(デフォルト)
  9. 自動設定は y(デフォルト)

ブラウザが開いてGoogleの認証画面が表示されるので、Googleアカウントでログインして許可してください。

3. 設定の保存

設定完了後、以下のような画面が表示されます:

Configuration complete.
Options:
- type: drive
- scope: drive
- token: {"access_token":"..."}
- team_drive: 
Keep this "drive" remote?
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d>

y を入力して設定を保存し、q で終了します。

4. マウントポイントの作成

mkdir ~/GoogleDrive

5. Google Driveのマウント

rclone mount drive: ~/GoogleDrive --daemon

6. 動作確認

ls ~/GoogleDrive

Google Driveの内容が表示されればOKです!

基本的な使い方

ファイルの操作

# ローカルファイルをGoogle Driveにコピー
cp ~/Documents/example.txt ~/GoogleDrive/

# Google Driveからローカルにコピー
cp ~/GoogleDrive/example.txt ~/Downloads/

# ディレクトリの内容を確認
ls -la ~/GoogleDrive/

マウント状況の確認

df -h | grep GoogleDrive

アンマウント(取り外し)

fusermount -u ~/GoogleDrive

自動マウント設定

起動時に自動でマウントしたい場合:

1. スクリプトの作成

nano ~/mount-gdrive.sh

内容:

#!/bin/bash
rclone mount drive: ~/GoogleDrive --daemon

2. 実行権限の付与

chmod +x ~/mount-gdrive.sh

3. 自動起動への追加

  • システム設定 → 自動起動するアプリケーション
  • 「追加」で作成したスクリプトを指定

トラブルシューティング

よくあるエラーと対処法

エラー: Transport endpoint is not connectedの場合

fusermount -u ~/GoogleDrive
rclone mount drive: ~/GoogleDrive --daemon

権限エラーが発生する場合

sudo usermod -a -G fuse $USER

その後、ログアウト→ログインしてください。

パッケージが見つからない場合

パッケージ名のスペルを確認してください。
私は以下のスペルミスをしました↓

  • devfs2davfs2
  • google-drive-ocamlfuse のハイフンの位置

便利なrcloneコマンド

# Google Driveの容量情報を表示
rclone about drive:

# 設定の確認
rclone config show

# ファイルの同期(一方向)
rclone sync ~/Documents/ drive:Documents/

# ファイルのコピー
rclone copy ~/Documents/file.txt drive:

注意事項

  • インターネット接続が必要です
  • 大きなファイルの同期には時間がかかる場合があります
  • マウント中はGoogle Driveの容量制限に注意してください
  • 終了時は必ずアンマウントしてください

マウント方法比較

最後に今回取り上げなかったマウント方法について比較します。

Screenshot from 2025-06-06 18-42-40.png

rclone を選ぶべき場合

本格的にGoogle Driveを活用したい場合、ファイル同期やバックアップが必要な場合、複数のクラウドサービスを使用する場合、パフォーマンス重視の場合

google-drive-ocamlfuse を選ぶべき場合

Google Driveのみ使用する場合、シンプルなファイルアクセスで十分な場合、コマンドラインに慣れていない場合

ファイルマネージャーを選ぶべき場合

とりあえず試してみたい場合、時々ファイルを確認するだけの場合、GUI操作しか使いたくない場合、設定を一切したくない場合

まとめ

Linux MintでGoogle Driveをマウントする方法として、rcloneは安定しており推奨されます。一度設定すれば、Google Driveを通常のローカルフォルダのように使用できるため、クラウドストレージの利便性を最大限に活用できます。

参考資料

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?