Replace Google Drive with Storj, plus Rclone and Kopia.
Tags: tutorial, productivity, web3, opensource
Published: 2023-03-16 14:00:00

> **UPDATE 2023/03/21:** The free tier is **[depricated](https://forum.storj.io/t/discontinuation-of-the-storj-free-tier/25332)**. However, you can still test the service for free within 30 days period, see more about the pricing [**here**](https://www.storj.io/pricing). It has been like a roller coaster in the marketing part.

When I moved to Linux, I lost the ability to sync with Google Drive because Google Drive doesn't provide a Linux desktop client. Therefore, I moved to **[Storj](https://www.storj.io/)**, a Web3 decentralized cloud storage platform, and never looked back.

## Why Storj?

~~First, because you'll get **150GB**[opening] **25GB**[first edit] of cloud storage from Storj **"for free"**!~~ Second, you'll get top-notch security since all of your files will be encrypted and then split into pieces across over 16,000+ server nodes around the globe. There's no way for data leaks to happen through zero-trust security, see more **[here](https://www.storj.io/how-it-works)**. Lastly, the performance is very good @ 24 Gb/s download speed through S3 connection.

## How is the cost ~~(after the first 150GB[opening] 25GB[first edit])~~?

~~You get the first 150GB[opening] 25GB[first edit] of storage and 150GB[opening] 25GB[first edit] of bandwidth/month for free. After that,~~ it will be $4/TB for storage per month and $7/TB for bandwidth per month, which is pretty cheap compared to similar services. You can pay with their **[Storj coin](https://coinmarketcap.com/currencies/storj/)** or a credit card. See more **[here](https://www.storj.io/pricing)**.

## Other Web3 cloud storages?

There are many interesting Web3 cloud storages, for example, **[Sia](https://sia.tech/)**, **[Filecoin](https://filecoin.io/)**, **[Internxt](https://internxt.com/)**, and **[Arweave](https://www.arweave.org/)** through **[Akord](https://akord.com/products/web-app)**.

* **[Sia](https://sia.tech/)** is the closest competitor to Storj. It aims at a low-cost cloud storage market. It also supports S3 connection. But there's no free run to offer. And there's no pricing available on their website.
* **[Filecoin](https://filecoin.io/)** has nothing to offer to the end-user at all. If you really want to use it, I would recommend **[Fleek](https://fleek.co/)**. It's expensive but can do much more than just cloud storage.
* **[Internxt](https://internxt.com/)** has desktop and mobile clients available. However, it is very limited in term of features, for instance, file versioning is currently missing.
* **[Akord](https://akord.com/products/web-app)** has a different use case altogether as it offers a permanent storage. _The price is high_, but your files will be kept forever, hence unlimited file versioning, and available for download without additional cost. Therefore, it's not suitable for syncing a large number of files.
* As a bonus, **[Züs (formerly 0Chain)](https://zus.network/)** is another interesting Web3 cloud storage project you might want to keep an eye on. They are not running on mainnet yet, but seem to be very promising. See **[their roadmap](https://zus.network/roadmap/)** for more info.

---

## Automatically sync your files on Storj with Rclone and Watchexec

![Storm Troopers](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2ll6vh5xrr5mfvvhdh6q.jpg)

You can upload and download file using web interface. However, the web interface can't sync your local files on the cloud. Therefore, we will add sync features with **[Rclone](https://rclone.org/)**, and make it automatically with **[Watchexec](https://github.com/watchexec/watchexec)**.

> This walkthrough will focus on Linux, openSUSE Tumbleweed to be specified. However, Windows users can use Rclone and Watchexec without issues, hence can set up sync functionalities with Storj. Please see Rclone and Watchexec websites for the install instructions on Windows.

---

### Setup Rclone to sync files to Storj

1. Install Rclone in **YaST Software Management**, or simply install it using this command:

     ```
sudo zypper install rclone
     ```
     &nbsp;
2. Setup S3 connection and Rclone by following **[the official Storj Docs](https://docs.storj.io/dcs/how-tos/sync-files-with-rclone/rclone-with-hosted-gateway)**.

     **Importantly**, in the process of creating the S3 credential, the UI will ask you to generate or enter your 12-words passphrase. You will have to **enter your project's passphrase**. Otherwise, you won't be able to access your S3 bucket.
     &nbsp;
     In order to make it easy to remember which Rclone configuration is for which Storj bucket, I recommend to always **name the connection name the same as the bucket name**.
     &nbsp;
     > You can also create a master key for your S3 access. It's the key to accessing all your buckets in a specific project. However, I don't recommend using this on mobile. Because there's neither an official Storj app nor open source S3 storage browser on mobile _yet_. On PC, even without the official client, you can use a master key with ease since all the toolchains are open source.
     &nbsp;
3. Now, with a working Rclone connection, you can _sync_ from any local folder, including the folders and files inside it, to Storj cloud with this command:

     ```
rclone copy --update --progress --disable-http2 /path/to/local/folder/ connectionname:bucketname/
     ```
     &nbsp;
     For example, I can sync my `storj` folder in my home directory to my `storj-bucket` using this command:

     ```
rclone copy --update --progress --disable-http2 ~/storj/ storj-bucket:storj-bucket/
     ```
     &nbsp;
     Note that I use `rclone copy` command instead of `rclone sync` command because `rclone sync` command can delete all your files on the cloud if you _accidentally_ delete your local files.
     &nbsp;
     The `--update` option will only overwrite files (with the same file name) on the cloud _if_ your local file is newer.
     &nbsp;
     The `--progress` option will show the transfer progress of the command.
     &nbsp;
     The `--disable-http2` option [**is recommened by Storj**](https://docs.storj.io/dcs/getting-started) for better transfer speed.
     &nbsp;
4. You can sync from Storj cloud to your local folder by using this command:

     ```
rclone copy --update --progress --disable-http2 storj-bucket:storj-bucket/ ~/storj/
     ```
     &nbsp;
5. You can mount Storj cloud (`storj-bucket`) to your local folder named `storj-bucket` (you need to create a folder to be used as a mount point) in your home directory by using this command:

     ```
rclone mount storj-bucket:storj-bucket/ ~/storj-bucket/
     ```
     &nbsp;
     You can enable file caching to be able to work fully in sync on the cloud by using `--vfs-cache-mode full` option and `--vfs-cache-max-age 24h0m0s` (default `1h0m0s`) to set the caching duration. See more about this option **[here](https://rclone.org/commands/rclone_mount/#vfs-file-caching)**.
     &nbsp;
6. You don't have to remember all of these lengthy commands by using the app called **[MenuLibre](https://github.com/bluesabre/menulibre)** to easily create a desktop file to launch the commands, or even add it to run automatically at startup by using **[GNOME Tweaks](https://gitlab.gnome.org/GNOME/gnome-tweaks)**. Both can be downloaded using **GNOME Software**. For example, I created `rclone mount` command in a desktop file using MenuLibre, so I can mount Storj cloud easily with a single click, as shown in the screenshot below:

     ![Mounting desktop file](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/shgu9anueftf6h7e9gop.png)

     > Note that a desktop file doesn't support a relative path (a path with `~/` for `/home/username/`). See more **[here](https://unix.stackexchange.com/questions/428992/why-do-freedesktop-desktop-files-not-allow-relative-paths)**.

---

### Setup Watchexec to sync files to Storj... Automatically!

1. Install Watchexec in **YaST Software Management**, or simply install it using this command:

     ```
sudo zypper install watchexec
     ```
     &nbsp;
2. Create a file watcher script to execute commands in response to file modifications in the synced folder:

     ```
#!/bin/bash
watchexec --watch ~/storj/ rclone copy --update --progress --disable-http2 ~/storj/ storj-bucket:storj-bucket/
     ```
     &nbsp;
     You can copy this script to a plain text editor and save it at your home directory as `filewatcher.sh`.
     &nbsp;
3. Make the script executable as a program in the script's right-click properties.

4. Run the script in the terminal with `./filewatcher.sh`.

5. You can watch as many folders as you want by editing the `./filewatcher.sh` script, for example we will watch `~/storj1/` and `~/storj2/` folders, and execute `rclone copy` commands in response to file modifications in these folders:

     ```
#!/bin/bash
watchexec --watch ~/storj1/ rclone copy --update --progress --disable-http2 ~/storj1/ storj1-bucket:storj1-bucket/ &
watchexec --watch ~/storj2/ rclone copy --update --progress --disable-http2 ~/storj2/ storj2-bucket:storj2-bucket/
     ```
     &nbsp;
6. Make the script run at startup by creating the desktop file with **[MenuLibre](https://github.com/bluesabre/menulibre)** executing `./filewatcher.sh`. Then, adding it to startup apps using **[GNOME Tweaks](https://gitlab.gnome.org/GNOME/gnome-tweaks)**, as shown in the screenshot below:

     ![MenuLibre's filewatcher](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2q159f6v9jkr85roi20m.png)

     ![Startup apps in GNOME Tweak](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h5h9mpaytm7w70551160.png)

     > Note that a desktop file doesn't support a relative path (a path with `~/` for `/home/username/`). See more **[here](https://unix.stackexchange.com/questions/428992/why-do-freedesktop-desktop-files-not-allow-relative-paths)**.

---

## Advanced Usage Examples

![In Space](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qx8qczssu4ccmymqrrv4.jpg)

### Syncing a path with whitespace or non-English characters

The problem arises when you try to sync a folder naming with whitespace or non-English characters. This can easily be fixed by:

```
watchexec -n --watch ~/"Documents/Storj Backups"/ rclone copy --update --disable-http2 ~/"Documents/Storj Backups"/ storj-backups:storj-backups/
```

We use `-n` option to run the command directly, instead of wrapping it in a shell (`watchexec` runs in a shell by default). Then, with the path, you encapsulated both ends with `"`. These eliminate the issues with whitespace and non-English characters.

### Using a variable in your bash script

You're using a variable to make your script easy to manage. Imagine if you want to change the above path to another location, you will have to change it 2 times (for `watchexec` and for `rclone`), and that's only one path. If you use a variable, you'll only need to change the path you save in the variable. From the above example:

```
#!/bin/bash

# directory path variables
dir=~/"Documents/Storj Backups"/

# the monitor-sync command
watchexec -n --watch "$dir" rclone copy --update --disable-http2 "$dir" storj-backups:storj-backups/
```

Note that when using a directory path variable which contains whitespace or non-English characters in your bash script, don't for get to encapsulate it in `"` as shown in the above example.

### Mounting Storj Bucket on Your System

You can easily mount `storj-backups` bucket using `rclone mount` command, so you can interact with your file on the cloud using your system's file manager. For example:

```
# Create a mount point directory first
mkdir ~/rclone/mount/storj-backups

rclone mount storj-backups:storj-backups/ ~/rclone/mount/storj-backups
```

After mounted, you will have to open your file manager manully. To automatically open your file manager, GNOME Files (Nautilus) for example:

```
rclone mount storj-backups:storj-backups ~/rclone/mount/storj-backups/ & nautilus ~/rclone/mount/storj-backups --new-window
```

It's a lenghtly command, right? You can use a desktop file for that. You can use MenuLibre, or create a desktop file manually with this setup:

```
[Desktop Entry]
Version=1.1
Type=Application
Name=storj-backups
Comment=Mount storj-backups bucket.
Icon=system-floppy
DBusActivatable=true
X-GNOME-UsesNotifications=true
Exec=bash -c "rclone mount storj-backups:storj-backups ~/rclone/mount/storj-backups & nautilus ~/rclone/mount/storj-backups --new-window"
Categories=Network;
StartupNotify=true
```

---

## Automatically backup your files (with file versioning) on Storj with Kopia

![City](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lu1lpigadlinrbv6rmsz.jpg)

Although we can sync files on Storj without any issue with Rclone. But it doesn't perform any file versioning, which would require at least a compression and an incremental backup mechanism. Otherwise, your file versions/history would fill up the entire storage quickly.

Many commercial cloud storage backup services provide this functionality through their desktop/mobile clients. However, Storj aims toward building an infrastructure for developers to build upon their backend. That's why they only provide basic functionalities through their web interface.

### Why would you need file versioning?

If you work with many files, mistakes can happen, so a reliable backup system can save you a lot of time since you don't have to redo your work again. However, Storj only provides basic functionalities for you in their web interface, i.e. upload and download files. Therefore, you will have to build this feature yourself.

Fortunately, this is very easy with **[Kopia](https://github.com/kopia/kopia)**, a cross-platform backup tool that supports incremental backups, client-side end-to-end encryption, compression and data deduplication. It can backup to S3 cloud storage through a very intuitive GUI, thus supported Storj.

---

### Setup Kopia for automatic backup with file versioning.

1. Install Kopia by going to **[Kopia's GitHub releases page](https://github.com/kopia/kopia/releases)**. Download the installer file or simply using the AppImage file. I recommend the AppImage version for openSUSE users since the RPM's version update checking doesn't work.

2. Setup a new backup by creating a new backup repository. Choose **Amazon S3 or Compatible Storage**, as shown in the screenshot below:

     ![Choosing Amazon S3 or Compatible Storage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iru8cf66fe8zcbtyzqif.png)

3. Fill in your access key, secret key, and endpoint for your S3 connection that you generated from Storj. Please note that the endpoint can't contain `https://`, just fill in only `gateway.storjshare.io`. Otherwise, the connection won't be established.

     ![Fill in S3 info](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o6adb7c6rigwugr0lt6h.png)

4. Choose the folder you want to backup and take a new snapshot. You can change the snapshot policies at this point, the UI is self-explainable.

     ![take a new snapshot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d4ms8amtnu6xwqplndds.png)

5. Wait for the first snapshot and upload to finish.

     ![Waiting](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ghrsfje1pn14z8keqsix.png)

6. The snapshot will look like this on Storj. These snapshot files require Kopia to open.

     ![Kopia files on Storj](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d50vpleo3jvuvns1t612.png)

7. You can click at the snapshot's path to manage each snapshots easily. You can also mount the snapshot on your system.

     ![snapshots](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/10g8dry5p36d8x1sy3tu.png)

     ![mount the snapshot on your system](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8csq6mzpk4tfekbzznyl.png)

> Note that Kopia is _not_ available on mobile yet. Therefore, you can't open Kopia's snapshot on mobile. You'll have to make priority on your files, i.e. if it needs to be viewed on other devices (not on PC) and not required any file versioning, use Rclone. If it's a working file, for example, a Blender file that can't be opened on mobile anyway, use Kopia.

---

## Mobile apps for Storj cloud

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ct1kil8c4okbqk51bmxw.jpg)

There are not many S3 file browser apps on mobile. However, there are some interesting apps that I use on mobile. They are **[S3Drive](https://play.google.com/store/apps/details?id=com.s3.drive.file.explorer.storage.cloud.manager)** and **[FolderSync](https://play.google.com/store/apps/details?id=dk.tacit.android.foldersync.lite)**.

---

I hope this helps anyone who wants to leave Google Drive. I leave Google Drive because Google doesn't provide Drive client on Linux, so I lost the ability to sync when I left Windows. Storj doesn't let me down, as I can use all the tools that support S3 connection "easily". However, I am still missing the face recognition feature on **[Google Photos](https://www.google.com/photos/about/)** 🥲

---

**Cover** Photo by **[moren hsu](https://unsplash.com/@moren?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)** on **[Unsplash](https://unsplash.com/photos/VLaKsTkmVhk?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)**

**Storm Troopers** Photo by **[Brian McGowan](https://unsplash.com/@sushioutlaw?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)** on **[Unsplash](https://unsplash.com/photos/LObpG0ku8VM?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)**

**In Space** Photo by **[The New York Public Library](https://unsplash.com/pt-br/@nypl?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)** on **[Unsplash](https://unsplash.com/images/nature/space?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)**
  

**City** Photo by **[Willian Justen de Vasconcellos](https://unsplash.com/de/@willianjusten?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)** on **[Unsplash](https://unsplash.com/photos/appgmXSgMMQ?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)**

**Kid** Photo by **[Yuri Shirota](https://unsplash.com/@itshoobastank?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)** on **[Unsplash](https://unsplash.com/photos/p0hDztR46cw?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)**