Examples of Storing Disk Images With ZFS

The following examples show how to store disk images using a ZFS volume or a ZFS file. The syntax to export a ZFS volume or file is the same but the path to the back end is different.

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

Example 11-2 Storing a Disk Image Using a ZFS Volume

First, create a 20-Gbyte image on a ZFS volume.

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

Then, export the ZFS volume as a virtual disk.

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

Assign the ZFS volume to the ldg1 guest domain.

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

Example 11-3 Storing a Disk Image Using a ZFS File

First, create a 20-Gbyte disk image on a ZFS volume and create the ZFS file.

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

Then, export the ZFS file as a virtual disk.

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

Assign the ZFS file to the ldg1 guest domain.

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