如何增加 Google Compute Engine 中根磁盘的大小? [英] How can size of the root disk in Google Compute Engine be increased?

查看:25
本文介绍了如何增加 Google Compute Engine 中根磁盘的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

GCE 中的根磁盘大小为 10 gigs.我如何增加这个?我在控制台或 gcutil 标志中找不到该选项.这可以在 AWS 中轻松完成.

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.

推荐答案

截至 2016 年 3 月 31 日,您可以在线调整永久性磁盘的大小,无需停止或重新启动 VM,无需拍摄快照,也无需必须将其恢复到更大的磁盘.

As of 31 Mar 2016, you can resize a persistent disk online without stopping or rebooting the VM, without taking snapshots, and without having to restore it to a larger disk.

宣布该功能的博文有详细信息,您可以查看文档 了解如何通过控制台执行此操作:

The blog post announcing the feature has the details, and you can see the docs for how to do this via the console:

在 Google Cloud Platform Console 中调整永久性磁盘的大小:

Resize the persistent disk in the Google Cloud Platform Console:

  1. 转到计算引擎页面.
  2. 点击磁盘"在侧边栏中
  3. 单击要调整大小的磁盘的名称.
  4. 在磁盘详细信息页面的顶部,点击编辑".
  5. 在尺寸"中字段,输入磁盘的新大小.
  6. 在磁盘详细信息页面底部,单击保存";将更改应用到磁盘.
  7. 调整磁盘大小后,您必须调整磁盘分区的大小,以便操作系统可以访问额外的空间.

或通过 CLI:

gcloud compute disks resize example-disk --size 250

然后,在 Debian/Ubuntu/etc 上.运行:

Then, on Debian/Ubuntu/etc. run:

$ sudo apt install -y cloud-utils         # Debian jessie
$ sudo apt install -y cloud-guest-utils   # Debian stretch, Ubuntu
$ sudo growpart /dev/sda 1
$ sudo resize2fs /dev/sda1

或者,对于 RedHat/Fedora/CentOS/等:

or, for RedHat/Fedora/CentOS/etc.:

$ sudo dnf install -y cloud-utils-growpart
$ sudo growpart /dev/sda 1
$ sudo xfs_growfs -d /                    # CentOS 6 needs `resize2fs`

请注意,某些操作系统重新启动时自动调整分区大小,无需您使用 fdiskresize2fsxfs_growfs 等工具执行任何手动步骤,因此应该足够了只需调整磁盘大小并重新启动 VM 即可使更改生效.

Note that some operating systems will automatically resize your partition on reboot without requiring you to do any manual steps with tools such as fdisk, resize2fs or xfs_growfs, so it should be sufficient to just resize the disk and reboot the VM for changes to take effect.

这篇关于如何增加 Google Compute Engine 中根磁盘的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