Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Memasang instance Filestore ke VM Cloud TPU
Filestore adalah Network Attached Storage (NAS) yang terkelola sepenuhnya untuk Compute Engine. Filestore menawarkan kompatibilitas native dengan aplikasi perusahaan yang ada dan mendukung klien yang kompatibel dengan NFSv3.
Sebelum memulai
Untuk memasang instance Filestore di VM Cloud TPU, Anda
harus menambahkan peran Filestore (Cloud Filestore Editor atau Cloud
Filestore Viewer) ke akun layanan yang terkait dengan VM Cloud TPU Anda. Jika Anda tidak menentukan akun layanan kustom saat membuat VM Cloud TPU, VM Cloud TPU Anda akan menggunakan akun layanan Compute Engine default. Untuk mengetahui informasi selengkapnya tentang cara menentukan akun layanan saat membuat VM Cloud TPU, lihat Menyiapkan lingkungan Cloud TPU.
Untuk mengetahui informasi selengkapnya tentang cara membuat akun layanan, lihat
Membuat akun layanan.
Menambahkan peran Filestore Editor ke akun layanan
Petunjuk berikut menunjukkan cara menambahkan peran Cloud Filestore Editor ke akun layanan default Compute Engine. Anda dapat mengikuti petunjuk ini untuk menambahkan peran Cloud Filestore Editor ke akun layanan mana pun. Anda dapat menelusuri dan menggunakan akun layanan kustom, bukan akun layanan default Compute Engine, pada langkah 2.
Pasang instance Filestore di VM Cloud TPU ke direktori pemasangan Anda. Ganti filestore-ip, file-share-name,
mount-dir dengan alamat IP FileStore, nama berbagi file,
dan direktori pemasangan Anda.
Slice Cloud TPU terdiri dari 2 VM Cloud TPU atau lebih. Perintah
berikut menggunakan perintah gcloud compute tpus tpu-vm ssh dengan
flag --worker=all dan --command untuk menjalankan perintah di semua VM Cloud TPU
sekaligus.
Instal paket nfs-common di semua VM Cloud TPU di
slice Anda.
Pasang instance Filestore di slice Cloud TPU Anda.
Ganti filestore-ip, file-share-name,
mount-dir dengan alamat IP FileStore, nama berbagi file,
dan direktori pemasangan Anda.
gcloudcomputetpustpu-vmsshyour-tpu-name\--project=your-gcp-project\--zone=your-zone\--worker=all\--command="sudo mount filestore-ip:file-share-namemount-dir"
Menulis data ke instance Filestore
Pastikan Anda memberikan izin baca dan tulis Linux di direktori tempat
Anda memasang instance Filestore. Anda dapat menggunakan direktori seperti
sistem file lokal Anda.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-04 UTC."],[],[],null,["# Mount a Filestore instance to Cloud TPU VMs\n\nMount a Filestore instance to\nCloud TPU VMs\n===========================================\n\nFilestore is a fully managed network attached storage (NAS) for\nCompute Engine. Filestore offers native compatibility with existing\nenterprise applications and supports any NFSv3-compatible client.\n\nBefore you begin\n----------------\n\nIn order to mount a Filestore instance on your Cloud TPU VM, you\nneed to add a Filestore role (Cloud Filestore Editor or Cloud\nFilestore Viewer) to the service account associated with your\nCloud TPU VM. If you don't specify a custom service account when\nyou create a Cloud TPU VM, your Cloud TPU VM uses the default\nCompute Engine service account. For more information about how to specify a\nservice account when creating a Cloud TPU VM, see\n[Set up the Cloud TPU environment](/tpu/docs/setup-gcp-account#prepare-to-request).\nFor more information about how to create a service account, see\n[Create service accounts](/iam/docs/service-accounts-create).\n\n### Add the Filestore Editor role to a service account\n\nThe following instructions show you how to add the Cloud Filestore\nEditor role to the Compute Engine default service account. You can follow these\ninstructions to add the Cloud Filestore Editor role to any service\naccount. You can search and use a custom service account instead of the\nCompute Engine default service account in step 2.\n\n1. Open the [IAM console](https://console.cloud.google.com/iam-admin/iam).\n\n2. Select the **View by principals** tab and type `Name:Compute Engine default\n service account` in the **Filter** field.\n\n3. Click edit next to the service account.\n The IAM console displays a dialog listing the roles assigned\n to the Compute Engine default service account.\n\n4. Click add to add another role.\n\n5. Expand the **Select a role** drop down menu, type `Filestore` in the\n filter, and select **Cloud Filestore editor**.\n\n6. Click **Save** to dismiss the dialog. You have added the Filestore\n Editor role to the Compute Engine default service account.\n\nFor more information about service accounts, see [Service Account Overview](/iam/docs/service-account-overview).\nTo learn more about IAM roles, see [Roles and permissions](/iam/docs/roles-overview).\n\n### Create a Filestore instance\n\nCreate a Filestore instance using the instructions found in\n[Creating Filestore instances](/filestore/docs/creating-instances).\n\nMount a Filestore instance on a Cloud TPU VM\n--------------------------------------------\n\nThe commands you use to mount a Filestore instance on a Cloud TPU\ndepends on whether you are using a single Cloud TPU or a Cloud TPU\nslice.\n\n### Mount a Filestore instance on a single Cloud TPU VM\n\n1. Connect to your Cloud TPU VM using SSH. \n\n ```bash\n gcloud compute tpus tpu-vm ssh your-tpu-name \\\n --zone=your-zone\n \n ```\n2. Install the `nfs-common` package. \n\n ```bash\n (vm)$ sudo apt-get update --allow-releaseinfo-change \\\n && sudo apt-get -y update \\\n && sudo apt-get -y install nfs-common\n \n ```\n3. Create a directory in which to mount NFS \n\n ```bash\n (vm)$ sudo mkdir -p mount-dir \\\n && sudo chmod ugo+rw mount-dir\n \n ```\n4. Find the IP address of the Filestore. \n\n ```bash\n (vm)$ gcloud filestore instances describe filestore-instance-name \\\n --location filestore-region\n \n ```\n5. Mount Filestore instance on your Cloud TPU VM onto your mount directory. Replace `filestore-ip`, `file-share-name`, `mount-dir` with your FileStore IP address, file share name, and mount directory. \n\n ```bash\n (vm)$ sudo mount filestore-ip:file-share-name mount-dir\n \n ```\n\n### Mount a Filestore instance on a Cloud TPU slice\n\nCloud TPU slices are composed of 2 or more Cloud TPU VMs. The\nfollowing commands use the `gcloud compute tpus tpu-vm ssh` command with the\n`--worker=all` and `--command` flags to run the commands on all Cloud TPU\nVMs at one time.\n\n1. Install the `nfs-common` package on all Cloud TPU VMs in your slice. \n\n ```bash\n gcloud compute tpus tpu-vm ssh your-tpu-name \\\n --project=your-gcp-project \\\n --zone=your-zone \\\n --worker=all \\\n --command=\"sudo apt-get update --allow-releaseinfo-change && sudo apt-get -y update && sudo apt-get -y install nfs-common\"\n \n ```\n2. Create a directory in which to mount the Filestore instance. Replace `mount-dir` with a directory name of your choice. \n\n ```bash\n gcloud compute tpus tpu-vm ssh your-tpu-name \\\n --project=your-gcp-project \\\n --zone=your-zone \\\n --worker=all \\\n --command=\"sudo mkdir -p \u003cvar translate=\"no\"\u003emount-dir\u003c/var\u003e && sudo chmod ugo+rw \u003cvar translate=\"no\"\u003emount-dir\u003c/var\u003e\"\n \n ```\n3. Find the IP address of the Filestore instance. \n\n ```bash\n gcloud filestore instances describe filestore-instance-name \\\n --location filestore-region\n \n ```\n4. Mount Filestore instance on your Cloud TPU slice. Replace `filestore-ip`, `file-share-name`, `mount-dir` with your FileStore IP address, file share name, and mount directory. \n\n ```bash\n gcloud compute tpus tpu-vm ssh your-tpu-name \\\n --project=your-gcp-project \\\n --zone=your-zone \\\n --worker=all \\\n --command=\"sudo mount \u003cvar translate=\"no\"\u003efilestore-ip\u003c/var\u003e:\u003cvar translate=\"no\"\u003efile-share-name\u003c/var\u003e \u003cvar translate=\"no\"\u003emount-dir\u003c/var\u003e\"\n \n ```\n\nWriting data to Filestore instance\n----------------------------------\n\nMake sure you grant Linux read and write permissions on the directory in which\nyou mount the Filestore instance. You can use the directory as you\nwould your local file system."]]