System Administration Guide: Oracle Solaris Containers-Resource Management and Oracle Solaris Zones

Chapter 24 Solaris 10 9/10: Migrating a Physical Solaris System Into a Zone (Tasks)

A "physical to virtual" (P2V) capability is used to directly migrate an existing Solaris system into a native zone on a target system.

Assessing the System To Be Migrated

Depending on the services performed by the original system, the global administrator might need to manually customize the zone after it has been installed. For example, the privileges assigned to the zone might need to be modified. This is not done automatically. Also, because all system services do not work inside zones, not every physical system is a good candidate for migration into a zone.

Note that if the system image to be installed through P2V is newer than the target host operating system release, the installation will fail.

ProcedureHow to Collect System Information

Collect required information from the source system.

  1. Obtain the hostname:


    # hostname
    
  2. Obtain the hostid:


    # hostid
    

    Also see Host ID Emulation.

  3. Obtain the root password.

  4. View the software being run on the system:


    # ps -eaf
    
  5. Check the networking configuration on the system:


    # ifconfig -a
    
  6. View the storage utilized, for example, by viewing the contents of /etc/vfstab.

  7. View the amount of local disk storage in use, which determines the size of the archive:


    # df -k
    
  8. Determine the packages and patches that are on the system. See pkginfo(1) for more information.

  9. Examine the contents of /etc/system.

Creating the Image Used to Directly Migrate A Solaris System Into a Zone

You can use the Flash Archiving tools to create an image of an installed system that can be migrated into a zone.

The system can be fully configured with all of the software that will be run in the zone before the image is created. This image is then used by the installation program when the zone is installed.


Caution – Caution –

If you create a Solaris Flash archive, or flar, of a Solaris 10 system that has a ZFS root, then by default, the flar will actually be a ZFS send stream, which can be used to recreate the root pool. This image cannot be used to install a zone. You must create the flar with an explicit cpio or pax archive when the system has a ZFS root.

Use the flarcreate command with the -L archiver option, specifying cpio or pax as the method to archive the files. See Step 4 in the next procedure.


ProcedureHow to Use flarcreate to Create the Image

Use the flarcreate command described in the flarcreate(1M) man page to create the system image. This example procedure uses NFS to place the flash archive on the target Solaris system, but you could use any method to move the file.

You must be the global administrator in the global zone to perform this procedure.

  1. Become superuser, or assume the Primary Administrator role.

  2. Log in to the source system to be archived.

  3. Change directories to the root directory.


    # cd /
    
  4. Use flarcreate to create a flash archive image file named s10-system on the source system, and place the archive onto the target system:


    source-system # flarcreate -S -n s10-system -L cpio /net/target/export/s10-system.flar
    Determining which filesystems will be included in the archive...
    Creating the archive...
    cpio: File size of "etc/mnttab" has
    increased by 435
    2068650 blocks
    1 error(s)
    Archive creation complete.

    The target machine will require root write access to the /export file system. Depending on the size of the file system on the host system, the archive might be several gigabytes in size, so enough space should be available in the target filesystem.


    Tip –

    In some cases, flarcreate can display errors from the cpio command. Most commonly, these are messages such as File size of etc/mnttab has increased by 435. When these messages pertain to log files or files that reflect system state, they can be ignored. Be sure to review all error messages thoroughly.


Other Archive Creation Methods

You can use alternate methods for creating the archive. The installer can accept the following archive formats:

Note that the installer can only accept a directory of files created by using an archiving utility that saves and restores file permissions, ownership, and links.

For more information, see the cpio(1), pax(1), bzip2(1), gzip(1), and ufsdump(1M) man pages.


Note –

If you use a method other than flash archive for creating an archive for P2V, you must unmount the processor-dependent libc.so.1 lofs-mounted hardware capabilities (hwcap) library on the source system before you create the archive. Otherwise, the zone installed with the archive might not boot on the target system. After you have created the archive, you can remount the proper hardware capabilities library on top of /lib/libc.so.1 by using lofs and the mount -O option.


