Managing files directly from cloud storage services—like Amazon S3, Google Cloud Storage (GCS), and Backblaze B2—can simplify your workflows. By mounting these services into your local filesystem, you gain the convenience of interacting with them as if they were ordinary directories on your server. Below, we’ll explore three methods to achieve this on a Linux environment.
Mounting S3 Buckets with s3fs-fuse
Step 1: Install s3fs-fuse
On Ubuntu or Debian-based systems, run:
sudo apt-get update
sudo apt-get install s3fs
Step 2: Configure Credentials
Create a file (e.g., /etc/passwd-s3fs
) containing your AWS Access Key ID and Secret Access Key in the format:
AWS_ACCESS_KEY_ID:AWS_SECRET_ACCESS_KEY
Then secure it so only root can read or write:
sudo chmod 600 /etc/passwd-s3fs
Step 3: Mount Your S3 Bucket
Create a mount point and mount the bucket:
sudo mkdir /mnt/s3
sudo s3fs mybucket /mnt/s3 -o passwd_file=/etc/passwd-s3fs
Replace mybucket
with the name of your S3 bucket. You can now access the contents of mybucket
at /mnt/s3
just like any local directory.
Mounting Google Cloud Storage with gcsfuse
Step 1: Install gcsfuse
For Ubuntu or Debian-based systems, add the GCSFUSE repository and install:
export GCSFUSE_REPO=gcsfuse-`lsb_release -c -s`
echo "deb http://packages.cloud.google.com/apt $GCSFUSE_REPO main" | sudo tee /etc/apt/sources.list.d/gcsfuse.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo apt-get update
sudo apt-get install gcsfuse
Step 2: Authenticate with GCP
Ensure you have the Google Cloud SDK installed, then log in:
gcloud auth login
gcloud config set project [YOUR_PROJECT_ID]
Step 3: Mount Your GCS Bucket
Create a mount point and use gcsfuse to mount your bucket:
sudo mkdir /mnt/gcs
gcsfuse my-gcs-bucket /mnt/gcs
Replace my-gcs-bucket
with the actual name of your bucket. You can now see all your GCS objects at /mnt/gcs
.
Mounting Backblaze B2 with rclone
Backblaze B2 supports an S3-compatible API—which can be used with s3fs
—but using rclone
is a popular alternative that supports many cloud providers.
Step 1: Install rclone
On Ubuntu or Debian-based systems:
curl https://rclone.org/install.sh | sudo bash
Step 2: Configure rclone
Run:
rclone config
Follow the prompts to create a new remote for Backblaze B2. You’ll need your Account ID and Application Key.
Step 3: Mount B2
Create a mount point and mount the remote:
sudo mkdir /mnt/b2
rclone mount b2-remote:my-bucket /mnt/b2 --daemon
Replace b2-remote
with the name you gave your B2 remote, and my-bucket
with the name of your bucket. The --daemon
flag allows the process to run in the background.
Mounting cloud storage services into your local filesystem provides a convenient way to manage files without switching between local and web-based interfaces. Each tool—s3fs
for Amazon S3, gcsfuse
for Google Cloud Storage, and rclone
(or s3fs
) for Backblaze B2—has unique options for caching, performance, and security. Before deploying these in a production environment, review resource usage, network latency, and potential costs, as large data transfers can quickly add up. By keeping an eye on both performance and budgeting factors, you can make the most of your cloud storage while maintaining a smooth workflow.