Stay organized with collections
Save and categorize content based on your preferences.
Mount a Filestore instance to
Cloud TPU VMs
Filestore is a fully managed network attached storage (NAS) for
Compute Engine. Filestore offers native compatibility with existing
enterprise applications and supports any NFSv3-compatible client.
Before you begin
In order to mount a Filestore instance on your Cloud TPU VM, you
need to add a Filestore role (Cloud Filestore Editor or Cloud
Filestore Viewer) to the service account associated with your
Cloud TPU VM. If you don't specify a custom service account when
you create a Cloud TPU VM, your Cloud TPU VM uses the default
Compute Engine service account. For more information about how to specify a
service account when creating a Cloud TPU VM, see
Set up the Cloud TPU environment.
For more information about how to create a service account, see
Create service accounts.
Add the Filestore Editor role to a service account
The following instructions show you how to add the Cloud Filestore
Editor role to the Compute Engine default service account. You can follow these
instructions to add the Cloud Filestore Editor role to any service
account. You can search and use a custom service account instead of the
Compute Engine default service account in step 2.
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.
Cloud TPU slices are composed of 2 or more Cloud TPU VMs. The
following commands use the gcloud compute tpus tpu-vm ssh command with the
--worker=all and --command flags to run the commands on all Cloud TPU
VMs at one time.
Install the nfs-common package on all Cloud TPU VMs in
your slice.
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.
gcloudcomputetpustpu-vmsshyour-tpu-name\--project=your-gcp-project\--zone=your-zone\--worker=all\--command="sudo mount filestore-ip:file-share-namemount-dir"
Writing data to Filestore instance
Make sure you grant Linux read and write permissions on the directory in which
you mount the Filestore instance. You can use the directory as you
would your local file system.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 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."]]