You are here
Home > Tricks > Resize Disk of VM Instance on Google Cloud Platform without Stopping VM

Resize Disk of VM Instance on Google Cloud Platform without Stopping VM

gcp-resize-disk-featured

Hello friends, today we’ll see how to resize disk of VM instance on Google Cloud Platform without stopping VM. Actually one of my colleague was working on a project which was hosted on GCP Compute Engine VM and while working on the project suddenly he ran out of disk storage then he asked me for help. Then I said ok and after figuring out I found there was only 10 GB of disk space, so I asked him to stop the vm and increase disk space but he hadn’t want to stop the vm. Then I googled and came up with another solution which I am sharing now. This solution applies on most common case which is – “the disk should have single partition”.

Step 1: SSH into your VM

gcp-increase-disk-space-ssh-1
gcp-increase-disk-space-ssh-2

Step 2: Check Available Disk Size using df below command (Optional)

Step 3: Check partition using lsblk command

Step 4: Increase disk size from GCP console or by running below command in cloud shell

replace INSTANCE_NAME with your instance name and ZONE with your zone name

OR

gcp-increase-disk-space-increase-disk-1 gcp-increase-disk-space-increase-disk-2
Go to Disk Section of Compute Engine and click on the name of the disk of which you want to increase space and then click edit then change disk size according to your need and click save

Step 5: Grow Partition using growpart command

for debian and ubuntu

for centos

Note: if you get command not found error then you can use below command to install it

for debian and ubuntu

for centos

Step 6: Resize filesytem

for debian and ubuntu

for centos

Step 7: Verify using df command

That’s it

If you find this helpful then please do share
Any suggestions and queries are welcome in comment section

Rajesh Kumar Sahanee
I am a passionate Java Developer and I like Computer Programming. I love to do some interesting experiments and listening music in my free time.
https://www.zatackcoder.com

Comments

zatackcoder
Top