Algumas ou todas as informações nesta página podem não se aplicar à nuvem confiável da S3NS.
Monte um bucket do Cloud Storage usando o Cloud Storage FUSE
Saiba como montar um bucket do Cloud Storage como um sistema de arquivos local usando o
Cloud Storage FUSE. Assim, é possível interagir com seus objetos usando a semântica padrão
de sistema de arquivos.
Neste guia de início rápido, você concluirá as seguintes tarefas:
Instalar o Cloud Storage FUSE no Debian ou no Ubuntu
Montar o bucket como uma pasta na máquina
Fazer upload de um objeto para o bucket
Use a Google Cloud CLI para criar e gerenciar
o objeto no bucket de armazenamento e a
CLI do gcsfuse para montar o bucket na sua máquina.
Antes de começar
Para configurar um projeto, siga estas etapas:
-
In the Trusted Cloud console, on the project selector page,
click Create project to begin creating a new
Trusted Cloud project.
Go to project selector
-
Verify that billing is enabled for your Trusted Cloud project.
-
Make sure that you have the following role or roles on the project:
Storage Admin (roles/storage.admin
), Storage Bucket Viewer (roles/storage.bucketViewer
)
Check for the roles
-
In the Trusted Cloud console, go to the IAM page.
Go to IAM
-
Select the project.
-
In the Principal column, find all rows that identify you or a group that
you're included in. To learn which groups you're included in, contact your
administrator.
-
For all rows that specify or include you, check the Role column to see whether
the list of roles includes the required roles.
Grant the roles
-
In the Trusted Cloud console, go to the IAM page.
Acessar o IAM
-
Selecione o projeto.
-
Clique emperson_add Conceder acesso.
-
No campo Novos principais, digite seu identificador de usuário.
Normalmente, é o identificador de um usuário em um pool de identidades de força de trabalho. Saiba mais em
Representar usuários do pool de força de trabalho nas políticas do IAM ou entre em contato com seu administrador.
-
Na lista Selecionar papel, escolha um.
-
Para conceder outros papéis, clique em add Adicionar
outro papel e adicione cada papel adicional.
-
Clique em Salvar.
-
Install the Google Cloud CLI.
-
Configure a CLI gcloud para usar sua identidade federada.
Para mais informações, consulte
Fazer login na gcloud CLI com sua identidade federada.
-
Para inicializar a CLI gcloud, execute o seguinte comando:
gcloud init
- Tenha um bucket do Cloud Storage que você queira montar. Se você ainda não tiver um, crie um novo bucket.
Instale o Cloud Storage FUSE
Para instalar o Cloud Storage FUSE, siga as instruções em Instalar o Cloud Storage FUSE.
Monte o bucket
Para montar o bucket no sistema de arquivos local, siga estas etapas:
Gere o Application Default Credentials usando o
comando gcloud auth application-default login
:
gcloud auth application-default login
O Cloud Storage FUSE carrega automaticamente as credenciais.
Crie um diretório para montar o bucket de armazenamento:
mkdir "$HOME/mount-folder"
Monte o bucket de armazenamento usando o comando gcsfuse
:
gcsfuse BUCKET_NAME "$HOME/mount-folder"
Substitua BUCKET_NAME pelo nome do bucket que você quer montar.
Se bem-sucedido, o comando vai retornar uma saída com um texto semelhante ao seguinte:
File system has been successfully mounted.
faça upload de um objeto no bucket
Para fazer o download de um objeto de exemplo e fazer upload dele para o bucket montado, siga
estas etapas:

