- A+
工具
rclone : https://rclone.org/downloads/
winfsp : http://www.secfs.net/winfsp/download/
其中rclone的windows版需要解压,并添加解压目录到系统路径中。(额,不添加,然后使用时写完整路径也行)。而依赖库winfsp下载完后一路Next直接安装就可以了。
补充工具
mmozeiko/RcloneBrowser: https://github.com/mmozeiko/RcloneBrowser 一款跨平台的Rclone GUI
确认rclone已经添加到系统路径中后可以使用rclone config进入配置项。
配置Rclone
[[email protected] ~]# rclone config 2018/11/27 14:12:30 NOTICE: Config file "/root/.config/rclone/rclone.conf" not found - using defaults No remotes found - make a new one n) New remote s) Set configuration password q) Quit config n/s/q> n name> codesofun 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 / A stackable unification remote, which can appear to merge the contents of several remotes \ "union" 2 / Alias for a existing remote \ "alias" 3 / Amazon Drive \ "amazon cloud drive" 4 / Amazon S3 Compliant Storage Providers (AWS, Ceph, Dreamhost, IBM COS, Minio) \ "s3" 5 / Backblaze B2 \ "b2" 6 / Box \ "box" 7 / Cache a remote \ "cache" 8 / Dropbox \ "dropbox" 9 / Encrypt/Decrypt a remote \ "crypt" 10 / FTP Connection \ "ftp" 11 / Google Cloud Storage (this is not Google Drive) \ "google cloud storage" 12 / Google Drive \ "drive" 13 / Hubic \ "hubic" 14 / JottaCloud \ "jottacloud" 15 / Local Disk \ "local" 16 / Mega \ "mega" 17 / Microsoft Azure Blob Storage \ "azureblob" 18 / Microsoft OneDrive \ "onedrive" 19 / OpenDrive \ "opendrive" 20 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH) \ "swift" 21 / Pcloud \ "pcloud" 22 / QingCloud Object Storage \ "qingstor" 23 / SSH/SFTP Connection \ "sftp" 24 / Webdav \ "webdav" 25 / Yandex Disk \ "yandex" 26 / http Connection \ "http" Storage> 12 ** See help for drive backend at: https://rclone.org/drive/ ** Google Application Client Id Leave blank normally. Enter a string value. Press Enter for the default (""). client_id> Google Application Client Secret Leave blank normally. Enter a string value. Press Enter for the default (""). client_secret> 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 ID of the root folder Leave blank normally. Fill in to access "Computers" folders. (see docs). 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. Enter a string value. Press Enter for the default (""). service_account_file> Edit advanced config? (y/n) y) Yes n) No y/n> n Remote config Use auto config? * Say Y if not sure * Say N if you are working on a remote or headless machine or Y didn't work y) Yes n) No y/n> n If your browser doesn't open automatically go to the following link: https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=202264815644.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&state=982fb9a7db490013d45c67d1999fecc4 Log in and authorize rclone for access Enter verification code> 4/owAaAIkVMZwHI*********************** Configure this as a team drive? y) Yes n) No y/n>y Fetching team drive list... No team drives found in your account-------------------- [codesofun] type = drive scope = drive token = {"access_token":"ya29.GlthBlm33ZRXC_HEYgGa0IZixHdAFyBGULJktuRF__tHkK5MnR9JKuo2lfGXeIHvl1sL2AHXe5iUKYsY95KNnku0ULXmEXkx2sFCYrjA_SwtlYh6dDvuRSfB_Wnq","token_type":"Bearer","refresh_token":"1/2XddeAX232tfYdpNIwGZCftlTNlVvok0nnLi2iiRLWIGdyX3UuGPe77Trsk2MgtB","expiry":"2018-11-27T15:18:10.834839212+08:00"} -------------------- y) Yes this is OK e) Edit this remote d) Delete this remote y/e/d>y Current remotes: Name Type ==== ==== codesofun drive e) Edit existing remote n) New remote d) Delete remote r) Rename remote c) Copy remote s) Set configuration password q) Quit config e/n/d/r/c/s/q>q
注意在提示“Configure this as a team drive?”时,输入Y,并填入需要使用的团队云盘。
官方文档: https://rclone.org/drive/#team-drives
挂载 Mount
我这里假设我前面添加的名称为GDrive,想要挂载在本机的X:上,并设置缓存目录为F:\Temp(cache路径中请不要带有空格,默认缓存目录为C盘用户目录下, C:\Users\<Your user name>\AppData\Local\rclone)。那么运行以下命令执行挂载(整个GDrive根目录)操作,然后你就会看到一个可爱的X盘出现了~
rclone mount GDrive:/ x: --cache-dir F:\Temp --vfs-cache-mode writes
关于vfs-cache-mode项设置,还是建议看下官方的说明根据自己的需求和网络情况来进行选择 https://rclone.org/commands/rclone_mount/#file-caching 。这里只做简单说明:
off: In this mode the cache will read directly from the remote and write directly to the remote without caching anything on disk. (本地不做任何缓存,所有文件直接从云端获取并写入。建议网速特别好时(复制粘贴大文件时建议至少100M管以上速度)使用。
minimal: This is very similar to “off” except that files opened for read AND write will be buffered to disks. This means that files opened for write will be a lot more compatible, but uses the minimal disk space. (和off类似,但是已经打开的文件会被缓存到本地。个人推荐,小文件基本够用,但是如果你的网络情况(梯子)不是特别好的话,用writes也行
writes: In this mode files opened for read only are still read directly from the remote, write only and read/write files are buffered to disk first. (如果文件属性为只读则只从云端获取,不然先缓存在本地进行读写操作,随后被同步。个人推荐使用,但是在直接从本地复制文件到GDrive时还是看网络情况
full:In this mode all reads and writes are buffered to and from disk. When a file is opened for read it will be downloaded in its entirety first. (所有的读写操作都会缓存到磁盘中。然后才会同步。不是很推荐。会导致所有文件均被缓存到本地。直到达到你缓存总额(—cache-total-chunk-size,默认大小10G)。但是你网速特别差时也可以使用。
后端运行以及开机自动挂载
上面的挂载操作在退出cmd后就自动结束了,所以我们需要让它后台运行。
rclone虽然提供了--daemon参数来实行后台运行,但是该参数并不适合于windows环境中。会有如下提示:
rclone mount GDrive:/ x: --cache-dir F:\Temp --vfs-cache-mode writes --daemon 2018/05/01 09:54:19 background mode not supported on windows platform
所以,我们需要另外想个办法让rclone能够后端运行以及开机自动挂载。
在你之前解压的rclone目录下新建一个文本文件,填入以下内容,请注意修改倒数第二行的WS.Run中相关命令为你上步成功执行的命令,然后将该文件名改为rclone.vbs (后缀名为.vbs即可)
Option Explicit Dim WMIService, Process, Processes, Flag, WS Set WMIService = GetObject("winmgmts:{impersonationlevel=impersonate}!\\.\root\cimv2") Set Processes = WMIService.ExecQuery("select * from win32_process") Flag = true for each Process in Processes if strcomp(Process.name, "rclone.exe") = 0 then Flag = false exit for end if next Set WMIService = nothing if Flag then Set WS = Wscript.CreateObject("Wscript.Shell") WS.Run "rclone mount GDrive:/ x: --cache-dir F:\Temp --vfs-cache-mode writes", 0 end if
完成后双击运行,你会看到X盘挂载成功。
补充说明下,如果你看到显示的挂载空间其实是个人空间大小,请参阅此issue: The amount of disk space incorrent when mount Team Drives (gdrive) in Windows 10 · Issue #2288 · ncw/rclone 下载最新的rclone并安装。但超大文件仍建议使用rclone copy或者rclone sync进行复制或者同步操作,而不是直接使用挂载盘,以免卡挂载盘。

如果你需要中断这个挂载操作,请直接在任务管理器中kill掉rclone.exe进程即可。
然后将这个文件复制(或者剪贴)到开机项中C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp(Windows 10)即可实现开机自动挂载~
上传速度相关
rclone直接连通www.goolgeapi.com进行文件的上传与下载操作。能直接走IPv6流量,在教育网100M环境下,能做到满速上传。其他环境网速视你的网络情况决定。


- 我的微信
- 这是我的微信扫一扫
-
- 我的微信公众号
- 我的微信公众号扫一扫
-