Tutorial on mounting OneDrive, Google Drive and other network disks (Linux) with Rclone

Preface

Rclone is a command-line tool that supports synchronization, uploading, and downloading data between different object storage and network disks . And through some settings, very practical functions such as offline downloading and server backup can be realized. There are many ways to use Rclone, and mounting is one of them.

Friendly reminder: Mounting this operation is not necessary. As an experimental feature, it has many limitations and problems. After mounting, it cannot be used as a real disk. When performing file operations, the local disk will be used for caching, which takes up local disk space. Improper use may also cause problems such as disk fullness and VPS freezing. Search "Rclone" on Google, and the most related keyword is "mount", which to a certain extent is misleading to many new friends. To perform uploading, downloading, synchronization and other operations stably, it is recommended to use Rclone's native command function. For usage methods, please refer to " Rclone Advanced Usage Tutorial - Common Command Parameters ".The article originates fromSinsTu NI-https://www.sinstu.com/archives/44.html

Install and configure Rclone

The official one-click installation script is provided:The article originates fromSinsTu NI-https://www.sinstu.com/archives/44.html

< span class = "token function" > curl < /span > https ://rclone.org/install.sh <span class="token operator">|</span> <span class="token function">sudo< /span> <span class="token function">bash</span>The article originates fromSinsTu NI-https://www.sinstu.com/archives/44.html

After installation, enter  rclone config the command to enter the interactive configuration option and follow the prompts step by step. If you are confused, you can read the "Rclone Installation and Configuration Tutorial " to understand the detailed configuration process.The article originates fromSinsTu NI-https://www.sinstu.com/archives/44.html

Install fuse

Mounting requires fuse to be installed. Choose the installation command according to your system:The article originates fromSinsTu NI-https://www.sinstu.com/archives/44.html

< span class = "token comment" ># Debian/Ubantu</span>The article originates fromSinsTu NI-https://www.sinstu.com/archives/44.html

< span class = "token function" > apt-get < /span > update < span class = "token operator" > && < /span > < span class = "token function" > apt-get < /span > < span class = "token function" > install < /span > -y fuseThe article originates fromSinsTu NI-https://www.sinstu.com/archives/44.html

< span class = "token comment" ># CentOS</span>The article originates fromSinsTu NI-https://www.sinstu.com/archives/44.html

yum < span class = "token function" > install < /span > -y fuseThe article originates fromSinsTu NI-https://www.sinstu.com/archives/44.html

Mount network disk

Mounting the network disk is divided into manual mounting and automatic mounting at startup. You can choose according to your own needs.The article originates fromSinsTu NI-https://www.sinstu.com/archives/44.html

Manual mounting

< span class = "token comment" >#Mount</span>

rclone < span class = "token function" > mount < /span > < span class = "token operator" ><< /span > Network disk name: Network disk path < span class = "token operator" >>< /span > < span class = "token operator" ><< /span > Local path < span class = "token operator" >>< /span > < span class = "token punctuation" >[< /span > Parameters < span class = " token punctuation" >]< /span > --daemon

< span class = "token comment" >#Cancel mounting</span>

fusermount -qzu < span class = "token operator" ><< /span > Local path < span class = "token operator" >>< /span >

网盘名称It is filled in during configuration  nameand 网盘路径is a folder in the network disk. Leave blank to represent the entire network disk and 本地路径a local folder on the VPS. 参数You can check the official documentation to make a selection based on your needs. Do not use parentheses when typing, this is just to make the distinction clearer. --daemon It is a process daemon parameter and can be run in the background.

Usage example

Enter the command to mount:

rclone < span class = "token function" > mount < /span > Onedrive:/ /Onedrive --copy-links --allow-other --allow-non-empty --umask 000 --daemon

Then enter  df -h the command to check the mounting status.

root@P3TERX:~ < span class = "token comment" ># df -h</span>

Filesystem Size Used Avail Use% Mounted on

udev 286M < span class = "token number" > 0 < /span > 286M < span class = "token number" > 0 < /span > % /dev

tmpfs 60M < span class = "token number" > 7 < /span > .8 M 52M < span class = "token number" > 14 < /span > % /run

/dev/sda1 99G 25G 71G < span class = "token number" > 26 < /span > % /

tmpfs 297M 24K 297M < span class = "token number" > 1 < /span > % /dev/shm

tmpfs < span class = "token number" > 5 < /span > .0 M < span class = "token number" > 0 < /span > < span class = "token number" > 5 < /span > .0 M < span class = "token number" > 0 < /span > % /run/lock

tmpfs 297M < span class = "token number" > 0 < /span > 297M < span class = "token number" > 0 < /span > % /sys/fs/cgroup

Onedrive: < span class = "token number" > 5 < /span > .0 T 216G < span class = "token number" > 4 ​​< /span > .8 T < span class = "token number" > 5 < /span > % /Onedrive < span class = "token comment" >#This is the mounted network disk</span>

Unmount:

fusermount -qzu /Onedrive

Automatically mount on boot

  • Download and edit the autostart script

< span class = "token function" > wget < /span > -N git.io / rcloned < span class = "token operator" > && < /span > < span class = "token function" > nano < /span > rcloned

  • Modification content:

NAME= "Onedrive" #The name filled in during Rclone configuration

REMOTE= '' #Remote folder, a folder mounted in the network disk, leave it blank for the entire network disk

LOCAL= '/Onedrive' #Mount address, VPS local mounting directory

  • Set up auto-start at power on

< span class = "token function" > mv < /span > rcloned /etc/init. d /rcloned

< span class = "token function" > chmod < /span > +x /etc/init. d /rcloned

update-rc. d -f rcloned defaults < span class = "token comment" ># Debian/Ubuntu</span>

< span class = "token function" > chkconfig < /span > rcloned on < span class = "token comment" ># CentOS</span>

< span class = "token function" > bash < /span > /etc/init. d /rcloned start

Just see it  [信息] rclone 启动成功 ! .

manage

Start mounting bash /etc/init.d/rcloned start

Stop mounting bash /etc/init.d/rcloned stop

Remount bash /etc/init.d/rcloned restart

View log tail -f /$HOME/.rclone/rcloned.log

Uninstall self-starting mount

bash /etc/init. d /rcloned stop

update-rc. d -f rcloned remove # Debian/Ubuntu

chkconfig rcloned off # CentOS

rm -f /etc/init. d /rcloned

References

rclone official documentation

Use rclone to mount OneDrive network disk on Debian/Ubuntu

 
admin
  • by admin Published on 2024-03-1513:29:57
  • Please make sure to keep the link to this article when reprinting:https://www.sinstu.com/archives/44.html

Comment