Clique com o botão direito na imagem e salve-a em algum lugar do computador, por exemplo, na área de trabalho.
Também é possível fazer o download da imagem usando o comando cURL
curl -O https://cloud.google.com/storage/images/kitten.png
.
Copie a imagem do local salvo para a pasta em que o bucket está
montado usando o comando cp
:
cp kitten.png "$HOME/mount-folder/kitten.png"
Verifique se a imagem foi copiada para o sistema de arquivos local e se o upload dela para o
bucket foi bem-sucedido seguindo as etapas:
Para verificar se kitten.png
foi copiado para o sistema de arquivos local, execute ls
na pasta em que o bucket está montado:
ls "$HOME/mount-folder"
Se a operação de cópia tiver sido bem-sucedida, kitten.png
será retornado na
saída.
Para listar o conteúdo do bucket, use o comando
gcloud storage ls
:
gcloud storage ls gs://BUCKET_NAME
Substitua BUCKET_NAME pelo nome do bucket.
Se o upload da imagem para o bucket foi bem-sucedido, kitten.png
será
retornado na saída.
Limpar
Para evitar cobranças na sua conta do Trusted Cloud by S3NS pelos recursos usados
nesta página, exclua os recursos seguindo estas etapas:
Desconecte o bucket de armazenamento da sua máquina Linux usando a ferramenta
fusermount
:
fusermount -u "$HOME/mount-folder"
Para excluir o bucket e tudo que estiver dentro dele, use o
comando gcloud storage rm
com o sinalizador --recursive
:
gcloud storage rm gs://BUCKET_NAME --recursive
Substitua BUCKET_NAME pelo nome do bucket.
Se for bem-sucedido, o comando retornará uma saída semelhante a esta:
Removing gs://my-bucket/kitten.png#1676488739323620...
Removing gs://my-bucket/...
A seguir
Exceto em caso de indicação contrária, o conteúdo desta página é licenciado de acordo com a Licença de atribuição 4.0 do Creative Commons, e as amostras de código são licenciadas de acordo com a Licença Apache 2.0. Para mais detalhes, consulte as políticas do site do Google Developers. Java é uma marca registrada da Oracle e/ou afiliadas.
Última atualização 2025-08-25 UTC.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Não contém as informações de que eu preciso","missingTheInformationINeed","thumb-down"],["Muito complicado / etapas demais","tooComplicatedTooManySteps","thumb-down"],["Desatualizado","outOfDate","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Problema com as amostras / o código","samplesCodeIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-08-25 UTC."],[],[],null,["# Mount a Cloud Storage bucket using Cloud Storage FUSE\n\nLearn how to mount a Cloud Storage bucket as a local filesystem using\n[Cloud Storage FUSE](/storage/docs/gcs-fuse), so you can interact with your objects using standard file\nsystem semantics.\n\nIn this quickstart, you'll complete the following tasks:\n\n- Install Cloud Storage FUSE on Debian or Ubuntu\n\n- Mount the bucket as a folder on the machine\n\n- Upload an object to the bucket\n\nYou'll use the [Google Cloud CLI](/sdk/gcloud) to create and manage\nthe object in your storage bucket, and you'll use the\n[gcsfuse CLI](https://github.com/GoogleCloudPlatform/gcsfuse) to mount your bucket to your machine.\n\nBefore you begin\n----------------\n\nTo set up a project, complete the following steps:\n\n- Sign in to your Google Cloud account. If you're new to Google Cloud, [create an account](https://console.cloud.google.com/freetrial) to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.\n- In the Google Cloud console, on the project selector page,\n click **Create project** to begin creating a new\n Google Cloud project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n-\n\n Make sure that you have the following role or roles on the project:\n\n Storage Admin (`roles/storage.admin`), Storage Bucket Viewer (`roles/storage.bucketViewer`)\n\n #### Check for the roles\n\n 1.\n In the Google Cloud console, go to the **IAM** page.\n\n [Go to IAM](https://console.cloud.google.com/projectselector/iam-admin/iam?supportedpurview=project)\n 2. Select the project.\n 3.\n In the **Principal** column, find all rows that identify you or a group that\n you're included in. To learn which groups you're included in, contact your\n administrator.\n\n 4. For all rows that specify or include you, check the **Role** column to see whether the list of roles includes the required roles.\n\n #### Grant the roles\n\n 1.\n In the Google Cloud console, go to the **IAM** page.\n\n [Go to IAM](https://console.cloud.google.com/projectselector/iam-admin/iam?supportedpurview=project)\n 2. Select the project.\n 3. Click person_add **Grant access**.\n 4.\n In the **New principals** field, enter your user identifier.\n\n This is typically the email address for a Google Account.\n\n 5. In the **Select a role** list, select a role.\n 6. To grant additional roles, click add **Add\n another role** and add each additional role.\n 7. Click **Save**.\n-\n [Install](/sdk/docs/install) the Google Cloud CLI.\n\n- If you're using an external identity provider (IdP), you must first\n [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n\n-\n To [initialize](/sdk/docs/initializing) the gcloud CLI, run the following command:\n\n ```bash\n gcloud init\n ```\n\n- In the Google Cloud console, on the project selector page,\n click **Create project** to begin creating a new\n Google Cloud project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n-\n\n Make sure that you have the following role or roles on the project:\n\n Storage Admin (`roles/storage.admin`), Storage Bucket Viewer (`roles/storage.bucketViewer`)\n\n #### Check for the roles\n\n 1.\n In the Google Cloud console, go to the **IAM** page.\n\n [Go to IAM](https://console.cloud.google.com/projectselector/iam-admin/iam?supportedpurview=project)\n 2. Select the project.\n 3.\n In the **Principal** column, find all rows that identify you or a group that\n you're included in. To learn which groups you're included in, contact your\n administrator.\n\n 4. For all rows that specify or include you, check the **Role** column to see whether the list of roles includes the required roles.\n\n #### Grant the roles\n\n 1.\n In the Google Cloud console, go to the **IAM** page.\n\n [Go to IAM](https://console.cloud.google.com/projectselector/iam-admin/iam?supportedpurview=project)\n 2. Select the project.\n 3. Click person_add **Grant access**.\n 4.\n In the **New principals** field, enter your user identifier.\n\n This is typically the email address for a Google Account.\n\n 5. In the **Select a role** list, select a role.\n 6. To grant additional roles, click add **Add\n another role** and add each additional role.\n 7. Click **Save**.\n-\n [Install](/sdk/docs/install) the Google Cloud CLI.\n\n- If you're using an external identity provider (IdP), you must first\n [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n\n-\n To [initialize](/sdk/docs/initializing) the gcloud CLI, run the following command:\n\n ```bash\n gcloud init\n ```\n\n1. Have a Cloud Storage bucket that you want to mount. If you don't already have one, [create a new\n bucket](/storage/docs/creating-buckets).\n\n\u003cbr /\u003e\n\nInstall Cloud Storage FUSE\n--------------------------\n\nTo install Cloud Storage FUSE, follow the instructions in [Install Cloud Storage FUSE](/storage/docs/cloud-storage-fuse/install).\n\nMount the bucket\n----------------\n\nTo mount the bucket to your local file system, complete the following steps:\n\n1. Generate Application Default Credentials using the\n `gcloud auth application-default login` command:\n\n ```\n gcloud auth application-default login\n ```\n\n Cloud Storage FUSE automatically loads the credentials.\n2. Create a directory to mount the storage bucket to:\n\n ```\n mkdir \"$HOME/mount-folder\"\n ```\n3. Mount your storage bucket using the `gcsfuse` command:\n\n ```\n gcsfuse BUCKET_NAME \"$HOME/mount-folder\"\n ```\n\n Replace \u003cvar translate=\"no\"\u003eBUCKET_NAME\u003c/var\u003e with the name of the bucket you want to mount.\n\n If successful, the command returns output which contains text similar to the following: \n\n ```\n File system has been successfully mounted.\n ```\n\nUpload an object into the bucket\n--------------------------------\n\nTo download an example object and upload it to the mounted bucket, complete the\nfollowing steps:\n\n1. Right-click the image and save it somewhere on your computer,\n such as on the desktop.\n\n You can also download the image using the cURL command\n `curl -O https://cloud.google.com/storage/images/kitten.png`.\n2. Copy the image from its saved location to the folder where your bucket is\n mounted, using the `cp` command:\n\n ```\n cp kitten.png \"$HOME/mount-folder/kitten.png\"\n ```\n3. Verify that the image was copied to your local file system and uploaded to the\n bucket successfully by following the steps:\n\n 1. To check that `kitten.png` was copied to your local file system, run `ls`\n on the folder where your bucket is mounted:\n\n ```\n ls \"$HOME/mount-folder\"\n ```\n\n If the copy operation was successful, `kitten.png` is returned in the\n output.\n 2. To list the contents of your bucket, use the `gcloud storage ls`\n command:\n\n ```\n gcloud storage ls gs://BUCKET_NAME\n ```\n\n Replace \u003cvar translate=\"no\"\u003eBUCKET_NAME\u003c/var\u003e with the name of your bucket.\n\n If the image was successfully uploaded to your bucket, `kitten.png` is\n returned in the output.\n\nClean up\n--------\n\nTo avoid incurring charges to your Google Cloud account for the resources used\non this page, delete the resources by completing the following steps:\n\n1. Unmount the storage bucket from your Linux machine by using the `fusermount`\n tool:\n\n ```\n fusermount -u \"$HOME/mount-folder\"\n ```\n2. To delete the bucket and everything inside of it, use the\n `gcloud storage rm` command with the `--recursive` flag:\n\n ```\n gcloud storage rm gs://BUCKET_NAME --recursive\n ```\n\n Replace \u003cvar translate=\"no\"\u003eBUCKET_NAME\u003c/var\u003e with the name of your bucket.\n\n If successful, the command returns output similar to the following:\n\n \u003cbr /\u003e\n\n ```\n Removing gs://my-bucket/kitten.png#1676488739323620...\n Removing gs://my-bucket/...\n ```\n\n \u003cbr /\u003e\n\nWhat's next\n-----------\n\n- Get a [detailed overview of Cloud Storage FUSE](/storage/docs/gcs-fuse).\n\n- Read about ways to [mount buckets for different use cases](/storage/docs/cloud-storage-fuse/mount-bucket#examples).\n\n\u003c!-- --\u003e\n\n- Learn how [Vertex AI uses Cloud Storage FUSE](/vertex-ai/docs/training/code-requirements#fuse) to mount Cloud Storage buckets for custom training jobs."]]