Migrating an Image of Ubuntu

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 Ubuntu.

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. Installation of an SSH server

    Install an SSH server by following the procedure below.

    # apt-get install openssh-server
    Tip: Configure the SSH service settings as necessary.
  3. Installation of cloud-init

    Install cloud-init by following the procedure below.

    # apt-get install cloud-init 
    # dpkg-reconfigure cloud-init
  4. Setting of the output destination of the boot log

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

    1. Save /etc/default/grub and add the definition that enables the Kernel to write boot logs to the ttyS0 device to grub.

      # cp -p /etc/default/grub /root/grub.bak 
      # vi /etc/default/grub

      Add the following settings to grub:

      GRUB_CMDLINE_LINUX_DEFAULT=console=tty0 console=ttyS0,115200 
      GRUB_TERMINAL=console
    2. Execute the following command to apply the settings:

      # update-grub
  5. 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.

    Using the network interface definition defined in /etc/network/interfaces, configure the settings so that the DHCP connection is used.

    # vim /etc/network/interfaces

    An example of setting eth0 is as follows:

    auto eth0 
    iface eth0 inet dhcp
  6. Deletion of the MAC address
    1. Save the configuration file. If no configuration file exists, this operation is not required.

      # cp /etc/udev/rules.d/70-persistent-net.rules \ 
      /etc/udev/rules.d/70-persistent-net.rules.bak 
      # cp /lib/udev/rules.d/75-persistent-net-generator.rules \ 
      /lib/udev/rules.d/75-persistent-net-generator.rules.bak
    2. Delete the MAC address information.

      # 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
  7. Disabling of the firewall
    1. Install iptables-persistent with the following command:

      # apt-get install iptables-persistent
    2. Initialize the iptables settings and make the settings persistent.

      # iptables ?F 
      # /etc/init.d/iptables-persistent save
  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. Shutting down the OS

    Shut down the OS.

    # shutdown -h