Go to main content

Oracle® VM Server for SPARC 3.5 Administration Guide

Exit Print View

Updated: November 2017
 
 

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 by using the mkfile command. This command can take some time to complete, especially if the file to be created 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 the snapshot and clone features, 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 an OS is installed, the disk image must be large enough to accommodate the OS installation requirements. This size depends on the version of the OS and on the type of installation performed. If you install the Oracle Solaris OS, you can use a disk size of 20 Gbytes to accommodate any type of installation of any version of the Oracle Solaris OS.

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 35  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 36  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