Power Virtual Server

Power Virtual Server

Connect, learn, share, and engage with IBM Power.

 View Only

Multi-disk AIX OVA creation for PowerVS migration

By Samuel Matzek posted Thu October 26, 2023 12:47 PM

  

Introduction

IBM Power Virtual Server (PowerVS) is a great solution for running Power workloads off-premises or as an alternative to other remote data centers. There are several ways to migrate AIX workloads into PowerVS each with their pros and cons. This blog introduces a method of copying all partition disks into PowerVS using an OVA image.

Background

There are several ways to migrate AIX partitions from on-premises servers or other data centers into IBM Power Virtual Server (PowerVS). One of these mechanisms is to use IBM PowerVC to capture an image of the partition and transfer to it to PowerVS’ image catalog. The flow is shown in the following diagram.

OVAs used by IBM PowerVC and PowerVS are gzipped tars file containing an OVF (an XML metadata file) and RAW disk image files. Once the OVA is created it is transferred to IBM Cloud Object storage and then imported into the PowerVS Image catalog as a custom image. The image can then be used to create a virtual server instance (partition) in PowerVS.

Manual OVA creation

The easiest way to create an OVA image is to use IBM PowerVC. However, if IBM PowerVC is not available in the environment the OVA image can be created using manual steps. At its core the manual OVA creation steps consist of using the dd copy command to create raw image file copies of the disks, create an XML file listing the images, and put the XML and image files in a tar.

There are several prerequisites to be aware of and some preparation steps that can speed up the image transfer and automate the partition setup in PowerVS.

Prerequisites

You will need enough disk space in the source environment to create raw image files of the source partition’s volumes. The size is the actual size of the volumes and not the “used space”. For example, if the source partition has three SAN volumes that are 100GB each, you need 300GB of free space for the image files and then some amount more than that to store the gzipped tar of all the images. Note that the maximum image size allowed for import into PowerVS is 10TB so if the sum of all the volume sizes is greater than 10TB this image import migration path cannot be used.

PowerVS also requires that the volumes in the source environment be attached with  N_Port ID Virtualization (NPIV).

Preparing the system for capture

Install / Verify RSCT packages

The Reliable Scalable Cluster Technology (RSCT) packages should be at version 3.2.1.0 or later. See this document for more information. Without this level, the AIX partition will remain in a “Warning” state and functionality that requires RSCT such as dynamically allocating CPU, memory, network interfaces, or volumes is disabled.

Install cloud-init

Cloud-init performs several important functions cloud in provisioned partitions. A few notable functions are configuring the network interfaces, re-initializing the RSCT tooling, and restoring (importing) volume groups. If cloud-init is not installed in the image these tasks must be done manually from the partition console after the new instance is created. IBM PowerVC documents how to install cloud-init on AIX.

Record Physical Volume to Volume Group Mappings

For cloud-init to import volume groups in the PowerVS instances it requires physical volume to volume group mapping information. After cloud-init is installed the /opt/freeware/lib/cloud-init/create_pvid_to_vg_mappings.sh script should be run. This scripts creates a Physical Volume to Volume Group mapping file and stores it in rootvg.

Zero out free space

Since the OVA image file that will be uploaded to IBM Cloud Object Storage is a gzipped tar containing the raw disk images, the size of the OVA and the time it takes to upload can be reduced if gzip achieves a good compression ratio. To increase the compression ratio the free space on all disks should be written as binary zeros rather leaving them as random data or previously deleted data that the file system can overwrite.

Commands like the following should be run on all mount points to zero out the free space:

dd bs=1M if=/dev/zero of=/zerofile; rm -f /zerofile
dd bs=1M if=/dev/zero of=/usr/zerofile; rm -f /usr/zerofile
dd bs=1M if=/dev/zero of=/var/zerofile; rm -f /var/zerofile
dd bs=1M if=/dev/zero of=/tmp/zerofile; rm -f /tmp/zerofile
dd bs=1M if=/dev/zero of=/home/zerofile; rm -f /home/zerofile
dd bs=1M if=/dev/zero of=/admin/zerofile; rm -f /admin/zerofile
dd bs=1M if=/dev/zero of=/opt/zerofile; rm -f /opt/zerofile
dd bs=1M if=/dev/zero of=/var/adm/ras/livedump/zerofile; rm -f /var/adm/ras/livedump/zerofile
dd bs=1M if=/dev/zero of=/var/adm/csd/zerofile; rm -f /var/adm/csd/zerofile

These commands read from a “zero” device and write to a file on the mount point. The dd copy of zeros will consume all free space on the mount point and the file is then removed. This leaves all the free space on all mount points as a binary zeros.

Shutdown workloads

The partition should be as idle as possible while making the disk images. All workloads should be gracefully shutdown to avoid capturing inconsistent data in the disk images.

Create disk the images

