前言:
今天同学们对“服务器空间怎么查看”大体比较关怀,兄弟们都需要剖析一些“服务器空间怎么查看”的相关文章。那么小编也在网上搜集了一些关于“服务器空间怎么查看””的相关知识,希望朋友们能喜欢,咱们一起来了解一下吧!开开心心买的云服务器准备部署自己的博客,什么?只有20GB存储空间???,what fk?? 拉一拉存储升配的进度条,什么?what fk? 竟然可以这么贵? 太不适合我们这些羊毛党的风格了!! 那怎么办呢?
在linux服务器上挂载OneDrive获取免费TB级存储空间
Centos7.x操作系统;
Microsoft 365 E3 A1P EDU邮箱等账号;
rclone挂载工具;
流程
我们在Windows环境下使用rclone获取Microsoft OneDrive的token,然后在Linux服务器中使用rclone创建一个该token对应的存储,然后将该存储挂载在服务器的目录中,配置好开机启动,完成。
1.获取token
rclone一是款支持多种环境挂载存储的工具,支持挂载Microsoft OneDrive,Amazon Cloud Drive,Dropbox,FTP Connection,SSH/SFTP Connection等多种方式。
在本地Windows下使用rclone获取Microsoft账号对应的token,rclone下载地址为
解压下载包,进入解压后目录
在蓝色处删除所有内容,输入cmd后敲击回车进入到命令行中对应的该文件目录
在命令行中输入
rclone authorize "onedrive"
会自动调用本机浏览器定向到Microsoft登陆页面
成功登录后会弹出SUCCESS页面
返回到你刚才的命令行里面,就可以查看获取到的access_token了(人工打码最为致命)
2.在Linux上配置rclone
首先安装unzip 解压工具
yum install unzip -y
安装rclone
curl | sudo bash
提示“rclone v1.50.2 has successfully installed”安装完成
在命令行中输入:
rclone config
进入rclone配置菜单,根据提示进行选择
# rclone config2020/01/18 11:55:18 NOTICE: Config file "/root/.config/rclone/rclone.conf" not found - using defaultsNo remotes found - make a new onen) New remotes) Set configuration passwordq) Quit confign/s/q> n #新建name> ojbk #起名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 Provider (AWS, Alibaba, Ceph, Digital Ocean, Dreamhost, IBM COS, Minio, etc) \ "s3" 5 / Backblaze B2 \ "b2" 6 / Box \ "box" 7 / Cache a remote \ "cache" 8 / Citrix Sharefile \ "sharefile" 9 / Dropbox \ "dropbox"10 / Encrypt/Decrypt a remote \ "crypt"11 / FTP Connection \ "ftp"12 / Google Cloud Storage (this is not Google Drive) \ "google cloud storage"13 / Google Drive \ "drive"14 / Google Photos \ "google photos"15 / Hubic \ "hubic"16 / JottaCloud \ "jottacloud"17 / Koofr \ "koofr"18 / Local Disk \ "local"19 / Mail.ru Cloud \ "mailru"20 / Mega \ "mega"21 / Microsoft Azure Blob Storage \ "azureblob"22 / Microsoft OneDrive \ "onedrive"23 / OpenDrive \ "opendrive"24 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH) \ "swift"25 / Pcloud \ "pcloud"26 / Put.io \ "putio"27 / QingCloud Object Storage \ "qingstor"28 / SSH/SFTP Connection \ "sftp"29 / Transparently chunk/split large files \ "chunker"30 / Union merges the contents of several remotes \ "union"31 / Webdav \ "webdav"32 / Yandex Disk \ "yandex"33 / http Connection \ "http"34 / premiumize.me \ "premiumizeme"Storage> 22 #选择22是Microsoft OneDrive** See help for onedrive backend at: **Microsoft App Client IdLeave blank normally.Enter a string value. Press Enter for the default ("").client_id> #留空Microsoft App Client SecretLeave blank normally.Enter a string value. Press Enter for the default ("").client_secret> #留空Edit advanced config? (y/n)y) Yesn) Noy/n> n #输nRemote configUse auto config? * Say Y if not sure * Say N if you are working on a remote or headless machiney) Yesn) Noy/n> n #输nFor this to work, you will need rclone available on a machine that has a web browser available.Execute the following on your machine (same rclone version recommended) :rclone authorize "onedrive"Then paste the result below:result> {"access_token":"xxxxxxxxxxxxxxxxxxxx","expiry":"2020-01-18T12:39:21.6954039+08:00"} #输入在win下获取到的tokenChoose a number from below, or type in an existing value 1 / OneDrive Personal or Business \ "onedrive" 2 / Root Sharepoint site \ "sharepoint" 3 / Type in driveID \ "driveid" 4 / Type in SiteID \ "siteid" 5 / Search a Sharepoint site \ "search"Your choice> 1 #选择1Found 1 drives, please select the one you want to use:0: OneDrive (business) id=xxxxxxxxChose drive to use:> 0 #选择0Found drive 'root' of type 'business', URL: that okay?y) Yesn) Noy/n> y #输入y--------------------[ojbk]type = onedrivetoken = {"access_token":"qwertyuiop","expiry":"2020-01-18T12:39:21.6954039+08:00"}drive_id = asdfghjkldrive_type = business--------------------y) Yes this is OKe) Edit this remoted) Delete this remotey/e/d> y #输入yCurrent remotes:Name Type==== ====ojbk onedrivee) Edit existing remoten) New remoted) Delete remoter) Rename remotec) Copy remotes) Set configuration passwordq) Quit confige/n/d/r/c/s/q> q #输入q退出
3.在Linux新建挂载目录
在根目录下新建一个od的文件夹,并给予对应权限(我给的稍微大了点)
4.挂载并设置开机自启
下载脚本
wget -N --no-check-certificate
修改对应项
命令行输入vim rcloned,按i进入编辑模式
NAME="" #创建的rclone名,本文此处填ojbk
REMOTE="" #远程挂载地址对应的文件夹,是你OneDrive对应的具体目录
LOCAL="" #在本机上的挂载地址
修改完成后,先按esc推出编辑模式,再按:wq保存推出
设置开机自启
mv rcloned /etc/init.d/rcloned #移动rcloned到init(开机启动目录)下
chmod +x /etc/init.d/rcloned #给rcloned可执行权限
chkconfig rcloned on #设置自启动
bash /etc/init.d/rcloned start #启动rclone
5.查看服务器空间
命令行输入:
df -h
会发现多了5T的存储哦
6.幻想
有了这5TB的存储空间,搭建个NAS,做个私人网盘,或者当作大盘鸡。。。。。都轻松搞定,最重要的是数据不会丢(不保证),因为你的数据是存到微软那边啦~