Beberapa atau semua informasi di halaman ini mungkin tidak berlaku untuk Trusted Cloud oleh S3NS.
Memasang bucket Cloud Storage menggunakan Cloud Storage FUSE
Pelajari cara memasang bucket Cloud Storage sebagai sistem file lokal menggunakan
Cloud Storage FUSE, sehingga Anda dapat berinteraksi dengan objek menggunakan semantik sistem
file standar.
Dalam panduan memulai ini, Anda akan menyelesaikan tugas berikut:
Menginstal Cloud Storage FUSE di Debian atau Ubuntu
Memasang bucket sebagai folder di mesin
Mengupload objek ke bucket
Anda harus menggunakan Google Cloud CLI untuk membuat dan mengelola objek di bucket penyimpanan, dan menggunakan
gcsfuse CLI untuk memasang bucket ke mesin Anda.
Sebelum Anda memulai
Untuk menyiapkan project, selesaikan langkah-langkah berikut:
-
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.
Buka IAM
-
Pilih project.
-
Klik person_add Berikan akses.
-
Di kolom Akun utama baru, masukkan ID pengguna Anda.
Biasanya, ini adalah ID untuk pengguna dalam workforce identity pool. Untuk mengetahui detailnya,
lihat
Merepresentasikan pengguna kumpulan tenaga kerja dalam kebijakan IAM, atau hubungi administrator Anda.
-
Di daftar Pilih peran, pilih peran.
-
Untuk memberikan peran tambahan, klik add Tambahkan
peran lain, lalu tambahkan setiap peran tambahan.
-
Klik Simpan.
-
Install the Google Cloud CLI.
-
Konfigurasi gcloud CLI untuk menggunakan identitas gabungan Anda.
Untuk mengetahui informasi selengkapnya, lihat
Login ke gcloud CLI dengan identitas gabungan Anda.
-
Untuk melakukan inisialisasi gcloud CLI, jalankan perintah berikut:
gcloud init
- Memiliki bucket Cloud Storage yang ingin Anda pasang. Jika Anda belum
memilikinya, buat bucket
baru.
Menginstal Cloud Storage FUSE
Untuk menginstal Cloud Storage FUSE, ikuti petunjuk di Menginstal Cloud Storage FUSE.
Memasang bucket
Untuk memasang bucket ke sistem file lokal, selesaikan langkah-langkah berikut:
Buat Kredensial Default Aplikasi menggunakan
perintah gcloud auth application-default login
:
gcloud auth application-default login
Cloud Storage FUSE memuat kredensial secara otomatis.
Buat direktori untuk memasang bucket penyimpanan ke:
mkdir "$HOME/mount-folder"
Pasang bucket penyimpanan Anda menggunakan perintah gcsfuse
:
gcsfuse BUCKET_NAME "$HOME/mount-folder"
Ganti BUCKET_NAME dengan nama bucket yang ingin Anda pasang.
Jika berhasil, perintah akan menampilkan output yang berisi teks yang mirip dengan berikut ini:
File system has been successfully mounted.
Mengupload objek ke dalam bucket
Untuk mendownload objek contoh dan menguploadnya ke bucket yang terpasang, selesaikan
langkah-langkah berikut:

Klik kanan gambar dan simpan di mana saja di komputer Anda,
misalnya di desktop.
Anda juga dapat mendownload gambar menggunakan perintah cURL
curl -O https://cloud.google.com/storage/images/kitten.png
.
Salin gambar dari lokasi tersimpannya ke folder tempat bucket Anda
dipasang, menggunakan perintah cp
:
cp kitten.png "$HOME/mount-folder/kitten.png"
Pastikan gambar telah disalin ke sistem file lokal dan berhasil diupload ke
bucket dengan mengikuti langkah-langkah berikut:
Untuk memeriksa apakah kitten.png
telah disalin ke sistem file lokal, jalankan ls
di folder tempat bucket Anda dipasang:
ls "$HOME/mount-folder"
Jika operasi penyalinan berhasil, kitten.png
akan ditampilkan dalam
output.
Untuk menampilkan daftar isi bucket, gunakan
perintah gcloud storage ls
:
gcloud storage ls gs://BUCKET_NAME
Ganti BUCKET_NAME dengan nama bucket Anda.
Jika gambar berhasil diupload ke bucket Anda, kitten.png
akan
ditampilkan dalam output.
Pembersihan
Agar tidak menimbulkan biaya pada akun Trusted Cloud by S3NS Anda untuk resource yang digunakan di halaman ini, hapus resource dengan menyelesaikan langkah-langkah berikut:
Lepaskan bucket penyimpanan dari mesin Linux menggunakan alat
fusermount
:
fusermount -u "$HOME/mount-folder"
Untuk menghapus bucket dan semua yang ada di dalamnya, gunakan
perintah gcloud storage rm
dengan flag --recursive
:
gcloud storage rm gs://BUCKET_NAME --recursive
Ganti BUCKET_NAME dengan nama bucket Anda.
Jika berhasil, perintah akan menampilkan output yang mirip dengan berikut ini:
Removing gs://my-bucket/kitten.png#1676488739323620...
Removing gs://my-bucket/...
Langkah berikutnya
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-08-25 UTC.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Informasi yang saya butuhkan tidak ada","missingTheInformationINeed","thumb-down"],["Terlalu rumit/langkahnya terlalu banyak","tooComplicatedTooManySteps","thumb-down"],["Sudah usang","outOfDate","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Masalah kode / contoh","samplesCodeIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 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."]]