问题
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
.
Here is the disk itself:
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 |
+-----------------+--------------------------------------------------------+
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
I have also tried to follow these instructions here: https://developers.google.com/compute/docs/disks#repartitionrootpd
However, on reboot, the VM becomes inaccessible so I can't even SSH back onto the machine.
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?
回答1:
One option is to use Persistent Disk Snapshots:
- resize the disk
- create a snapshot of the disk
- in your build scripts, create new PDs from your snapshot instead of the default image
The new disks will be 200GB. Snapshots only save blocks which have changed, so the snapshot itself should be fairly small.
回答2:
As the previous comment suggests, resize the disk. For those who don't know how to do this:
sudo /sbin/resize2fs /dev/sda1
来源:https://stackoverflow.com/questions/24468139/cant-get-the-boot-disk-to-200gb