How To Shrink Google Compute Engine Disk Size
How to Resize Deejay of a VM Instance in Google Cloud. In this guide you are going to learn how to resize the disk space of your Compute Engine instance on the fly without whatever reanimation.
You can too attach and mount new additional deejay to your example instead of resizing your disk.
Prerequisites
- SSH access to your VM Instance.
- Backup your disk by creating a snapshot of your deejay. You can also setup automatic snapshot schedules.
- Basic SSH final skills to execute commands.
Important: Yous can only enlarge the size of the existing disk, y'all cannot shrink your deejay to lower size.
Stride ane: Check Disk Size
Earlier resizing your disk size you can check your available disk infinite so you lot will get an idea almost the available space in your deejay. Information technology is recommended to increment the size if your used space is more than 80%.
Execute the following command to check the deejay space.
df -h
You will get an output similar to the ane beneath.
Output Filesystem Size Used Avail Use% Mounted on udev 286M 0 286M 0% /dev tmpfs 60M 2.4M 57M iv% /run /dev/sda1 9.8G 1.1G 8.2G 12% / tmpfs 297M 0 297M 0% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 297M 0 297M 0% /sys/fs/cgroup
Here /dev/sda1
is the one which shows the available and used infinite of your disk. I tested this on a new fresh disk with 10GB space.
Step 2: Check Partitioning
Now you lot demand to check the partitions available on the your disk.
lsblk
This control shows the available partitions. You volition get an output similar to this.
Output Proper noun MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 10G 0 disk └─sda1 eight:1 0 10G 0 function /
In this case we having merely one division.
As yous can come across, sda
is the DEVICE_ID
and one
is the partition number.
Step three: Increase Deejay Size
Go to your Google Deject Console and navigate to Compute >> VM Instances.
Click the proper noun of the instance where you want to add together a deejay.
Curlicue down to Boot deejay and click on the disk name.
At present you will be taken to the Disk Management folio.
Click Edit on the top.
Hither you can specify the size of you lot need.
Click Relieve in the bottom to utilise the changes.
Pace 4: Grow Sectionalisation
Now you need to resize the sectionalization using the growpart
command with your device id and division number.
sudo growpart /dev/sda 1
You volition get something like.
Output Changed: partition=ane start=4096 sometime: size=20967424 stop=20971520 new: size=1048571871,terminate=1048575967
Step 5: Resize File System
The last stride is to resize the filesystem with the resize2fs
command.
sudo resize2fs /dev/sda1
The output will exist similar this.
Output resize2fs 1.43.4 (31-Jan-2017) Filesystem at /dev/sda1 is mounted on /; on-line resizing required old_desc_blocks = 2, new_desc_blocks = 63 The filesystem on /dev/sda1 is now 131071483 (4k) blocks long.
Step vi: Verify the Setup
At present you can verify the deejay space using the df
control. Your disk space must have rezised to the boosted infinite you added.
df -h
Output Filesystem Size Used Avail Use% Mounted on udev 286M 0 286M 0% /dev tmpfs 60M ii.4M 57M four% /run /dev/sda1 493G 1.2G 471G 1% / tmpfs 297M 0 297M 0% /dev/shm tmpfs five.0M 0 5.0M 0% /run/lock tmpfs 297M 0 297M 0% /sys/fs/cgroup
Go your Professional person Google Cloud Architect document with this easy to larn form now.
Conclusion
Now you lot have learned how to resize your VM Instance without restarting and without downtime.
How To Shrink Google Compute Engine Disk Size,
Source: https://www.cloudbooklet.com/how-to-resize-disk-of-a-vm-instance-in-google-cloud/
Posted by: rodriguezmorbigh1992.blogspot.com
0 Response to "How To Shrink Google Compute Engine Disk Size"
Post a Comment