Creating & Mounting Filestore to VM
- Navigate to VM Instances by going to Navigation Menu > Compute Engine > VM Instances and click Create instance.
Set up your VM with the following information:
Name: nfs-client
Region: us-central1(Iowa)
Zone: us-central1-c
Series: N1
Machine Type: 1 vCPU (n1-standard-1)
Boot Disk: Debian GNU/Linux 9 (stretch)
Firewall: Allow HTTP traffic - Click Create.
- Go to Navigation menu > APIs and Services > Library. Search for Cloud Filestore API and click Enable if it is not already enabled.
- Navigate to Navigation Menu > Filestore.
Create your Cloud Filestore instance with the following information:
Instance ID: nfs-server
Instance type: Basic
Storage type: HDD
Allocate capacity: 1 TB
Region: us-central1
Zone: us-central1-a
Network: default
File share name: vol1
Access control: Grant access to all clients on the VPC network - Click Create Instance at the top of the page.
- Navigate Navigation Menu > Compute Engine > VM Instances.
- In the list of VM instances, click the SSH button for nfs-client to open a terminal window connected to that instance.
- In SSH shell install NFS by running the following commands:
sudo apt-get -y update && sudo apt-get -y install nfs-common
- Make a mount directory for the Cloud Filestore fileshare by running the following command:
sudo mkdir /mnt/test
- Mount the fileshare by running theÂ
mount
 command and specifying the Cloud Filestore instance IP address and fileshare name:sudo mount YOUR_INSTANCE_URL:/vol1 /mnt/test
- Make the fileshare accessible by changing the permissions:
sudo chmod go+rw /mnt/test
- In the terminal window that is connected to the nfs-client instance, run the following to create a file named testfile:
echo 'This is a test' > /mnt/test/testfile
- Confirm the file was created by running the following command:
ls /mnt/test
- You can see the content of the file by running the following command:
nano /mnt/test/testfile
Tag:Google Cloud