Using Proton Drive as an Encrypted Database (rclone + VSCode Tasks on Linux)

I'm currently faced with a data storage problem in one of my team projects.

There has to be a free and immediate method to:

  1. Store files for multiple data-logging devices, uploaded remotely by teammates;
  2. Prevent local copies to conserve my local storage space;
  3. Ideally, interface into a VSCode development environment.

All of this, without setting up a remote server and database on a low-powered 24/7 computer or Raspberry Pi — at least for now.

What can I do?

In this post, I will document how I solved this problem using Proton Drive and explain the related concepts along the way.

Prerequisite: Create a Proton Account (at least free-tier).

Clouds as a Data Storage Solution

Before diving into the solution, it helps to understand the architecture. Cloud storage is when data and files are kept on and accessed through a remote server, rather than on a local computer. Generally, this falls into two categories:

  1. Self-Hosted: Installing software like Nextcloud + Tailscale on modest, self-owned computers (e.g., a Raspberry Pi).
    • Pros: Complete data control, massive storage capacity for low hardware costs, and no privacy compromises.
    • Con: Complicated installation, ongoing maintenance, and the need for technical expertise to manage security updates.
  2. Cloud-Hosted: Relying on massive third-party infrastructures like Google Drive, Dropbox, or OneDrive.
    • Pros: Immediate accessibility from anywhere, easy scalability, and zero maintenance (the provider handles everything).
    • Cons: Ongoing subscription costs for large storage, dependence on the provider's uptime, and potential privacy concerns.

Wherever the cloud is hosted, that machine acts as the server (virtual or physical), providing data and services to other computers, known as clients.

Every computer has RAM (random-access memory), often simply referred to as memory; and a hard disk, known as the primary storage that holds files and programs. While the storage contains the necessary data for an application, the memory contains the ability to read/write that data to run application. When a computer turns off, data stored in the memory will be lost, but data stored on the disk will exist on.

Clouds offer extended storage accessible to any device, storing that data elsewhere and offloading the burden from the user's local disk to a remote server.

One day I will set up my self-hosted cloud, but today is not that day.

Virtual Filesystems vs Databases

As an immediate free and secure solution, Proton Drive is a cloud-hosted filesystem with end-to-end encrypted object (AKA files) storage; but its not a database.

It is essentially the privacy-focused, open-source alternative to Google Drive. Unlike many other privacy-centric services, its free plan (5 GB) provides password protection and link expiration on public folders. Crucially, these folders now allow full edit access for anyone, including non-Proton users, to download and upload files. Hence, it acts as a shared remote data storage, accessible to anyone, anywhere, at any time.

Although a filesystem is not a database, I can pretend it is.

There are roughly two kinds of databases: a structured tabular relational database (i.e., SQL) and a semi-structured document-style non-relational database (i.e., NoSQL). Similarly, the most common file types for data are: a CSV (a table) and a JSON (a document).

On my Proton Drive, I can designate a folder as the top-level directory for all of my team's data. Then, I can read each CSV file directly as a DataFrame in Python — thus, blurring the semantic distinction between a CSV file and a data table.

Note: The practical distinction between a filesystem and a database will eventually catch up as the amount of data increases. Most notably, a filesystem lacks a database engine that can query (create, read, update, delete) using indexes to find a specific row without scanning an entire table. But, that's a problem for later.

Rclone to Mount Proton Drive

Rclone is a command-line tool that can mount any cloud drive onto a local operating system (OS), allowing users to fetch files directly from their own computer.

This mount functionality relies entirely on FUSE (Filesystem in Userspace), a software interface that translates the local OS's filesystem operations (open, read, write) into the cloud drive's backend-specific API calls. This creates a virtual filesystem layer between the cloud and the OS, enabling applications to access the mounted remote storage as if it were a locally attached disk.

After creating the target folder as the main data storage in Proton Drive:

  1. Install the latest stable release of rclone
