Mounting google storage bucket folder using gcsfuse
Asked Answered
S

4

6

I am not able to mount a specific folder inside the google storage bucket

On OS X, this program allows you to mount buckets using the mount command. (On Linux, only root can do this.)

mount -t gcsfuse -o rw,user my-bucket /path/to/mount/point

On both OS X and Linux, you can also add entries to your /etc/fstab file like the following:

my-bucket /mount/point gcsfuse rw,noauto,user

Can somebody help me?

my-bucket:foldername /mount/point gcsfuse rw,noauto,user

This doesn't work for me

Stoneware answered 21/12, 2015 at 7:24 Comment(1)
Where did you come up with the syntax my-bucket:foldername? Is that a widely used syntax for other file systems? (If so, do you mind linking to some examples?)Reconcilable
R
9

Mounting a specific directory within a bucket isn't supported for use with mount and fstab, but if you run the gcsfuse command directly you can do this with the flag --only-dir:

gcsfuse --only-dir foldername/ my-bucket /mount/point
Reconcilable answered 13/1, 2016 at 10:1 Comment(0)
D
2

If you have installed gcsfuse, you can mount an specific directory of the google cloud bucket using the only_dir (for example only_dir=/foldername/) parameter in the /etc/fstab line.

my-bucket /mount/point gcsfuse rw,noauto,user,key_file=/home/ubuntu/key-gcp-storage.json,only_dir=/foldername/

This works for me in Ubuntu 18.

Delineator answered 23/10, 2018 at 20:13 Comment(0)
R
1

gcfuse allows you to mount a bucket subfolder with content, using the flags --implicit-dirs (takes care of the content recursively) and --only-dir (mounts only a subdirectory).

Be careful with the syntax. The command is:

gcsfuse --implicit-dirs --only-dir <subdir-relative-to-bucket> <bucket> <mount_point>

For example, in the cloud I have a bucket with the root my_bucket and a subdir my_bucket/sub_dir/sub_sub_dir which I want to mount into the local dir mount_dir, then I do

gcsfuse --implicit-dirs --only-dir sub_dir/sub_sub_dir my_bucket mount_dir
Roughcast answered 3/10, 2023 at 15:30 Comment(0)
M
0

In my case, the folder was not created at the destination. I was trying to mount to specific path in bucket and in that bucket, I did create that path.

Creating that path resolved the issue..

Motorcar answered 8/7, 2022 at 11:53 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.