问题描述
我尝试先通过gcutil adddisk
创建磁盘,然后在运行带有--disk
标志的gcutil addinstance
时将其分配给VM.但是,即使我在adddisk
上将其设置为200GB,该方法仍会导致10GB分区.
I tried creating the disk first via gcutil adddisk
and then assigning it to the VM when running gcutil addinstance
with the --disk
flag. However, this method still results in a 10GB partition even though I set it to 200GB on adddisk
.
这是磁盘本身:
INFO: Zone for db2-usc1a detected as us-central1-a.
+-----------------+--------------------------------------------------------+
| name | db2-usc1a |
| description | |
| creation-time | 2014-06-11T22:45:39.654-07:00 |
| zone | us-central1-a |
| status | READY |
| source-snapshot | |
| source-image | projects/centos-cloud/global/images/centos-6-v20140606 |
| source-image-id | 6290630306542078308 |
| size-gb | 200 |
+-----------------+--------------------------------------------------------+
但是,如您所见,运行df -h
会将其显示为9.9GB:
But, as you can see, running df -h
displays it as 9.9GB:
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 9.9G 4.3G 5.1G 46% /
tmpfs 7.3G 0 7.3G 0% /dev/shm
我也尝试按照以下说明进行操作: https://developers.google. com/compute/docs/disks#repartitionrootpd
I have also tried to follow these instructions here: https://developers.google.com/compute/docs/disks#repartitionrootpd
但是,重新启动后,虚拟机变得不可访问,因此我什至无法通过SSH重新登录到计算机.
However, on reboot, the VM becomes inaccessible so I can't even SSH back onto the machine.
为什么Google会在启动时强制执行10GB的映像?为什么未将其设置为我要求的尺寸?更重要的是,有没有办法使我们的构建脚本自动化此过程?
Why is Google enforcing a 10GB image on boot? Why is it not being set to the size I have requested? More importantly, is there a way I can automate this process for our build scripts?
推荐答案
一种选择是使用永久磁盘快照:
- 调整磁盘大小
- 创建磁盘快照
- 在构建脚本中,从快照而不是默认映像中创建新的PD
新磁盘将为200GB.快照仅保存已更改的块,因此快照本身应很小.
The new disks will be 200GB. Snapshots only save blocks which have changed, so the snapshot itself should be fairly small.
这篇关于无法将启动磁盘获取到200GB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!