sudo -v ; curl https://rclone.org/install.sh | sudo bash
  1. Create a Proton Drive configuration
rclone config

Follow these prompts:

Verify the connection by reviewing the folders on the drive:

rclone lsd proton:

It should return a list of folders.

VSCode Tasks to Auto-Mount/Unmount

These files can either be downloaded as local copies on disk storage or as temporary copies on the page cache (which exists inside the RAM). I am not interested in keeping permanent local copies; I only want to retrieve files as pure data streams.

In VSCode, I can automate the mount and unmount processes as custom tasks!

Tasks in VSCode are based on configuration files (tasks.json), which must always live under a .vscode directory; that defines a task to easily run from inside the editor, without manually typing the same commands in the editor's terminal.

Note: If the VSCode workspace is connected to a Git repository, never keep this working directory onto a mounted filesystem — ALWAYS keep the Git-tracked workspace on the local disk, while only mounting the data files. Avoid any risk of .git corruptions on the repo, which could happen if the network drops during a complex Git operation on a FUSE mount.

  1. Write the Task File to mount and unmount

Inside the working project's VSCode workspace, create a new folder for .vscode and a new file called tasks.json with the following contents:

{
	"version": "2.0.0",
	"tasks": [
		{
			"label": "Mount Proton Datafiles",
			"type": "shell",
			"command": "mkdir -p ~/mnt/proton-data && rclone mount 'proton:Multidevice Datafiles' ~/mnt/proton-data --vfs-cache-mode full --vfs-cache-max-size 4G", // the 4G reflects the total amount of storage space the cloud has, ensures that your laptop not use more than that on the local storage // the cache-mode full allows VSCode to edit/save files normally, while Rclone handles uploading in the background
			"isBackground": true,
			"problemMatcher": [],
			"presentation": {		
				"reveal": "never",
				"panel": "dedicated"
				},
			"runOptions": {
				"runOn": "folderOpen" // sets Mount Proton Datafiles to run automatically when opening the working folder in VSCode
				}
		},
		{
		"label": "Unmount Proton Datafiles",
		"type": "shell",
		"command": "fusermount -u ~/mnt/proton-data 2>/dev/null || umount ~/mnt/proton-data 2>/dev/null || echo \"Not mounted\"",
		"problemMatcher": [],
		"presentation": {
			"reveal": "always"
			}	
		}
	]
}

Instead of manually running commands, I can:

Now, inside VSCode, I can load files directly as DataFrames via pandas. As a result, Proton Drive becomes like a very small remote "database" where each file can be loaded separately as individual tables/documents or can be loaded cumulatively as one large table.

Conclusion

For future scalability, I'd want to go down the self-hosted route. I don't know if I could manage a self-hosted cloud for my team's data but definitely for my own files.

There are several possibilities like dietPi + FileBrowser offer a lightweight, simple setup for basic file access; or any Linux distro + Nextcloud for a full-featured ecosystem with sync, office apps, and more. Additionally, Tailscale simplifies the entire setup for remote access to any device on a separate network, so no more headaches with "port forwarding" or whatever witchcraft that is.

Nowadays, a spare laptop and a desire to learn is all that is needed to fall down this rabbit hole.

Anyways, this cloud solution is perfect for now.  While the lack of a true database engine will become a limitation with larger datasets, the simplicity and zero maintenance of Proton Drive make it the ideal starting point.

Updates

There is a HUGE flaw in this method — it could not actually allow for proper syncing between two users. Whenever my teammate uploaded a file from his side, the entire folder was corrupted on my mounted end. My computer could not read a folder that was tampered by another person. It was some sort of bug in rmount that prevents it from allowing multi-user folder syncing (I think).

Honestly, I could not figure out how to debug it and my team had to quickly move on to an actual database soon after this.

Anyways, I finally built a database with a custom ETL pipeline! Fun, but my head hurts.


References