How to add additional storage when creating google cloud instance from a machine image (using CLI)?

To create a VM instance you can use the following command:

gcloud compute instances create VM_NAME \
    [--image IMAGE | --image-family IMAGE_FAMILY] \
    --image-project IMAGE_PROJECT

And --source-machine-image is the option that you can use to create your instance from a machine image.

Here you have two options to add additional storage to the instance, and you could check this documentation for further details.

  1. Resizing a zonal persistent disk

You can resize zonal persistent disks when your instances require more storage, and attach multiple secondary disks only when you need to separate your data into unique partitions.

In the gcloud tool, use the disks resize command and specify the --size flag with the desired disk size, in gigabytes.

gcloud compute disks resize DISK_NAME --size DISK_SIZE
  1. Adding a blank zonal persistent disk to your instance
gcloud compute disks create DISK_NAME \
  --size DISK_SIZE \
  --type DISK_TYPE

After you create the disk, attach it to any running or stopped instance. Use the gcloud compute instances attach-disk command:

gcloud compute instances attach-disk INSTANCE_NAME \
  --disk DISK_NAME

Keep in mind that a new blank zonal persistent disk starts with no data or file system and you must format this disk yourself after you attach it to your instance, you can follow this documentation for this task : Formatting and mounting a zonal persistent dis