facebook youtube pinterest twitter reddit whatsapp instagram

Mounting and Unmounting Cloud Storage With (Rclone) in GNU/Linux

Ever wondered if you could mount your preferred cloud storage as a virtual drive on your system?

Thanks to Rclone, you can mount and access different kinds of cloud storage from a file manager, I'll be using mega.nz for this guide.

If you are new to Rclone, It is an open-source command-line program to sync files and directories to and from different cloud storage providers, it supports over 35 different cloud storage providers (gdrive, mega, onedrive, dropbox, and lots more).

In this guide, I'll be mounting my mega cloud storage to my Ubuntu system, before you get started, read the guide on Synching File With Rclone, once you've done that, we are ready to go.

Note: I'll be mounting a mega storage, but the steps apply to other storage providers, if you are having an issue, make sure you leave a comment.

Step 1. Create a New Folder on Your System that Will Be Used to Mount Mega Storage

I'll be creating a folder mega in my user home directory:

mkdir ~/mega

To get a reliable mounting, we would want to implement the Rclone File Caching, this is so the cloud storage system work more like a normal file system.

We can absolutely mount without using a caching, but this might cause an issue with most applications that try to use that specific mount directly to write data.

On top of that, once the data you try uploading fails, rclone can't auto-retry (this is because it would directly stream the data), but with caching enabled, you are in safe hands, I learned this the hard way.

Step 2. Mount Remote Storage (Mega) as A File System.

To mount your remote storage you'll want to make note of the remote name when you started the rclone setup, run rclone configif you don't know. if you haven't created one, read Getting Started With Rclone, now run the following command:

rclone --vfs-cache-mode writes mount remote-name: ~/mega

--vfs-cache-mode writes is enabling a write-cache mode, this mode writes the file to a local cache (this is done in the background), as file get written to the local cache, it shows up in you remote storage. The good thing about this mode is that you can still make use of your remote storage while the file is writing.

The above command would take a couple of minutes, you can append an ampersand to background the process, this way you won't have to restart it if it doesn't complete, here is the command if you want to background the process: rclone --vfs-cache-mode writes mount remote-name: ~/mega &

Once it's done, type df -h to confirm if it's mounted, this a screenshot of mine:

1. Mounted Storage (mega)

Step 3. Mount Drive On Boot

By default, your mounted drive won't stick when you reboot your system, which is kinda annoying, there are a couple of ways you could remount on startup, you can either use systemd or create a script that runs at boot, I'll follow the latter as it is easier.

Create a script and open it in your user home directory:

Note: I usually have my scripts in a folder called 'scripts', so, you might have to create that if it doesn' already existed.

nano ~/scripts/mount-mega.sh && mount-mega.sh

Paste in the mount command:

/usr/bin/rclone --vfs-cache-mode writes mount remote-name: ~/mega &

Make the script executable: chmod +x ~/scripts/mount-mega.sh

Go into your user crontab with crontab -e or crontab -e -u UserName

Now add this to make the script run at startup:

@reboot sh /username/scripts/mount-mega.sh

Unmount Virtual Storage in Rclone

To unmount on GNU/Linux, you use:

fusermount -u /path/to/local/mount

This is the path you mounted the storage to, if you don't know the path, run mount | grep rclone in some cases, the mount might be in use, if it is in use, use this to force close and unmount: fusermount -uz /path to/mount


You'll see something as follows:

remote: on /home/user/mega type fuse.rclone (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)

The /home/user/mega is the mount path, of course, yours would be different.


Related Post(s)

  • Send Mail with Attachment Using Mutt in GNU/Linux

    Mutt is a powerful text-based mail client for Unix/Linux operating systems. It features color support, message threading, MIME support...

  • Installing WP-CLI In a GNU/Linux Server

    WP-CLI is a command-line interface for WordPress. It can also be used with ClassicPress, as they are no differences in their usage, maybe just minimal if you are updating or downloading new ClassicPr

  • Installing and Running Rclone Mount As a Windows Service

    I previously wrote a guide on how to mount and unmount rclone in Linux, in this guide, I’ll walk you through on how to do the same on a windows system. Step 1: Download Rclone First, go to rclone d

  • How To Configure and Enable Syntax Highlighting in Nano Text Editor

    nano is one of the most popular, and friendly editor in GNU/Linux, it has several features that can boost the usability and easiness of the program. In the guide, you'll learn how to configure and en

  • Access A Web Page In GNU/Linux Using (Links) [Web Browser in Text Mode]

    Links is a text-mode World Wide Web (WWW) browses that can be used to view a web page either via a local (file://) or remote ((http:// or ftp://) URLs. To get started with Links, install it using the

  • Synchronize File With Cloud Storage Using [Rclone] In (GNU/Linux)

    Rclone is an open-source command-line program to sync files and directories to and from different cloud storage providers. It preserves timestamps, and if you are transferring from local to cloud, it