-2

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?

Andrew Ellis
  • 1,175
  • 1
  • 12
  • 29
  • Doh, I missed the bit on CentOS in those instructions. So, I can resize the disk successfully, but now the question remains: is there a way to automate this process? – Andrew Ellis Jun 28 '14 at 15:32
  • See [this answer](http://stackoverflow.com/a/24102667/3618671) on a similar question for how to automate the process. – Misha Brukman Dec 19 '14 at 19:54

2 Answers2

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.

Brian Dorsey
  • 4,588
  • 24
  • 27
0

As the previous comment suggests, resize the disk. For those who don't know how to do this:

sudo /sbin/resize2fs /dev/sda1
Jason Barnett
  • 195
  • 1
  • 6