Nour Sofanati
Developer, SimpleBackups
February 24, 2025
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.
On Ubuntu or Debian-based systems, run:
sudo apt-get update
sudo apt-get install s3fs
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
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.
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
Ensure you have the Google Cloud SDK installed, then log in:
gcloud auth login
gcloud config set project [YOUR_PROJECT_ID]
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
.
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.
On Ubuntu or Debian-based systems:
curl https://rclone.org/install.sh | sudo bash
Run:
rclone config
Follow the prompts to create a new remote for Backblaze B2. You’ll need your Account ID and Application Key.
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.
Free 7-day trial. No credit card required.
Have a question? Need help getting started?
Get in touch via chat or at [email protected]