Using Virtual Disks With Volume Managers

Any ZFS, Solaris Volume Manager, or Veritas Volume Manager (VxVM) volume can be exported from a service domain to a guest domain as a virtual disk. A volume can be exported either as a single-slice disk (if the slice option is specified with the ldm add-vdsdev command) or as a full disk.

Note:

The remainder of this section uses a Solaris Volume Manager volume as an example. However, the discussion also applies to ZFS and VxVM volumes.

The following examples show how to export a volume as a single-slice disk.

The virtual disk in the guest domain (for example, /dev/dsk/c0d2s0) is directly mapped to the associated volume (for example, /dev/md/dsk/d0), and data stored onto the virtual disk from the guest domain are directly stored onto the associated volume with no extra metadata. Data stored on the virtual disk from the guest domain can therefore also be directly accessed from the service domain through the associated volume.

Examples

  • If the Solaris Volume Manager volume d0 is exported from the primary domain to domain1, then the configuration of domain1 requires some extra steps.

    primary# metainit d0 3 1 c2t70d0s6 1 c2t80d0s6 1 c2t90d0s6
    primary# ldm add-vdsdev options=slice /dev/md/dsk/d0 vol3@primary-vds0
    primary# ldm add-vdisk vdisk3 vol3@primary-vds0 domain1
  • After domain1 has been bound and started, the exported volume appears as /dev/dsk/c0d2s0, for example, and you can use it.

    domain1# newfs /dev/rdsk/c0d2s0
    domain1# mount /dev/dsk/c0d2s0 /mnt
    domain1# echo test-domain1 > /mnt/file
  • After domain1 has been stopped and unbound, data stored on the virtual disk from domain1 can be directly accessed from the primary domain through Solaris Volume Manager volume d0.

    primary# mount /dev/md/dsk/d0 /mnt
    primary# cat /mnt/file
    test-domain1