Mapping bucket to the local instance on google cloud
Last updated
Was this helpful?
Last updated
Was this helpful?
You will need gcsfuse to map a bucket to your instance. Instructions to install on Linux and Mac are below. The github link is.
Before invoking gcsfuse, you must have a GCS bucket that you want to mount. If your bucket doesn't yet exist, create one using the .
Make sure .
GCS credentials are automatically loaded using , or a JSON key file can be specified explicitly using --key-file
. If you haven't already done so, the easiest way to set up your credentials for testing is to run the :
See for more information on credentials.
To mount a bucket using gcsfuse over an existing directory /path/to/mount
, invoke it like this:
Important: You should run gcsfuse as the user who will be using the file system, not as root. Do not use sudo
.
The gcsfuse tool will exit successfully after mounting the file system. Unmount in the usual way for a fuse file system on your operating system:
If you are mounting a bucket that was populated with objects by some other means besides gcsfuse, you may be interested in the --implicit-dirs
flag. See the notes in for more information.
gcsfuse has been tested successfully with the following operating systems:
Linux (minimum kernel version 3.10)
OS X (minimum version 10.10.2)
It may or may not work correctly with other operating systems and older versions.
ubuntu-1804-lts
, ubuntu-1604-lts
, and ubuntu-1404-lts
debian-8
, debian-7
centos-7
, centos-6
rhel-7
, rhel-6
sles-12
If you are running Linux on a 64-bit x86 machine and are happy to install pre-built binaries (i.e. you don't want to build from source), you need only ensure fuse is installed, then download and install the latest release package. The instructions vary by distribution.
Add the gcsfuse distribution URL as a package source and import its public key:
Update the list of packages available and install gcsfuse.
(Ubuntu before wily only) Add yourself to the fuse
group, then log out and back in:
Future updates to gcsfuse can be installed in the usual way: sudo apt-get update && sudo apt-get upgrade
.
The following instructions set up yum
to see updates to gcsfuse, and work for CentOS 7 and RHEL 7. Users of older releases should follow the instructions for other distributions below.
Configure the gcsfuse repo:
Make the system aware of the new repo:
Be sure to answer "yes" to any questions about adding the GPG signing key.
Install gcsfuse:
Be sure to answer "yes" to any questions about adding the GPG signing key.
Future updates to gcsfuse will automatically show up when updating with yum
.
Ensure that dependencies are present:
Download and install the latest release package:
Ensure that dependencies are present:
If you are on a distribution that uses .rpm
files for package management:
Or one that uses .deb
files:
On some systems it may be necessary to add the your user account to the fuse
group in order to have permission to run fusermount
(don't forget to log out and back in afterward for the group membership change to take effect):
First, handle prerequisites:
Afterward, gcsfuse can be installed with brew
:
The second command is only necessary if you want to use gcsfuse with the mount
command or in your /etc/fstab
file, as opposed to calling gcsfuse
directly.
In the future gcsfuse can be updated in the usual way for homebrew packages:
Prerequisites:
Fuse. See the instructions for the binary release above.
Git. This is probably available as git
in your package manager.
To install or update gcsfuse, run:
This will fetch the gcsfuse sources to $GOPATH/src/github.com/googlecloudplatform/gcsfuse
, build them, and install a binary named gcsfuse
to $GOPATH/bin
.
If you are running on , it is recommended that you use one of the following images with which it has been tested (preferring the latest version when possible):
The following instructions set up apt-get
to see updates to gcsfuse, and are supported for the bionic, artful, zesty, yakkety, xenial, and trusty of Ubuntu, and the jessie and stretch of Debian. (Run lsb_release -c
to find your release codename.) Users of older releases should follow the instructions for other distributions below.
Available from and can be installed with any AUR helper.
Install .
Install (or use a different program for downloading below).
Old versions of Debian contain a that causes /dev/fuse
to repeatedly lose its permission settings. If you find that you receive permissions errors when mounting, even after running the usermod
instruction above and logging out and back in, you may need to fix the permissions:
Install .
Install the package manager.
A working installation at least as new as . See .
Because we use the , you must ensure that the appropriate variable is set in your environment: