[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-04。"],[],[],null,["# Mount Filestore instances in Cloud Workstations\n\nCloud Workstations can mount\n[Filestore](/filestore/docs/overview)\nNetwork File System (NFS) instances that are in the same VPC\nnetwork. The Filestore instance can be accessed by multiple\nCloud Workstations instances at the same time.\n\nFor more information about Filestore, see the\n[Filestore documentation](/filestore/docs).\n\nBefore you begin\n----------------\n\nBefore you being, [create your project](#create_your_project) and\n[set up required IAM roles](#required_roles).\n\n### Create your project\n\n1. In your *workstations project*, make sure that you have enabled the\n Filestore API and Cloud Workstations APIs.\n\n [Enable Filestore and Cloud Workstations APIs](https://console.cloud.google.com/start/api?id=file.googleapis.com,workstations.googleapis.com)\n2. Make sure that you install and initialize the\n [`gcloud` CLI](/sdk/docs/install).\n To\n [initialize the `gcloud` CLI](/sdk/docs/initializing),\n run the following command:\n\n gcloud init\n\n### Required roles\n\n\nTo get the permissions that\nyou need to create and update workstations,\n\nask your administrator to grant you the\nfollowing IAM roles on your workstations project:\n\n- If you are the *Cloud Workstations Admin* , ask your administrator to grant you the following role: Cloud Workstations Admin (`roles/workstations.admin`).\n- If you are the *Filestore Admin* , ask your administrator to grant you the following role: Filestore Editor (`roles/file.editor`).\n\n\nFor more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\nYou might also be able to get\nthe required permissions through [custom\nroles](/iam/docs/creating-custom-roles) or other [predefined\nroles](/iam/docs/roles-overview#predefined).\n\nCreate a Filestore instance\n---------------------------\n\nIf you have not yet created a Filestore instance, create one using\nthe `gcloud` CLI [`filestore instances create`](/sdk/gcloud/reference/filestore/instances/create)\ncommand that follows. For naming information, see\n[Naming your Filestore instance](/filestore/docs/creating-instances#naming_your_instance)\nand [Naming the file share](/filestore/docs/creating-instances#naming_the_file_share).\n**Important:** We recommend Filestore ENTERPRISE tier because it provides regional availability that matches with Cloud Workstations availability. \n\n gcloud filestore instances create \u003cvar translate=\"no\"\u003eINSTANCE_ID\u003c/var\u003e \\\n --file-share=name=\u003cvar translate=\"no\"\u003eFILE_SHARE_NAME\u003c/var\u003e,capacity=1TiB \\\n --tier=ENTERPRISE \\\n --network=name=\u003cvar translate=\"no\"\u003eNETWORK_NAME\u003c/var\u003e \\\n --region=\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e \\\n --project \u003cvar translate=\"no\"\u003eWORKSTATIONS_PROJECT_ID\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eINSTANCE_ID\u003c/var\u003e: the ID to uniquely identify your Filestore instance.\n- \u003cvar translate=\"no\"\u003eFILE_SHARE_NAME\u003c/var\u003e: the name of the directory served from the Filestore instance---for example, `vol1`.\n- \u003cvar translate=\"no\"\u003eNETWORK_NAME\u003c/var\u003e: the name of the VPC network to which the instance is connected. It should match the network of Cloud Workstations cluster---for example, `default`.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: the region of your Filestore instance. It should match the region of the workstation cluster.\n- \u003cvar translate=\"no\"\u003eWORKSTATIONS_PROJECT_ID\u003c/var\u003e: the ID of your workstations project.\n\n| **Note:** If you want to use a tier other than ENTERPRISE tier, pass `--zone` flag instead of `--region` flag. For example, if your workstation cluster is in `us-central1` region, you can create a Filestore instance in `us-central1-a` zone.\n\n### Get IP address of Filestore instance\n\nAfter the Filestore instance is created, get its IP address using the\n[filestore instances describe](/sdk/gcloud/reference/filestore/instances/describe)\n`gcloud` CLI command: \n\n gcloud filestore instances describe \u003cvar translate=\"no\"\u003eINSTANCE_ID\u003c/var\u003e \\\n --region=\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e \\\n --project \u003cvar translate=\"no\"\u003eWORKSTATIONS_PROJECT_ID\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eINSTANCE_ID\u003c/var\u003e: the ID to uniquely identify your Filestore instance.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: the region of your Filestore instance. It should match the region of the workstation cluster.\n- \u003cvar translate=\"no\"\u003eWORKSTATIONS_PROJECT_ID\u003c/var\u003e: the ID of your workstations project.\n\nThe command prints the IP address in the following format: \n\n ...\n networks:\n - connectMode: DIRECT_PEERING\n ipAddresses:\n - \u003cvar translate=\"no\"\u003eFILESTORE_IP_ADDRESS\u003c/var\u003e\n ...\n\nMake a note of the \u003cvar translate=\"no\"\u003eFILESTORE_IP_ADDRESS\u003c/var\u003e because you need this\nin subsequent steps.\n\nCreate workstation cluster\n--------------------------\n\nIf you have not yet created a workstation cluster, create one using the\n`gcloud` CLI [`clusters create`](/sdk/gcloud/reference/workstations/clusters/create)\ncommand: \n\n gcloud workstations clusters create \\\n \u003cvar translate=\"no\"\u003eWORKSTATIONS_CLUSTER_NAME\u003c/var\u003e \\\n --network=\u003cvar translate=\"no\"\u003eNETWORK_NAME\u003c/var\u003e \\\n --region=\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e \\\n --project=\u003cvar translate=\"no\"\u003eWORKSTATIONS_PROJECT_ID\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eWORKSTATIONS_CLUSTER_NAME\u003c/var\u003e: the name of the workstation cluster.\n- \u003cvar translate=\"no\"\u003eNETWORK_NAME\u003c/var\u003e: the name of the VPC network to which the Cloud Workstations instances are connected. It should match the network of the Filestore instance---for example, `default`.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: the region name for your workstation cluster. It should match the region of the Filestore instance.\n- \u003cvar translate=\"no\"\u003eWORKSTATIONS_PROJECT_ID\u003c/var\u003e: the ID of your workstations project.\n\nCreate a workstation configuration and a workstation\n----------------------------------------------------\n\nIf you have not yet created a Cloud Workstations configuration and a\nworkstation instance, see\n[Create a workstation configuration](/workstations/docs/create-configuration)\nand [Create a workstation](/workstations/docs/create-workstation).\n\nMount a Filestore instance in a workstation\n-------------------------------------------\n\nAfter you launch Cloud Workstations instance, go to a terminal window and run\nthe following commands to mount a Filestore instance: \n\n sudo rpcbind\n mkdir -p \u003cvar translate=\"no\"\u003eFILE_SHARE_NAME\u003c/var\u003e\n sudo mount -o rw,intr \u003cvar translate=\"no\"\u003eFILESTORE_IP_ADDRESS\u003c/var\u003e:/\u003cvar translate=\"no\"\u003eFILE_SHARE_NAME\u003c/var\u003e \u003cvar translate=\"no\"\u003eFILE_SHARE_NAME\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eFILE_SHARE_NAME\u003c/var\u003e: the name of the directory served from the Filestore instance---for example, `vol1`.\n- \u003cvar translate=\"no\"\u003eFILESTORE_IP_ADDRESS\u003c/var\u003e: the IP address of your Filestore instance.\n\nAfter the `mount` command is successful, you see the\nFilestore instance contents in the file share path.\n\nFor more information about mounting Filestore instances, see\n[Mounting file shares on Compute Engine clients](/filestore/docs/mounting-fileshares).\n\nCreate a custom container image for Filestore automount\n-------------------------------------------------------\n\nYou can use the following Dockerfile to create a custom container image which\nmounts a Filestore instance in Cloud Workstations automatically\non startup. \n\n FROM us-central1-docker.pkg.dev/cloud-workstations-images/predefined/code-oss:latest\n\n RUN echo \"#!/bin/bash\\n\\\n sudo rpcbind\\n\\\n sudo mkdir -p /home/user/\u003cvar translate=\"no\"\u003eFILE_SHARE_NAME\u003c/var\u003e\\n\\\n sudo mount -o rw,intr \u003cvar translate=\"no\"\u003eFILESTORE_IP_ADDRESS\u003c/var\u003e:/\u003cvar translate=\"no\"\u003eFILE_SHARE_NAME\u003c/var\u003e /home/user/\u003cvar translate=\"no\"\u003eFILE_SHARE_NAME\u003c/var\u003e\" | sudo tee -a /etc/workstation-startup.d/011_mount-filestore.sh\n\n RUN sudo chmod +x /etc/workstation-startup.d/011_mount-filestore.sh\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eFILE_SHARE_NAME\u003c/var\u003e: the name of the directory served from the Filestore instance---for example, `vol1`.\n- \u003cvar translate=\"no\"\u003eFILESTORE_IP_ADDRESS\u003c/var\u003e: the IP address of your Filestore instance.\n\nFor more information about creating a custom container image for\nCloud Workstations, see [Customize container images](/workstations/docs/customize-container-images)."]]