Bucket uploaded file not shown in all mounted VMs

292 Views Asked by At

I have a Google Cloud Storage Bucket which is mounted to 3 virtual machines using fstab.

When I upload a file from another machine to google bucket using gsutil command, the uploaded file is accessible from only 2 vms (Set A). The other vm (Set B) doens't show the newly uploaded file.

fstab entry used for mounting is as follows.

bucket_name mounted_path gcsfuse rw,uid=1002,gid=1003,user,allow_other,key_file=key_file_path

Content of /etc/mtab file from Set A is as follows.

bucket_name mounted_path fuse rw,nosuid,nodev,relatime,user_id=1002,group_id=1003,default_permissions 0 0

Content of /etc/mtab file from Set B is as follows.

bucket_name mounted_path fuse fuse rw,nosuid,nodev,noexec,relatime,user_id=0,group_id=0,default_permissions,allow_other 0 0
1

There are 1 best solutions below

0
On

Here is how I do mounting Storage Buckets on VMs:

  • create a VM instance and give it Storage "full" access scope. if you have already a VM, edit that VM with this scope. note that you need to stop the VM to edit it's access scope.
  • install gcsfuse on your instance if you haven't already
  • create a directory on where you want to mount your bucket mkdir /path/to/bucket
  • go to Cloud Storage and edit your bucket permissions by adding the compute engine default service account as a Storage Admin, you can find this service account in IAM&admin --> service account, it has this structure [email protected]
  • use gcsfuse bucket_name /path/to/bucket to mount your bucket. here gcsfuse will use the default service account to verify access and make the connection. this is the easiest way as it conclude few steps
  • now any file you upload to your bucket will appear in VMs bucket mounting folder /path/to/bucket

Read more about this process here