Skip to content

Instantly share code, notes, and snippets.

@clivewalkden
Last active May 19, 2023 12:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clivewalkden/831d7723d482eb9df16eda1f1a9dee5c to your computer and use it in GitHub Desktop.
Save clivewalkden/831d7723d482eb9df16eda1f1a9dee5c to your computer and use it in GitHub Desktop.
Google Cloud Resize a disk (CentOS & Ubuntu)
# Before this is run you need to change the disk size on the cloud (or via cli)
# Get the partition and device information
df -h
# Get the block size of the device and any partitions
sudo lsblk
# Make sure you have the tools to resize a drive
sudo yum -y install cloud-utils-growpart
# Grow the device id and partion id (in this case sda1)
sudo growpart /dev/sda 1
# Resize the mounted partition in this case /dev/sda1 mounts to /
sudo xfs_growfs /
# Check it has all worked
df -h
# Before this is run you need to change the disk size on the cloud (or via cli)
# Get the partition and device information
df -h
# Get the block size of the device and any partitions
sudo lsblk
# Grow the device id and partion id (in this case sda1)
sudo growpart /dev/sda 1
# Resize the mounted partition in this case /dev/sda1 mounts to /
sudo resize2fs /dev/sda1
# Check it has all worked
df -h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment