Prerequisites

Before you begin, make sure you have the following:

  • A Linux machine
  • Rclone installed on your Linux machine
  • A GCS bucket created
  • GCS API credentials

Step 1: Create a configuration file for Rclone

First, create a directory for the Rclone configuration file:

mkdir -p ~/.config/rclone

Then, create the configuration file itself:

touch ~/.config/rclone/rclone.conf

Step 2: Configure Rclone

Next, configure Rclone to access your GCS bucket by adding the following to the configuration file:

[gc]
type = gcs
project_id = <your project id here>
object_acl = bucketOwnerFullControl
token = {"<your token here>"}

Step 3: Create a mount point

Create a directory where you want to mount your GCS bucket:

mkdir -p ~/gc

Step 4: Mount GCS using Rclone

Now, you can mount your GCS bucket by running the following command:

rclone mount gc: <path to mount point> &

For example, to mount the GCS bucket to the ~/gc directory, you would run:

rclone mount gc: ~/gc &

Step 5: Automount on startup

To make sure that your GCS bucket is automatically mounted on startup, add the mount command to your crontab:

(crontab -l 2>/dev/null; echo "@reboot rclone mount gc: $HOME/gc/ &") | crontab -

Conclusion

And that’s it! Your GCS bucket is now successfully mounted on your Linux machine and will be automatically mounted on startup. You can access the files in the GCS bucket by going to the mount point directory (~/gc in the example above). Keep in mind that you need to make sure you have the right permissions to access the GCS bucket and the files inside it.