How To Mount Extra Disks On Google Cloud VM Instance
Prerequisites
Hardware : GCP
Google Account
Go to Cloud Console.
We can add disks in GCP cloud compute engine/ Instances to increase disk space so that we can utilize it.
NB : Adding the disk in one Zone will be available in that zone instances only. No other zone instances can use the disk space.
Click Menu > Compute Engine > VM instances.
![](https://prwatech.in/blog/wp-content/uploads/2021/03/0.jpg)
Select which instance you want to add the disk.
![](https://prwatech.in/blog/wp-content/uploads/2021/03/2-8.jpg)
Click on edit.
![](https://prwatech.in/blog/wp-content/uploads/2021/03/3-7.jpg)
Click on add new disk.
![](https://prwatech.in/blog/wp-content/uploads/2021/03/3j.jpg)
Give the name for the disk and choose the type which you want.
![](https://prwatech.in/blog/wp-content/uploads/2021/03/4-9.jpg)
Mention the size of the disk which you want.
![](https://prwatech.in/blog/wp-content/uploads/2021/03/5-7.jpg)
Then press done. The disk will be created.
![](https://prwatech.in/blog/wp-content/uploads/2021/03/6-7.jpg)
Then press save button. Then only it will be saved in our instance.
![](https://prwatech.in/blog/wp-content/uploads/2021/03/7-6.jpg)
Click on disks. It will list the disks which you have created/used.
![](https://prwatech.in/blog/wp-content/uploads/2021/03/8-8.jpg)
Click VM instances. Click on SSH in the corresponding machine which you added the disk.
![](https://prwatech.in/blog/wp-content/uploads/2021/03/9-5.jpg)
Type $ lsblk.
press Enter. Check whether the created disk is listed or not.
![](https://prwatech.in/blog/wp-content/uploads/2021/03/10-2.jpg)
Type $ sudo fdisk /dev/sdb.
Type m. It will lists the commands which is available.
![](https://prwatech.in/blog/wp-content/uploads/2021/03/11-3.jpg)
Type n to create new partition.
P for primary partition. You can specify the partition number from 1-4.
Type the size and press enter. This is for getting how much space you need for this instance from the created disk.
Press w to write the alteration.
![](https://prwatech.in/blog/wp-content/uploads/2021/03/12-4.jpg)
Type lsblk. It will show the partitioned disk with the specified size.
![](https://prwatech.in/blog/wp-content/uploads/2021/03/13-3.jpg)
Type sudo mkdir /dev/<Disk_Name>. It will make the directory for the disk.
![](https://prwatech.in/blog/wp-content/uploads/2021/03/14-3.jpg)
Type sudo mkfs.ext4 /dev/sdb1. It will create a new file system in the format of ext4.
![](https://prwatech.in/blog/wp-content/uploads/2021/03/17-3.jpg)
Type sudo partprobe. It will inform the system that the directory has been changed.
Type sudo vi /etc/fstab. And press enter. It will open up a file.
![](https://prwatech.in/blog/wp-content/uploads/2021/03/18-1-1024x128.jpg)
Type i or press insert in the keyboard. Then only we can edit the file.
![](https://prwatech.in/blog/wp-content/uploads/2021/03/19-1.jpg)
Type /dev/sdb1 /dev/<Disk_Name> ext4 defaults 0 0.
Now press “esc” + “:” (shift + 😉 then type “wq” and enter. It will exit from the file.
![](https://prwatech.in/blog/wp-content/uploads/2021/03/20-1.jpg)
Type sudo mount –a. It will mount the disk.
Type lsblk will show the disks and the created disk will show the Mountpoint location.
![](https://prwatech.in/blog/wp-content/uploads/2021/03/21-2.jpg)