Go to main content

Oracle® VM Server for SPARC 3.6 Administration Guide

Exit Print View

Updated: September 2019
 
 

File and Volume Exporting

A file or volume (for example from ZFS or Solaris Volume Manager) is exported either as a full disk or as single-slice disk depending on whether the slice option is set.

File or Volume Exported as a Full Disk

If you do not set the slice option, a file or volume is exported as a full disk. In that case, virtual disk drivers (vds and vdc) forward I/O from the virtual disk and manage the partitioning of the virtual disk. The file or volume eventually becomes a disk image containing data from all slices of the virtual disk and the metadata used to manage the partitioning and disk structure.

When a blank file or volume is exported as full disk, it appears in the guest domain as an unformatted disk; that is, a disk with no partition. Then you need to run the format command in the guest domain to define usable partitions and to write a valid disk label. Any I/O to the virtual disk fails while the disk is unformatted.


Note - You must run the format command in the guest domain to create partitions.

How to Export a File as a Full Disk

  1. From the service domain, create a file (fdisk0 for example) to use as the virtual disk.
    service# mkfile 100m /ldoms/domain/test/fdisk0

    The size of the file defines the size of the virtual disk. This example creates a 100-Mbyte blank file to get a 100-Mbyte virtual disk.

  2. From the control domain, export the file as a virtual disk.
    primary# ldm add-vdsdev /ldoms/domain/test/fdisk0 fdisk0@primary-vds0

    In this example, the slice option is not set, so the file is exported as a full disk.

  3. From the control domain, assign the disk to a guest domain.

    For example, assign the disk (fdisk) to guest domain ldg1.

    primary# ldm add-vdisk fdisk fdisk0@primary-vds0 ldg1
  4. After the guest domain is started and running the Oracle Solaris OS, verify that the disk is accessible and is a full disk.

    A full disk is a regular disk with eight slices.

    The following example shows how to list the disk, c0d5, and verify that it is accessible and is a full disk.

    ldg1# ls -1 /dev/dsk/c0d5s*
    /dev/dsk/c0d5s0
    /dev/dsk/c0d5s1
    /dev/dsk/c0d5s2
    /dev/dsk/c0d5s3
    /dev/dsk/c0d5s4
    /dev/dsk/c0d5s5
    /dev/dsk/c0d5s6
    /dev/dsk/c0d5s7

How to Export a ZFS Volume as a Full Disk

  1. Create a ZFS volume to use as a full disk.

    The following example shows how to create a ZFS volume, zdisk0, to use as a full disk:

    service# zfs create -V 100m ldoms/domain/test/zdisk0

    The size of the volume defines the size of the virtual disk. This example creates a 100-Mbyte volume to result in a 100-Mbyte virtual disk.

  2. From the control domain, export the corresponding device to that ZFS volume.
    primary# ldm add-vdsdev /dev/zvol/dsk/ldoms/domain/test/zdisk0 \
    zdisk0@primary-vds0

    In this example, the slice option is not set so the file is exported as a full disk.

  3. From the control domain, assign the volume to a guest domain.

    The following example shows how to assign the volume, zdisk0, to the guest domain ldg1:

    primary# ldm add-vdisk zdisk0 zdisk0@primary-vds0 ldg1
  4. After the guest domain is started and running the Oracle Solaris OS, verify that the disk is accessible and is a full disk.

    A full disk is a regular disk with eight slices.

    The following example shows how to list the disk, c0d9, and verify that it is accessible and is a full disk:

    ldg1# ls -1 /dev/dsk/c0d9s*
    /dev/dsk/c0d9s0
    /dev/dsk/c0d9s1
    /dev/dsk/c0d9s2
    /dev/dsk/c0d9s3
    /dev/dsk/c0d9s4
    /dev/dsk/c0d9s5
    /dev/dsk/c0d9s6
    /dev/dsk/c0d9s7

File or Volume Exported as a Single-Slice Disk

