How can size of the root disk in Google Compute En

2019-01-31 08:42发布

The root disk size in GCE is 10 gigs. How do I increase this? I cant find the option in the console or the gcutil flags. This can be easily done in AWS.

9条回答
劫难
2楼-- · 2019-01-31 09:20

In most cases, it will be simpler and more flexible to create a second data disk of the size you want, and attach it to the instance.

To resize a Persistent Disk (including a root disk), snapshot the disk, then create a new larger disk from the snapshot.

查看更多
我欲成王,谁敢阻挡
3楼-- · 2019-01-31 09:27

For anyone else unable to find a working answer, I found this script someone kindly posted:

https://gist.github.com/xelwarto/6f5c6556613c9215b1e1

# 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
查看更多
Lonely孤独者°
4楼-- · 2019-01-31 09:29

Create a disk first with whatever size and image you want, and then create your instance using Existing Disk as your boot source.

查看更多
登录 后发表回答