Capturing and exporting a virtual machine
Virtual machine (VM) instances can be captured and exported from the IBM Power for Google Cloud Platform (IP4G) service. This can be done through either the command line interface (CLI) or web interface. The captured image is stored as a new volume on the back end storage. A captured image can then be exported to Google Cloud Storage. Images are exported in an Open Virtualization Appliance (OVA) file. OVA files are compressed using gzip before export to Google Cloud Storage.
When capturing an image, an export destination of “image catalog” and/or “cloud storage” can be selected. The image catalog resides in the customer’s IP4G storage area. It can be used as a template to create new VMs. The cloud storage option transfers the image to Google Cloud Storage immediately. Images in the image catalog are transferrable to cloud storage at a later date as well.
Only one Image Capture and Export or Import function can be performed at a time.
Flush file system buffers to disk
Images captured from running VMs will be captured in a “crash-consistent” state. For best results, when possible, capture images with the VM shut down. If a VM cannot be stopped before capture, it is recommended to flush the file system buffer cache to disk. Use the following commands to accomplish this:
- IBM i: Use the following command to flush all buffers to disk. Do this prior to capturing the image to ensure data integrity.
CHGASPACTOPTION(*FRCWRT)
- AIX or Linux: Use the following command to flush file system bufers to disk:
sync; sync; sync
Performing capture and export via the IP4G user interface
Use the following steps to perform a capture and export through the IP4G interface.
- Navigate to the IP4G Console. Select the desired virtual machine to capture.
- Select the Capture and Export icon in virtual machine instance view. The icon appears in the upper left corner.
- All volumes for the virtual machine are automatically captured by default.
- Determine where the volume backed image or OVA will be exported. Either: image catalog, Cloud Storage, or both.
- Provide the captured image a Name.
- Optional: when exporting to Cloud Storage, specify the following additional parameters:
- Bucket name and any optional folders.
- Access and Secret Keys.
- Select Capture and export.
- After a successful capture or export, a confirmation message is displayed. It will read “When large volumes (in size and/or quantity) are selected, export processing may take a significantly long period of time to complete.”
- Find the newly exported image by completing either one of the following tasks:
- If Cloud Storage was selected for the export, navigate to the Cloud Storage bucket in GCP.
- If image catalog was selected for the export, navigate to Boot images in the IP4G user interface.
- Optional: volume backed images in image catalogs can also be exported to Cloud Storage. After choosing the desired Boot Image, select the Export function on the top of the screen.
Performing capture and export using the pcloud CLI
The pcloud CLI can also be used to capture and export a virtual machine image.
The pcloud compute instances capture command can be used to capture a virtual machine image. The image can be exported to an image catalog, Cloud Object Storage, or both.
Capture VM Instance to image catalog:
pcloud compute instances capture <InstanceName> --destination image-catalog --name <ImageName>
Capture VM Instance to Google Cloud Storage:
pcloud compute instances capture <InstanceName> --destination [cloud-storage|both]
--name <ImageName> --bucketname <Bucket> --accesskey <AccessKey> --secretkey <SecretKey> [flags]
Use the following command to view exported images in the image catalog:
pcloud compute images list