Now that the system is prepared for image capture, create the hdisks image files using a dd copy. The dd copies should be done using the “rhdisk” device which provides better read performance for the raw disk access. For example, the following command makes a disk image of hdisk2 in the /imagebuild directory:

$ dd bs=1M if=/dev/rhdisk2 of=/imagebuild/hdisk2.img
25600+0 records in 
25600+0 records out

Create the OVF

After all the disk images are created, create an OVF XML file. The OVF lists the disks required for the partition, the image files, and the correlation between the disk and the image. Here is an example OVF with two disks/images. The sections that need to be copy-paste-modified for additional disks are annotated with XML comments.

<ovf:Envelope xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1">
  <ovf:References>
        <!-- Add each disk image as an ovf:File in this section.
         The href should point at the image file name, the file name must not be in a path or sub-directory,
         the id must be unique, and the size is in bytes.  -->
        <ovf:File href="hdisk0.img" id="file1" size="26843545600"/>

        <ovf:File href="hdisk1.img" id="file2" size="5368709120"/>
  </ovf:References>
  <ovf:DiskSection>
    <ovf:Info>Disk Section</ovf:Info>
        <!-- Add each disk to the disk section. The capacity should be disk/volume size in bytes.
        The diskIds should be unique, and the fileRef value should refer to the disk's file image ID
        from the ovf:File above.-->
        <ovf:Disk capacity="26843545600" capacityAllocationUnits="byte" diskId="disk1" fileRef="file1"/>
        <ovf:Disk capacity="5368709120" capacityAllocationUnits="byte" diskId="disk2" fileRef="file2"/>
  </ovf:DiskSection>
  <ovf:VirtualSystemCollection>
    <ovf:VirtualSystem ovf:id="vs0">
      <ovf:Name>MYSYSTEMNAME</ovf:Name>
      <ovf:Info>aix_OS Image Product Export</ovf:Info>
      <ovf:ProductSection>
        <ovf:Info/>
        <ovf:Product/>
      </ovf:ProductSection>
      <ovf:OperatingSystemSection ovf:id="9">
        <ovf:Info/>
        <ovf:Description>aix</ovf:Description>
        <ns0:architecture xmlns:ns0="ibmpvc">ppc64</ns0:architecture>
      </ovf:OperatingSystemSection>
      <ovf:VirtualHardwareSection>
        <ovf:Info>Storage resources</ovf:Info>
        <!-- Each disk should have an ovf:Item specified. Here we have two items for our two disks.-->
        <ovf:Item>
          <rasd:Description>Temporary image asset</rasd:Description>
          <rasd:ElementName>MYSYSTEMNAME</rasd:ElementName>
          <!-- These ovf:/disk/ references should refer to the diskID from the DiskSection above -->
          <rasd:HostResource>ovf:/disk/disk1</rasd:HostResource>
          <!-- The rasd:InstanceID should be a unique integer for each ovf:Item you add for the disks. -->
          <rasd:InstanceID>1</rasd:InstanceID>
          <rasd:ResourceType>17</rasd:ResourceType>
          <!-- The ns1:boot value should be set to True for all rootvg disks and False for all other disks. -->
          <ns1:boot xmlns:ns1="ibmpvc">True</ns1:boot>
        </ovf:Item>
        <ovf:Item>
          <rasd:Description>Temporary image asset</rasd:Description>
          <rasd:ElementName>MYSYSTEMNAME</rasd:ElementName>
          <rasd:HostResource>ovf:/disk/disk2</rasd:HostResource>
          <rasd:InstanceID>2</rasd:InstanceID>
          <rasd:ResourceType>17</rasd:ResourceType>
          <ns1:boot xmlns:ns1="ibmpvc">False</ns1:boot>
        </ovf:Item>
      </ovf:VirtualHardwareSection>
    </ovf:VirtualSystem>
    <ovf:Info></ovf:Info>
    <ovf:Name>MYSYSTEMNAME</ovf:Name>
  </ovf:VirtualSystemCollection>
</ovf:Envelope>

The OVF should be saved in the same directory as the image files and its extension should be .ovf.

Create the OVA

Now that the OVF and image files are created the next step is to create the OVA. The OVA is simply a tar and PowerVS supports importing gzipped OVAs with the extension of .ova.gz. Create the OVA with the following command.
Note that the OVF must be the first file in the tar, and all of the files must be at the root level of the tar without sub-directories.

tar cvfz partitionOVA.ova.gz mysystem.ovf *.img

The OVA can now be uploaded to Cloud Object Storage and then imported into PowerVS’ image catalog. PowerVS documents how to create object storage, upload the image, and import it into your image catalog in this article.

Conclusion

Using these techniques an AIX partition can benefit from the full system copy method of migrating into PowerVS from environments that lack IBM PowerVC.

0 comments
65 views

Permalink