Logical Domains 1.2 Administration Guide

Storing Disk Images With ZFS

The following command creates a disk image for guest domain ldg1. A ZFS file system for this guest domain is created, and all disk images of this guest domain will be stored on that file system.


primary# zfs create ldmpool/ldg1

Disk images can be stored on ZFS volumes or ZFS files. Creating a ZFS volume, whatever its size, is quick using the zfs create -V command. On the other hand, ZFS files have to be created using the mkfile command. The command can take some time to complete, especially if the file to create is quite large, which is often the case when creating a disk image.

Both ZFS volumes and ZFS files can take advantage of ZFS features such as snapshot and clone, but a ZFS volume is a pseudo device while a ZFS file is a regular file.

If the disk image is to be used as a virtual disk onto which the Solaris OS is to be installed, then it should be large enough to contain:

Therefore, the size of a disk image to install the entire Solaris OS should be at least 8 gigabytes.

Examples of Storing Disk Images With ZFS

    The following examples:

  1. Create a 10-gigabyte image on a ZFS volume or file.

  2. Export the ZFS volume or file as a virtual disk. The syntax to export a ZFS volume or file is the same, but the path to the backend is different.

  3. Assign the exported ZFS volume or file to a guest domain.

When the guest domain is started, the ZFS volume or file appears as a virtual disk on which the Solaris OS can be installed.

ProcedureCreate a Disk Image Using a ZFS Volume

  1. For example, create a 10-gigabyte disk image on a ZFS volume.


    primary# zfs create -V 10gb ldmpool/ldg1/disk0
    

ProcedureCreate a Disk Image Using a ZFS File

  1. For example, create a 10-gigabyte disk image on a ZFS volume.


    primary# zfs create ldmpool/ldg1/disk0
    primary# mkfile 10g /ldmpool/ldg1/disk0/file
    

ProcedureExport the ZFS Volume

  1. Export the ZFS volume as a virtual disk.


    primary# ldm add-vdsdev /dev/zvol/dsk/ldmpool/ldg1/disk0 ldg1_disk0@primary-vds0
    

ProcedureExport the ZFS File

  1. Export the ZFS file as a virtual disk.


    primary# ldm add-vdsdev /ldmpool/ldg1/disk0/file ldg1_disk0@primary-vds0
    

ProcedureAssign the ZFS Volume or File to a Guest Domain

  1. Assign the ZFS volume or file to a guest domain; in this example, ldg1.


    primary# ldm add-vdisk disk0 ldg1_disk0@primary-vds0 ldg1