Cloud Storage-Bucket mit Cloud Storage FUSE bereitstellen
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Informationen dazu, wie Sie einen Cloud Storage-Bucket als lokales Dateisystem mit Cloud Storage FUSE bereitstellen, damit Sie mit der Standardsemantik des Dateisystems mit Ihren Objekten interagieren können.
In dieser Kurzanleitung führen Sie die folgenden Aufgaben aus:
Cloud Storage FUSE unter Debian oder Ubuntu installieren
Bucket als Ordner auf dem Computer bereitstellen
Objekt in den Bucket hochladen
Sie verwenden die Google Cloud CLI, um das Objekt in Ihrem Storage-Bucket zu erstellen und zu verwalten, und Sie verwenden die gcsfuse CLI, um Ihren Bucket auf Ihrem Computer bereitzustellen.
Hinweis
So richten Sie ein Projekt ein:
Sign in to your Google Cloud account. If you're new to
Google Cloud,
create an account to evaluate how our products perform in
real-world scenarios. New customers also get $300 in free credits to
run, test, and deploy workloads.
In the Google Cloud console, on the project selector page,
click Create project to begin creating a new
Google 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)
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.
Make sure that you have the following role or roles on the project:
Storage Admin (roles/storage.admin), Storage Bucket Viewer (roles/storage.bucketViewer)
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.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 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."]]