How to Resize VM Instance Google Cloud
In this guide, you are going to learn how to resize the disk space of your Google Cloud Compute Engine instance on the fly without any downtime. If you are running a WordPress website on Google Cloud Instance, this is very helpful to you. Filled ...
In this guide, you are going to learn how to resize the disk space of your Google Cloud Compute Engine instance on the fly without any downtime. If you are running a WordPress website on Google Cloud Instance, this is very helpful to you. Filled hard space cause 522 and 524 Cloudflare errors which are server not response and time out connection.
Create a Snapshot
Create a Snapshot of your site before the process. It is a backup of your virtual machine. If you do ant mistake in the process, you can restore the VM instance without any loss.
In the Google Cloud, go to your VM instance page. Click “Snapshots” at the left menu under disk. Give a name and choose the source disk that you hope to resize. Then click “create” button. You will see a snapshot is creating. Now, go back to your VM instances page.
Check Disk Size
Before resizing your disk size, you can check your available disk space. So, you will get an idea about the available space in your disk. It is recommended to increase the size if your used space is more than 80%.
Click SSH button at the VM instances page to get the terminal window. Execute the following command to check the disk space.
You will get similar result and SDA 1 is the WordPress instance disk size. You can see it almost 100% filled. In this time, my website shows 522 and 524 cloud flare errors. Because, WordPress and My SQL database unable to store data.
Increase Disk Size
Go to your Google Cloud Console and navigate to VM Instances. Click the name of the instance where you want to add a disk. Then, scroll down to Boot disk and click on the disk name. Now you will be taken to the Disk Management page.
Click “Edit” on the top of the page. Here you can specify the size of you need. Enter the disk size that you want to increased. Then, click “Save” in the bottom to apply the changes. You can see the disk size is changed. Now, see how to use the added space.
Grow Partition and Resize File System
Open the terminal window, using SSH button at the VM instances. Now you need to resize the partition using this command with your device id and partition number. By default, it is sda 1 you will see it on the 2nd step.
sudo growpart /dev/sda 1
Next, resize the filesystem with the following command.
sudo resize2fs /dev/sda1
Verify the Setup
Now you can verify the disk space using the df command. Your disk space must have resized to the additional space you added.
If this video is helpful, click the like button and share with your friends. Subscribe Minex for more videos like this. Thank you for watching Minex. Have a nice day.