Cloud Guru Online

We simplify everything!

Mounting a Google Cloud Storage bucket into CentOS/Ubuntu/Debian server

Step 1: Create a GCP Cloud Storage bucket

In navigation menu at top left, Storage >> Buckets >> Click on Create

Name your bucket Pick a globally unique, permanent name -- You can use underscore to get unique names example : google_custom_bucket_2023 
Choose where to store your data -- select Region and a location of your choice.
Choose a storage class for your data - Select Coldline
(more details on storage classes
Choose how to control access to objects --- Keep Default
Choose how to protect object data  --- Keep Default

Step 2: Add a service account that needs to have access to that bucket

Navigation Menu (Top left) >> IAM & Admin >> Service Accounts >> Create Service Account

Add a unique name, and press Create
In the grant service account access step, select Cloud Storage > Storage Object Admin
Skip grant user step

Now locate the created service account from the list, and click the three dots under Actions, and select Create Key , in dialog box, select JSON (this is the default option selected) and click create. A json file will get downloaded to your computer.

Step 3: Install GCSFuse on the server

Installing on Ubuntu / Debian

export GCSFUSE_REPO=gcsfuse-lsb_release -c -s
echo “deb $GCSFUSE_REPO main” | sudo tee /etc/apt/sources.list.d/gcsfuse.list
curl | sudo apt-key add –
sudo apt-get update
sudo apt-get install gcsfuse

Installing for RHEL/CentOS

sudo tee /etc/yum.repos.d/gcsfuse.repo > /dev/null <<EOF
name=gcsfuse (

sudo yum install -y gcsfuse

Step 4: Mount the bucket

Upload the json file to safe location in server example /root
Create mount point “mkdir /backup/newbackup”

Run below command:

gcsfuse --key-file /root/steady-grid-2354105-96908911eed7.json google_custom_bucket_2023 /backup/newbackup

The result will be:

[root@backup ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 3.1G 0 3.1G 0% /dev
tmpfs 3.1G 0 3.1G 0% /dev/shm
tmpfs 3.1G 49M 3.1G 2% /run
tmpfs 3.1G 0 3.1G 0% /sys/fs/cgroup
/dev/sda2 55G 7.5G 48G 14% /
/dev/sda1 200M 12M 189M 6% /boot/efi
/dev/sdb1 4.0T 3.8T 154G 97% /backup
tmpfs 631M 0 631M 0% /run/user/0
google_custom_bucket_2023 1.0P 0 1.0P 0% /backup/newbackup

Now you can simply copy files/folders to /backup/newbackup, it will be automatically uploaded to Google cloud storage.

If you face any issues, please let me know in the comments sections.