Skip to content

Instantly share code, notes, and snippets.

@xelwarto
Last active February 1, 2021 08:24
Show Gist options
  • Save xelwarto/6f5c6556613c9215b1e1 to your computer and use it in GitHub Desktop.
Save xelwarto/6f5c6556613c9215b1e1 to your computer and use it in GitHub Desktop.
Expanding (resize) Centos 7 (or Red Hat EL 7) root partition in Custom Google Compute Image
# Requires cloud-utils-growpart to be installed
# Resize ROOT FS
part=`df --output=source / |grep "/dev/"`
if [ ! -z "$part" ] ; then
len=${#part}
p=`echo $part|cut -c$len`
d=`echo $part|cut -c1-$(($len-1))`
growpart "$d" "$p"
xfs_growfs "$part"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment