Migrating an Image of RHEL6 OS

The following explains the steps required for migrating an image to a IaaS environment when the OS of the virtual server that is operating in the migration source virtual environment is RHEL6.

About this task

Perform the following steps in the virtual environment and on the OS of the virtual server from which you are migrating the image.
Important:
  • Each of the following procedures provides an example of the command operation. The operation method may vary slightly, depending on the user's environment. Perform each operation according to the user's environment at the responsibility and decision of the user.
  • Use the console of the virtual environment for operation. Do not connect from outside, such as by using remote desktop, because doing so affects the network settings.

    Example: Start and operate the virtual machine console from VMware vSphere Client.

  • Be sure to make a backup before you change the settings of the virtual environment from which you are migrating so that you can restore it.

Procedure

  1. Uninstallation of VMware Tools

    If VMware Tools is installed on the virtual server that you intend to migrate, uninstall it.

    # vmware-uninstall-tools.pl
  2. Setting of the output destination of the boot log

    Change the GRUB setting so that the Kernel can write the boot logs to the ttyS0 device.

    1. Save /boot/grub/grub.conf.

      # cp -p /boot/grub/grub.conf /boot/grub/grub.conf.bak
    2. Edit /boot/grub/grub.conf and add the definition that enables the Kernel to write boot logs to the ttyS0 device.

      # vi /boot/grub/grub.conf

      Delete "rhgb quiet," and add "console=tty0 console=ttyS0,115200" as follows:

      (Before) kernel /vmlinuz<string omitted> rhgb quiet 
      (After the change) kernel /vmlinuz<string omitted> console=tty0 console=ttyS0,115200n

      Add or change the end to the following:

      serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1 
      terminal --timeout=5 serial console
    3. Restart the OS.

      # reboot
  3. Deletion of the MAC address

    Delete the udev rule file information and the MAC address information in the network interface settings file so that the settings for the network interface are set correctly for the virtual machine whose MAC address has been changed after migration.

    1. Save the definition file. If no definition file exists, this operation is not required.

      # cp -p /etc/udev/rules.d/70-persistent-net.rules 
      /etc/udev/rules.d/70-persistent-net.rules.bak 
      # cp -p /lib/udev/rules.d/75-persistent-net-generator.rules 
      /lib/udev/rules.d/75-persistent-net-generator.rules.bak
    2. Replace the definition file with an empty file.

      # rm /etc/udev/rules.d/70-persistent-net.rules 
      # rm /lib/udev/rules.d/75-persistent-net-generator.rules 
      # touch /etc/udev/rules.d/70-persistent-net.rules 
      # touch /lib/udev/rules.d/75-persistent-net-generator.rules
    3. Delete the line with "HWADDR=" (the MAC address information) from /etc/sysconfig/network-scripts/ifcfg-<network interface name>.
    4. Restart the OS.

      # reboot
  4. Assigning a subscription

    If you have not assigned a subscription to a virtual server, do the following:

    1. Register the server to the subscription service.

      After you have run the following command, enter the user name and password of your Red Hat account, then register the system to the subscription service.

      # subscription-manager register
    2. Check for a subscription that can be assigned.

      Check for a subscription that can be assigned which has been registered to the subscription service. After running the command shown below, take a note of the Pool ID of the subscription to be assigned.

      # subscription-manager list --available | less
    3. Assign a subscription.

      Specify the Pool ID that you took a note of in step 2, and assign a subscription to the virtual server.

      # subscription-manager subscribe --pool=<Pool ID>
  5. Installation of an SSH server

    Install an SSH server by following the procedure below.

    # yum -y install openssh-server 
    # chkconfig sshd on 
    # service sshd start
    Tip: Configure the SSH service settings as necessary.
  6. Installation of cloud-init

    Install cloud-init.

    # yum -y install cloud-init --enablerepo=rhel-6-server-rh-common-rpms
  7. Unregistration of the subscription service

    Unregister the system from the subscription service.

    # subscription-manager unregister
  8. Configuring cloud.cfg

    Configure the settings of /etc/cloud/cloud.cfg.

    Configure the operational settings of cloud-init in /etc/cloud/cloud.cfg. For details on the settings, refer to the support site of cloud-init.

  9. Setting of network (DHCP connection)
    Tip: To connect a virtual server via a network using DHCP after importing the image, configure the settings shown below. When the fixed IP address is set, the same IP address is used for startup after importing the image.
    1. Check the setting of /etc/sysconfig/network-scripts/ifcfg-<network interface name>.

      ONBOOT=yes 
      BOOTPROTO=dhcp

      Delete the following lines if they exist.

      IPADDR=10.4.0.110 
      PREFIX=22 
      GATEWAY=10.4.0.220

      * The above values are examples.

    2. Restart the network.

      # service network restart
  10. Disabling Zeroconf

    Disable Zeroconf so that the migrated virtual machine can acquire metadata.

    # vi /etc/sysconfig/network

    Add the following line.

    NOZEROCONF=yes

    * Delete the following line if it exists. The value is an example.

    GATEWAY=10.4.0.220
  11. Disabling of the firewall
    # service iptables stop 
    # chkconfig iptables off
  12. Shutting down the OS

    Shut down the OS.

    # shutdown -h now