Gcsfuse & freepbx (FreePBX is unable to write to folder mounted with gcsfuse and the sync stops)

I am running freepbx Centos on a GCE VM. Syncing stops when FreePBX/Asterisk tries to write and create a folder in the mounted folder and FreePBX is unable to write / create folder in the folder. Everything works again when the system is rebooted because gcsfuse is no longer mounted.

Gcsfuse works when: .

-create a folder /var/spool/asterisk/cloud.
-mount it using gcsfuse --implicit-dirs siphqrecordings /var/spool/asterisk/cloud.
-create a sample text file nano test.txt.
-it syncs up to my bucket just fine

It completely stops working when:

-FreePBX tries to place a file and folder in the directory (a recorded call), the folder and file never gets written. I have unmount/reboot the server and then freepbx is able to use the folder and write files and directories to it. Even if I try to create a manual file using nano it never sync up.

FreePBX is unable to write to folder mounted with gcsfuse and the sync stops even for manually created files.

Thank you!

I guess you already checked but is the FS mounted with the appropriate owner and permissions?

good question, do you know how I would check?

Mount the FS and do an ls -al on the mount point, it should show you the owner.

This post seem talking about similar issue.

Google Cloud is probably not the most economic way of doing things, mounting an alien file system is probably not the most efficient way of doing things either, have you looked at Vultr or Digitalocean for a simpler solution?

Ooooh it’s owned by root, any idea how to change it?

drwxr-xr-x 1 root root 0 Nov 21 15:45 cloud
drwxrwxr-x. 2 asterisk asterisk 6 May 2 2018 fax
drwxrwxr-x. 2 asterisk asterisk 6 Nov 21 15:44 incron

I think I need to somehow mount it in FSTAB but dont know how… There are some details at the bottom of this page but I cant figure it out.

OK I got it to work:

nano /etc/fstab

mybucket /var/spool/asterisk/cloud gcsfuse rw,allow_other,file_mode=777,dir_mode=777

1 Like

How to mount a google storage bucket for storage of call recordings or syncing of any directory:

Step 1 – install Cloud SDK:

Update YUM with Cloud SDK repo information:

sudo tee -a /etc/yum.repos.d/google-cloud-sdk.repo << EOM
[google-cloud-sdk]
name=Google Cloud SDK
baseurl=https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOM

Install the Cloud SDK:

yum install google-cloud-sdk

Run gcloud init to get started:

gcloud init

Step 2 install gcsfuse:

Configure the gcsfuse repo:

sudo tee /etc/yum.repos.d/gcsfuse.repo > /dev/null <<EOF[gcsfuse]name=gcsfuse (packages.cloud.google.com)baseurl=https://packages.cloud.google.com/yum/repos/gcsfuse-el7-x86_64enabled=1gpgcheck=1repo_gpgcheck=1gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpgEOF

Make the system aware of the new repo:

sudo yum update

Be sure to answer “yes” to any questions about adding the GPG signing key.

Install gcsfuse:

sudo yum install gcsfuse

Be sure to answer “yes” to any questions about adding the GPG signing key.

Create a directory you want to sync.

$ mkdir /path/to/mount

Create the bucket you wish to mount, if it doesn’t already exist, using the Google Cloud Console.

Use Cloud Storage FUSE to mount the bucket (e.g. example-bucket).

$ gcsfuse example-bucket /path/to/mount

Edit fstab (this step is important)

nano /etc/fstab

mybucket /var/spool/asterisk/cloud gcsfuse rw,allow_other,file_mode=777,dir_mode=777

Stop your VM in GCE console, once it’s stopped edit the VM and scroll to the bottom the Cloud API access scopes section. Change the storage API to full access. (stopping the VM is important, you need to reboot for the fstab config to take affect and properly mount, also you must allow full access to the storage api)

Start the VM.

Once it boots up the directory will now be mounted to a google storage bucket.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.