An Open Source Community
An Open Source Community

Create Google Cloud Image from Iso File

For the creation of virtual machine (instance), boot disk image file would be required and that image should be in compress raw format. We can upload that compress boot disk raw file in google bucket and later we can use that file to a crate an image for an instance.

Step 1: Create a local virtual machine from an iso file, use any virtualization method line VirtualBox or VMware for virtualization platform and login inside that Vm through command line terminal.

Step 2: Check the boot disk with “lsblk” command

[[email protected] ~]# lsblk 
sda      8:0    0    8G  0 disk 
└─sda1   8:1    0    8G  0 part /
sr0     11:0    1 1024M  0 rom

Step 3: Create machine raw file from a boot disk in this scenario “sda” is our boot disk

[[email protected] ~]# dd if=/dev/sda of=/mnt/disk.raw bs=4M conv=sparse
2048+0 records in
2048+0 records out
8589934592 bytes (8.6 GB) copied, 41.8353 s, 205 MB/s

Step 4: Now change the directory and create a compressed tar.gz file from the raw boot disk image.

[[email protected] ~]# cd /mnt/
[[email protected] mnt]# tar -cvzf custom-centos7-image.tar.gz disk.raw 

Step 5: Create a bucket in Google project, we will use that bucket for saving compressed raw boot disk image. Here we have created the bucket with “custom-image-datastore” name.

Step 6: Configure your google account and save the raw file into the bucket either by “gsutil” or Google cloud console.

[[email protected] ]# gsutil cp custom-centos7-image.tar.gz gs://custom-image-datastore
Copying file://custom-centos7-image.tar.gz [Content-Type=application/x-tar]...
\ [1 files][  1.9 GiB/  1.9 GiB]  111.6 KiB/s                                   
Operation completed over 1 objects/1.9 GiB.

Step 7: After the successful upload u can create your image like below,

Reference Links:

Leave a Comments