参考:https://blog.laoda.de/archives/make-vps-bigger#toc-head-2
前言
有一些小鸡,它们的线路配置十分不错,但却有个致命缺点,那就是硬盘小。比如现在博客用的小鸡斯巴达,还有富强aria2用的dedipath,硬盘只有15G、10G,网站随便放点东西就满了,aria2也没法下大于10G的东西。那么有什么办法可以解决呢?
那就是OneDrive和Google Drive了。这两个分别可以达到25T和1Pb的容量,完全可以解决我们的一切需求。接下来就是教程。
clone配置
Rclone的配置OneDrive可以参考前面的文章,接下来演示Google Drive的配置
- rclone config修改配置,然后输入
n
,在name处填入名字root@linux:~# rclone config No remotes found - make a new one n) New remote s) Set configuration password q) Quit config n/s/q> n name> gd
- 选择Google Drive,这里是
15
。(看好你自己的再填)Type of storage to configure. Enter a string value. Press Enter for the default (""). Choose a number from below, or type in your own value 1 / 1Fichier \ "fichier" 2 / Alias for an existing remote \ "alias" 3 / Amazon Drive \ "amazon cloud drive" 4 / Amazon S3 Compliant Storage Providers including AWS, Alibaba, Ceph, Digital Ocean, Dreamhost, IBM COS, Minio, SeaweedFS, and Tencent COS \ "s3" 5 / Backblaze B2 \ "b2" 6 / Box \ "box" 7 / Cache a remote \ "cache" 8 / Citrix Sharefile \ "sharefile" 9 / Compress a remote \ "compress" 10 / Dropbox \ "dropbox" 11 / Encrypt/Decrypt a remote \ "crypt" 12 / Enterprise File Fabric \ "filefabric" 13 / FTP Connection \ "ftp" 14 / Google Cloud Storage (this is not Google Drive) \ "google cloud storage" 15 / Google Drive \ "drive" 16 / Google Photos \ "google photos" 17 / Hadoop distributed file system \ "hdfs" 18 / Hubic \ "hubic" 19 / In memory object storage system. \ "memory" 20 / Jottacloud \ "jottacloud" 21 / Koofr \ "koofr" 22 / Local Disk \ "local" 23 / Mail.ru Cloud \ "mailru" 24 / Mega \ "mega" 25 / Microsoft Azure Blob Storage \ "azureblob" 26 / Microsoft OneDrive \ "onedrive" 27 / OpenDrive \ "opendrive" 28 / OpenStack Swift (Rackspace Cloud Files, Memset Memstore, OVH) \ "swift" 29 / Pcloud \ "pcloud" 30 / Put.io \ "putio" 31 / QingCloud Object Storage \ "qingstor" 32 / SSH/SFTP Connection \ "sftp" 33 / Sugarsync \ "sugarsync" 34 / Tardigrade Decentralized Cloud Storage \ "tardigrade" 35 / Transparently chunk/split large files \ "chunker" 36 / Union merges the contents of several upstream fs \ "union" 37 / Uptobox \ "uptobox" 38 / Webdav \ "webdav" 39 / Yandex Disk \ "yandex" 40 / Zoho \ "zoho" 41 / http Connection \ "http" 42 / premiumize.me \ "premiumizeme" 43 / seafile \ "seafile" Storage> 15
- client id 和client secret留空,直接空格跳过
Google Application Client Id Setting your own is recommended. See https://rclone.org/drive/#making-your-own-client-id for how to create your own. If you leave this blank, it will use an internal key which is low performance. Enter a string value. Press Enter for the default (""). client_id> OAuth Client Secret Leave blank normally. Enter a string value. Press Enter for the default (""). client_secret>
- 输入
1
,选择完全Scope that rclone should use when requesting access from drive. Enter a string value. Press Enter for the default (""). Choose a number from below, or type in your own value 1 / Full access all files, excluding Application Data Folder. \ "drive" 2 / Read-only access to file metadata and file contents. \ "drive.readonly" / Access to files created by rclone only. 3 | These are visible in the drive website. | File authorization is revoked when the user deauthorizes the app. \ "drive.file" / Allows read and write access to the Application Data folder. 4 | This is not visible in the drive website. \ "drive.appfolder" / Allows read-only access to file metadata but 5 | does not allow any access to read or download file content. \ "drive.metadata.readonly" scope> 1
- root_folder_id和service_account_file留空,直接空格跳过,然后advanced config输入
n
ID of the root folder Leave blank normally. Fill in to access "Computers" folders (see docs), or for rclone to use a non root folder as its starting point. Enter a string value. Press Enter for the default (""). root_folder_id> Service Account Credentials JSON file path Leave blank normally. Needed only if you want use SA instead of interactive login. Leading `~` will be expanded in the file name as will environment variables such as `${RCLONE_CONFIG_DIR}`. Enter a string value. Press Enter for the default (""). service_account_file> Edit advanced config? y) Yes n) No (default) y/n> n
- auto config处也输入
n
,然后复制给出的网址,登录自己的Google账户,将返回的授权码填入 - Configure this as a Shared Drive (Team Drive)?这里根据自己的需要来,输入
y
表示挂载团队盘,n
表示直接挂载个人空间 - 成功后,输入
y
来完成配置,然后输入q
来退出操作。
挂载GD
下面要把 Google Drive 网盘挂载到云主机/Vps 上和设置开机自启,自动挂载 Google Drive 网盘
首先安装fuse:apt-get install fuse #debian
yum install fuse #centos
新建一个你要挂载的目录,例如我要挂载到/home/gdrive
mkdir -p /home/gdrive
再执行挂载命令:
rclone mount gd:movie /home/gdrive --allow-other --allow-non-empty --vfs-cache-mode writes
这里gd
是rclone里Google Drive的name;movie
是Google Drive里要存放的子目录,留空则直接放根目录;/home/gdrive
是VPS里的挂载目录
卸载Google Drive
fusermount -qzu /home/gdrive
挂载只要几秒钟,但终端不会返回成功信息,关闭 SSH 重连即可。
重连后查看是否挂载成功:
df -h
有看到 gd,使用量和本地主机路径即成功挂载。
接下来设置开机自动挂载
新建一个/usr/systemd/system/rclone.service 文件,内容为:
[Unit]
Description=rclone
[Service]
User=root
ExecStart=/usr/bin/rclone mount gd:movie /home/gdrive --allow-other --allow-non-empty --vfs-cache-mode writes
Restart=on-abort
[Install]
WantedBy=multi-user.target
注意修改挂载命令为你主机的路径。
如果需要挂载多个网盘(比如我还要挂在一个OD),按上面的教程新运行个 Rclone 配置,再新建一个/etc/systemd/system/rclone2.service
文件
如果还有第三个,就以此类推
然后重载 daemon,让新的服务文件生效:
systemctl daemon-reload
用 systemctl 来启动 rclone
systemctl start rclone
systemctl start rclone2 #如果有第二个网盘
设置开机启动:
systemctl enable rclone
停止、查看状态可以用:
systemctl stop rclone
systemctl status rclone
重启你的云主机/VPS:
reboot
重启后查看一下 rclone 的服务是否启动,GoogleDrive 是否正常挂载
systemctl status rclone
df -h
OK ! 完成.
Comments NOTHING