source-system# unmount /lib/libc.so.1
source-system# mount -O -F lofs /lib/libc.so.1 

Host ID Emulation

When applications are migrated from a physical Solaris system into a zone on a new system, the hostid changes to be the hostid of the new machine.

In some cases, applications depend on the original hostid, and it is not possible to update the application configuration. In these cases, the zone can be configured to use the hostid of the original system. This is done by setting a zonecfg property to specify the hostid, as described in How to Configure the Zone. The value used should be the output of the hostid command as run on the original system. To view the hostid in an installed zone, also use the hostid command.

For more information about host IDs, see hostid(1).

Configuring the Zone

Create the new zone configuration on the target system by using the procedure How to Configure the Zone.


Tip –

If you will be using CDs or DVDs to install applications in the new zone, use add fs to add read-only access to CD or DVD media in the global zone when you initially configure the branded zone. A CD or DVD can then be used to install a product in the branded zone. See How to Add Access to CD or DVD Media in a Non-Global Zone for more information.


Installing the Zone

The zoneadm command described in Part II, Zones and in the zoneadm(1M) man page is the primary tool used to install and administer non-global zones. Operations using the zoneadm command must be run from the global zone on the target system.

In addition to unpacking files from the archive, the install process performs checks, required postprocessing, and other functions to ensure that the zone is optimized to run on the host.

You can use an image of a Solaris system that has been fully configured with all of the software that will be run in the zone. See Creating the Image Used to Directly Migrate A Solaris System Into a Zone.

If you created a Solaris system archive from an existing system and use the -p (preserve sysidcfg) option when you install the zone, the zone will have the same identity as the system used to create the image.

If you use the -u (sys-unconfig) option when you install the zone on the target, the zone produced will not have a hostname or name service configured.


Caution – Caution –

You must specify either the -p option or the -u option, or an error results.


Installer Options

Option 

Description 

-a archive

Location of archive from which to copy system image. Full flash archive and cpio, gzip compressed cpio, bzip compressed cpio, and level 0 ufsdump are supported. Refer to the gzip man page available in the SUNWsfman package.

-d path

Location of directory from which to copy system image. 

-d

Use the -d option with the dash parameter to direct that the existing directory layout be used in the zonepath. Thus, if the administrator manually sets up the zonepath directory before the installation, the -d option can be used to indicate that the directory already exists.

-p

Preserve system identity. 

-s

Install silently. 

-u

sys-unconfig the zone.

-v

Verbose output. 

-bpatchid

One or more -b options can be used to specify a patch ID for a patch installed in the system image. These patches will be backed out during the installation process.

The -a and -d options are mutually exclusive. The -p, -s, -u and -v options are only allowed when either -a or -d is provided.

ProcedureHow to Install the Zone

  1. Become superuser, or assume the Primary Administrator role.

  2. Install the configured zone s-zone by using the zoneadm command with the install -a option and the path to the archive.


    global# zoneadm -z s-zone install -u -a /net/machine_name/s-system.flar
    

    You will see various messages as the installation completes. This can take some time.

    When the installation completes, use the list subcommand with the -i and -v options to list the installed zones and verify the status.

Troubleshooting

If an installation fails, review the log file. On success, the log file is in /var/log inside the zone. On failure, the log file is in /var/tmp in the global zone.

If a zone installation is interrupted or fails, the zone is left in the incomplete state. Use uninstall -F to reset the zone to the configured state.

Boot the Zone

ProcedureHow to Boot the Zone

You must be the global administrator in the global zone to perform this procedure.

If the -u option was used, you must also zlogin to the zone console and perform system configuration as described in Performing the Initial Internal Zone Configuration.

  1. Become superuser, or assume the Primary Administrator role.

  2. Use the zoneadm command with the -z option, the name of the zone, which is s-zone, and the boot subcommand to boot the zone.


    global# zoneadm -z s-zone boot
    
  3. When the boot completes, use the list subcommand with the -v option to verify the status.


    global# zoneadm list -v