If the slice option is set, then the file or volume is exported as a single-slice disk. In that case, the virtual disk has only one partition (s0), which is directly mapped to the file or volume back end. The file or volume only contains data written to the virtual disk with no extra data like partitioning information or disk structure.

When a file or volume is exported as a single-slice disk, the system simulates a fake disk partitioning which makes that file or volume appear as a disk slice. Because the disk partitioning is simulated, you do not create partitioning for that disk.

How to Export a ZFS Volume as a Single-Slice Disk

  1. Create a ZFS volume to use as a single-slice disk.

    The following example shows how to create a ZFS volume, zdisk0, to use as a single-slice disk.

    service# zfs create -V 100m ldoms/domain/test/zdisk0

    The size of the volume defines the size of the virtual disk. This example creates a 100-Mbyte volume to get a 100-Mbyte virtual disk.

  2. From the control domain, export the corresponding device to that ZFS volume, and set the slice option so that the volume is exported as a single-slice disk.
    primary# ldm add-vdsdev options=slice /dev/zvol/dsk/ldoms/domain/test/zdisk0 \
    zdisk0@primary-vds0
  3. From the control domain, assign the volume to a guest domain.

    The following shows how to assign the volume, zdisk0, to guest domain ldg1.

    primary# ldm add-vdisk zdisk0 zdisk0@primary-vds0 ldg1
  4. After the guest domain is started and running the Oracle Solaris OS, you can list the disk (c0d9, for example) and see that the disk is accessible and is a single-slice disk (s0).
    ldg1# ls -1 /dev/dsk/c0d9s*
    /dev/dsk/c0d9s0
    /dev/dsk/c0d9s1
    /dev/dsk/c0d9s2
    /dev/dsk/c0d9s3
    /dev/dsk/c0d9s4
    /dev/dsk/c0d9s5
    /dev/dsk/c0d9s6
    /dev/dsk/c0d9s7

Exporting Volumes and Backward Compatibility

    If you have a configuration exporting volumes as virtual disks, volumes are now exported as full disks instead of single-slice disks. To preserve the old behavior and to have your volumes exported as single-slice disks, you need to do either of the following:

  • Use the ldm set-vdsdev command in Oracle VM Server for SPARC 3.6 software, and set the slice option for all volumes you want to export as single-slice disks. See the ldm(8) man page.

  • Add the following line to the /etc/system file on the service domain.

    set vds:vd_volume_force_slice = 1

    For information about correctly creating or updating /etc/system property values, see Updating Property Values in the /etc/system File.


    Note - Setting this tunable forces the export of all volumes as single-slice disks, and you cannot export any volume as a full disk.

Summary of How Different Types of Back Ends Are Exported

Table 2  Summary of How Different Types of Back Ends Are Exported
Back End
No Slice Option
Slice Option Set
Disk (disk slice 2)
Full disk

Export the entire disk.

Single-slice disk

Export only slice 2

Disk slice (not slice 2)
Single-slice disk

A slice is always exported as a single-slice disk.

Single-slice disk
File
Full disk
Single-slice disk
Volume, including ZFS, Solaris Volume Manager, or VxVM
Full disk
Single-slice disk

Guidelines for Exporting Files and Disk Slices as Virtual Disks

This section includes guidelines for exporting a file and a disk slice as a virtual disk.

Using the Loopback File (lofi) Driver

Using the loopback file (lofi) driver to export a file as a virtual disk adds an extra driver layer and affects performance of the virtual disk. Instead, you can directly export a file as a full disk or as a single-slice disk. See File and Volume Exporting.

Directly or Indirectly Exporting a Disk Slice

To export a slice as a virtual disk either directly or indirectly (for example through a Solaris Volume Manager volume), ensure that the slice does not start on the first block (block 0) of the physical disk by using the prtvtoc command.

If you directly or indirectly export a disk slice which starts on the first block of a physical disk, you might overwrite the partition table of the physical disk and make all partitions of that disk inaccessible.