Read/Write data to/from Cloud Storage Bucket using gcsfuse

1.4k views Asked by At

To mount Google Cloud Storage Bucket onto a directory on a local machine for processing. Using a manjaro environment and installed gcsfuse manually.

in the gs://bucket01, there are directories containing jpg and json files

go get -u github.com/googlecloudplatform/gcsfuse
$GOPATH/src/github.com/googlecloudplatform/gcsfuse

GOOGLE_APPLICATION_CREDENTIALS=/run/media/manjaro/gcp/key.json gcsfuse bucket01 /run/media/manjaro/gcp/bucket01

Using mount point: /run/media/manjaro/gcp/bucket01
Opening GCS connection...
Mounting file system...
File system has been successfully mounted.

cd /run/media/manjaro/gcp/bucket01
ls

# empty
# The expected outcome is data from gs://bucket01 populates /run/media/manjaro/gcp/bucket01
# Updates in /run/media/manjaro/gcp/bucket01 will also be seen in gs://bucket01

Am i using gcsfuse correctly?

1

There are 1 answers

1
marian.vladoi On BEST ANSWER

Please try using Implicit directories

As mentioned above, by default there is no allowance for the implicit existence of directories. Since the usual file system operations like mkdir will do the right thing, if you set up a bucket's structure using only gcsfuse then you will not notice anything odd about this. If, however, you use some other tool to set up objects in GCS (such as the storage browser in the Google Developers Console), you may notice that not all objects are visible until you create leading directories for them.

gcsfuse supports a flag called --implicit-dirs that changes the behavio