Red Hat Training

A Red Hat training course is available for Red Hat Virtualization

11.6. Virtual Disk Tasks

11.6.1. Creating a Virtual Disk

Image disk creation is managed entirely by the Manager. Direct LUN disks require externally prepared targets that already exist. Cinder disks require access to an instance of OpenStack Volume that has been added to the Red Hat Virtualization environment using the External Providers window; see Section 12.2.4, “Adding an OpenStack Volume (Cinder) Instance for Storage Management” for more information.
You can create a floating virtual disk that does not belong to any virtual machines. You can attach this disk to a single virtual machine, or to multiple virtual machines if the disk is shareable.

Procedure 11.2. Creating a Floating Virtual Disk

Important

Creating floating virtual disks is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs), might not be functionally complete, and Red Hat does not recommend to use them for production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
For more information on Red Hat Technology Preview features support scope, see https://access.redhat.com/support/offerings/techpreview/.
  1. In the Administration Portal, click the Disks resource tab.
  2. Click New.
    Add Virtual Disk Window (Floating Virtual Disk)

    Figure 11.1. Add Virtual Disk Window (Floating Virtual Disk)

  3. Use the radio buttons to specify whether the virtual disk will be an Image, Direct LUN, or Cinder disk.
  4. Select the options required for your virtual disk. The options change based on the disk type selected. See Section 11.6.2, “Explanation of Settings in the New Virtual Disk Window” for more details on each option for each disk type.
  5. Click OK.
You can create a virtual disk that is attached to a virtual machine.

Procedure 11.3. Creating a Virtual Disk Attached to a Virtual Machine

  1. In the Administration Portal, click the Virtual Machines resource tab.
  2. Select a virtual machine.
  3. Click the Disks resource tab in the bottom pane.
  4. Click New.
    Add Virtual Disk Window (Attached Virtual Disk)

    Figure 11.2. Add Virtual Disk Window (Attached Virtual Disk)

  5. Use the radio buttons to specify whether the virtual disk will be an Image, Direct LUN, or Cinder disk.
  6. Select the options required for your virtual disk. The options change based on the disk type selected. See Section 11.6.2, “Explanation of Settings in the New Virtual Disk Window” for more details on each option for each disk type.
  7. Click OK.

11.6.2. Explanation of Settings in the New Virtual Disk Window

Because the New Virtual Disk windows for creating floating and attached virtual disks are very similar, their settings are described in a single section. A floating window, however, does not have an interface setting because it has not yet been attached to a virtual machine.

Important

Using LUNs directly as virtual machine hard disk images removes a layer of abstraction between your virtual machines and their data.
The following considerations must be made when using a direct LUN as a virtual machine hard disk image:
  • Live storage migration of direct LUN hard disk images is not supported.
  • Direct LUN disks are not included in virtual machine exports.
  • Direct LUN disks are not included in virtual machine snapshots.
The Cinder settings form will be disabled if there are no available OpenStack Volume storage domains on which you have permissions to create a disk in the relevant Data Center. Cinder disks require access to an instance of OpenStack Volume that has been added to the Red Hat Virtualization environment using the External Providers window; see Section 12.2.4, “Adding an OpenStack Volume (Cinder) Instance for Storage Management” for more information.

Note

Because the Image and Cinder settings overlap, only the settings specific to Direct LUN are marked below (Direct LUN).
  • Size: The size of the new virtual disk in GB.
  • Alias: The name of the virtual disk, limited to 40 characters.
  • Description: A description of the virtual disk. This field is recommended but not mandatory.
    • (Direct LUN): By default the last 4 characters of the LUN ID are inserted into the field. The default behavior can be configured by setting the PopulateDirectLUNDiskDescriptionWithLUNId configuration key to the appropriate value using the engine-config command. The configuration key can be set to -1 for the full LUN ID to be used or 0 for this feature to be ignored. A positive integer populates the description with the corresponding number of characters of the LUN ID. See Section 19.2.2, “Syntax for the engine-config Command” for more information.
  • Interface: The virtual interface that the disk presents to virtual machines. The interface type can be updated after stopping all virtual machines that the disk is attached to.
    • IDE is a widely used interface for mass storage devices. It does not require additional drivers.
    • VirtIO is a simple, high-performance, para-virtualized storage device. It is faster than IDE and requires additional drivers, which have been included since Red Hat Enterprise Linux 5. Windows does not include these drivers, but they can be installed from the guest tools ISO or virtual floppy disk.
      • VirtIO maps PCI functions and storage devices 1:1, limiting scalability.
      • Because VirtIO is not a true SCSI device, some applications may break when they are moved from physical to virtual machines.
    • VirtIO-SCSI is a virtual SCSI HBA for KVM guests. It replaces and supersedes VirtIO. While it provides the same performance as VirtIO, VirtIO-SCSI has significant advantages. VirtIO-SCSI requires additional drivers, which have been included since Red Hat Enterprise Linux 6.4. Windows does not include these drivers, but they can be installed from the guest tools ISO or virtual floppy disk.

      Important

      VirtIO-SCSI must be enabled in order to appear in the Interface dropdown list. To enable VirtIO-SCSI, select the virtual machine, click Edit, click Show Advanced Options, click the Resource Allocation tab, and click the VirtIO-SCSI Enabled radio button.
      • VirtIO-SCSI is more scalable than VirtIO, allowing virtual machines to connect to more storage devices.
      • VirtIO-SCSI uses standard device naming, so that VirtIO-SCSI disks have the same paths as a bare-metal system. This simplifies physical-to-virtual and virtual-to-virtual migration.
      • VirtIO-SCSI can present physical storage devices directly to guests, using SCSI device passthrough.
  • Data Center: The data center in which the virtual disk will be available.
  • Storage Domain: The storage domain in which the virtual disk will be stored. The drop-down list shows all storage domains available in the given data center, and also shows the total space and currently available space in the storage domain.
  • Allocation Policy: The provisioning policy for the new virtual disk.
    • Preallocated allocates the entire size of the disk on the storage domain at the time the virtual disk is created. The virtual size and the actual size of a preallocated disk are the same. Preallocated virtual disks take more time to create than thinly provisioned virtual disks, but have better read and write performance. Preallocated virtual disks are recommended for servers and other I/O intensive virtual machines. If a virtual machine is able to write more than 1 GB every four seconds, use preallocated disks where possible.
    • Thin Provision allocates 1 GB at the time the virtual disk is created and sets a maximum limit on the size to which the disk can grow, for block-level storage (iSCSI, Fibre Channel). For file-level storage (NFS, Gluster), there is no maximum size; the file can grow. The virtual size of the disk is the maximum limit; the actual size of the disk is the space that has been allocated so far. Thinly provisioned disks are faster to create than preallocated disks and allow for storage over-commitment. Thinly provisioned virtual disks are recommended for desktops.
  • Disk Profile: The disk profile assigned to the virtual disk. Disk profiles define the maximum amount of throughput and the maximum level of input and output operations for a virtual disk in a storage domain. Disk profiles are defined on the storage domain level based on storage quality of service entries created for data centers.
  • Use Host (Direct LUN): The host on which the LUN will be mounted. You can select any host in the data center.
  • Storage Type (Direct LUN): The type of external LUN to add. You can select from either iSCSI or Fibre Channel.
  • Discover Targets (Direct LUN): This section can be expanded when you are using iSCSI external LUNs and Targets > LUNs is selected.
    • Address - The host name or IP address of the target server.
    • Port - The port by which to attempt a connection to the target server. The default port is 3260.
    • User Authentication - The iSCSI server requires User Authentication. The User Authentication field is visible when you are using iSCSI external LUNs.
      • CHAP username - The user name of a user with permission to log in to LUNs. This field is accessible when the User Authentication check box is selected.
      • CHAP password - The password of a user with permission to log in to LUNs. This field is accessible when the User Authentication check box is selected.
  • Wipe After Delete: Allows you to enable enhanced security for deletion of sensitive material when the virtual disk is deleted.
  • Volume Type: The volume type of the virtual disk. The drop-down list shows all available volume types. The volume type will be managed and configured on OpenStack Cinder.
  • Bootable: Allows you to enable the bootable flag on the virtual disk.
  • Shareable: Allows you to attach the virtual disk to more than one virtual machine at a time.
  • Enable SCSI Pass-Through (Direct LUN): Available when the Interface is set to VirtIO-SCSI. Selecting this check box enables passthrough of a physical SCSI device to the virtual disk. A VirtIO-SCSI interface with SCSI passthrough enabled automatically includes SCSI discard support. When this check box is not selected, the virtual disk uses an emulated SCSI device.
  • Allow Privileged SCSI I/O (Direct LUN): Available when the Enable SCSI Pass-Through check box is selected. Selecting this check box enables unfiltered SCSI Generic I/O (SG_IO) access, allowing privileged SG_IO commands on the disk. This is required for persistent reservations.

11.6.3. Overview of Live Storage Migration

Virtual disks can be migrated from one storage domain to another while the virtual machine to which they are attached is running. This is referred to as live storage migration. When a disk attached to a running virtual machine is migrated, a snapshot of that disk's image chain is created in the source storage domain, and the entire image chain is replicated in the destination storage domain. As such, ensure that you have sufficient storage space in both the source storage domain and the destination storage domain to host both the disk image chain and the snapshot. A new snapshot is created on each live storage migration attempt, even when the migration fails.
Consider the following when using live storage migration:
  • You can live migrate multiple disks at one time.
  • Multiple disks for the same virtual machine can reside across more than one storage domain, but the image chain for each disk must reside on a single storage domain.
  • You can live migrate disks between any two storage domains in the same data center.
  • You cannot live migrate direct LUN hard disk images or disks marked as shareable.

11.6.4. Moving a Virtual Disk

Move a virtual disk that is attached to a virtual machine or acts as a floating virtual disk from one storage domain to another. You can move a virtual disk that is attached to a running virtual machine; this is referred to as live storage migration. Alternatively, shut down the virtual machine before continuing.
Consider the following when moving a disk:
  • You can move multiple disks at the same time.
  • You can move disks between any two storage domains in the same data center.
  • If the virtual disk is attached to a virtual machine that was created based on a template and used the thin provisioning storage allocation option, you must copy the disks for the template on which the virtual machine was based to the same storage domain as the virtual disk.

Procedure 11.4. Moving a Virtual Disk

  1. Select the Disks tab.
  2. Select one or more virtual disks to move.
  3. Click Move to open the Move Disk(s) window.
  4. From the Target list, select the storage domain to which the virtual disk(s) will be moved.
  5. From the Disk Profile list, select a profile for the disk(s), if applicable.
  6. Click OK.
The virtual disks are moved to the target storage domain. During the move procedure, the Status column displays Locked and a progress bar indicating the progress of the move operation.

11.6.5. Changing the Disk Interface Type

Users can change a disk's interface type after the disk has been created. This enables you to attach an existing disk to a virtual machine that requires a different interface type. For example, a disk using the VirtIO interface can be attached to a virtual machine requiring the VirtIO-SCSI or IDE interface. This provides flexibility to migrate disks for the purpose of backup and restore, or disaster recovery. The disk interface for shareable disks can also be updated per virtual machine. This means that each virtual machine that uses the shared disk can use a different interface type.
To update a disk interface type, all virtual machines using the disk must first be stopped.

Procedure 11.5. Changing a Disk Interface Type

  1. Select the Virtual Machines tab and stop the appropriate virtual machine(s).
  2. From the Disks sub-tab, select the disk and click Edit.
  3. From the Interface list, select the new interface type and click OK.
The virtual machine will now use a different virtual interface for the disk.
The following procedure shows how to attach a disk to a different virtual machine that requires a different interface type.

Procedure 11.6. Attaching a Disk to a Different Virtual Machine using a Different Interface Type

  1. Select the Virtual Machines tab and stop the appropriate virtual machine(s).
  2. Select the virtual machine from which to detach the disk.
  3. From the Disks sub-tab, select the disk and click Remove.
  4. From the Virtual Machines tab, select the new virtual machine that the disk will be attached to.
  5. Click Attach.
  6. Select the disk in the Attach Virtual Disks window and select the appropriate interface from the Interface drop-down.
  7. Click OK.

11.6.6. Copying a Virtual Disk

Summary

You can copy a virtual disk from one storage domain to another. The copied disk can be attached to virtual machines.

Procedure 11.7. Copying a Virtual Disk

  1. Select the Disks tab.
  2. Select the virtual disks to copy.
  3. Click the Copy button to open the Copy Disk(s) window.
  4. Optionally, enter an alias in the Alias text field.
  5. Use the Target drop-down menus to select the storage domain to which the virtual disk will be copied.
  6. Click OK.
Result

The virtual disks are copied to the target storage domain, and have a status of Locked while being copied.

11.6.7. Uploading and Downloading a Virtual Disk to a Storage Domain

QEMU-compatible virtual disks can be uploaded from your local machine to a Red Hat Virtualization storage domain and attached to virtual machines.
Virtual disk types must be either QCOW2 or Raw. Disks created from a QCOW2 virtual disk cannot be shareable, and the QCOW2 virtual disk file must not have a backing file.
A virtual disk can be uploaded using the Manager or REST API, but can only be downloaded using the REST API. When using the REST API, use the IMAGETRANSFERS service to create the transfer, and the IMAGETRANSFER service to specify whether to upload or download the image.
For more information about all of the available methods that can be used with these services, see IMAGETRANSFERS and IMAGETRANSFER in the REST API Guide.

Prerequisites:

  • You must configure the Image I/O Proxy (ovirt-imageio-proxy) when running engine-setup. See Configuring the Red Hat Virtualization Manager in the Installation Guide for more information.
  • You must import the required certificate authority into the web browser used to access the Administration Portal.
  • Internet Explorer 10, Firefox 35, or Chrome 13 or greater is required to perform this upload procedure. Previous browser versions do not support the required HTML5 APIs.

Note

To import the certificate authority, browse to https://engine_address/ovirt-engine/services/pki-resource?resource=ca-certificate&format=X509-PEM-CA and select all the trust settings. Refer to the instructions to install the certificate authority in Firefox, Internet Explorer, or Google Chrome.

Procedure 11.8. Uploading a Disk Image to a Storage Domain

  1. Click the Disks resource tab.
  2. Select Start from the Upload menu.

    Note

    You can also access this menu by clicking the Storage resource tab, selecting the storage domain, then selecting the Disks sub-tab.
    The Upload Image Screen

    Figure 11.3. The Upload Image Screen

  3. Click Choose File, and select the image on the local disk.
  4. Fill in the fields in the Disk Options area. See Section 11.6.2, “Explanation of Settings in the New Virtual Disk Window” for a description of the relevant fields.
  5. Click OK.
A progress bar will indicate the status of the upload. You can also pause, cancel, or resume uploads from the Upload menu.

11.6.8. Importing a Disk Image from an Imported Storage Domain

Import floating virtual disks from an imported storage domain using the Disk Import tab of the details pane.

Note

Only QEMU-compatible disks can be imported into the Manager.

Procedure 11.9. Importing a Disk Image

  1. Select a storage domain that has been imported into the data center.
  2. In the details pane, click Disk Import.
  3. Select one or more disk images and click Import to open the Import Disk(s) window.
  4. Select the appropriate Disk Profile for each disk.
  5. Click OK to import the selected disks.

11.6.9. Importing an Unregistered Disk Image from an Imported Storage Domain

Import floating virtual disks from a storage domain using the Disk Import tab of the details pane. Floating disks created outside of a Red Hat Virtualization environment are not registered with the Manager. Scan the storage domain to identify unregistered floating disks to be imported.

Note

Only QEMU-compatible disks can be imported into the Manager.

Procedure 11.10. Importing a Disk Image

  1. Select a storage domain that has been imported into the data center.
  2. Right-click the storage domain and select Scan Disks so that the Manager can identify unregistered disks.
  3. In the details pane, click Disk Import.
  4. Select one or more disk images and click Import to open the Import Disk(s) window.
  5. Select the appropriate Disk Profile for each disk.
  6. Click OK to import the selected disks.

11.6.10. Importing a Virtual Disk from an OpenStack Image Service

Summary

virtual disks managed by an OpenStack Image Service can be imported into the Red Hat Virtualization Manager if that OpenStack Image Service has been added to the Manager as an external provider.

  1. Click the Storage resource tab and select the OpenStack Image Service domain from the results list.
  2. Select the image to import in the Images tab of the details pane.
  3. Click Import to open the Import Image(s) window.
  4. From the Data Center drop-down menu, select the data center into which the virtual disk will be imported.
  5. From the Domain Name drop-down menu, select the storage domain in which the virtual disk will be stored.
  6. Optionally, select a quota from the Quota drop-down menu to apply a quota to the virtual disk.
  7. Click OK to import the image.
Result

The image is imported as a floating disk and is displayed in the results list of the Disks resource tab. It can now be attached to a virtual machine.

11.6.11. Exporting a Virtual Disk to an OpenStack Image Service

Summary

Virtual disks can be exported to an OpenStack Image Service that has been added to the Manager as an external provider.

  1. Click the Disks resource tab.
  2. Select the disks to export.
  3. Click the Export button to open the Export Image(s) window.
  4. From the Domain Name drop-down list, select the OpenStack Image Service to which the disks will be exported.
  5. From the Quota drop-down list, select a quota for the disks if a quota is to be applied.
  6. Click OK.
Result

The virtual disks are exported to the specified OpenStack Image Service where they are managed as virtual disks.

Important

Virtual disks can only be exported if they do not have multiple volumes, are not thinly provisioned, and do not have any snapshots.

11.6.12. Reclaiming Virtual Disk Space

Virtual disks that use thin provisioning do not automatically shrink after deleting files from them. For example, if the actual disk size is 100GB and you delete 50GB of files, the allocated disk size remains at 100GB, and the remaining 50GB is not returned to the host, and therefore cannot be used by other virtual machines. This unused disk space can be reclaimed by the host by performing a sparsify operation on the virtual machine's disks. This transfers the free space from the disk image to the host.
It is recommended that you perform this operation before cloning a virtual machine, creating a template based on a virtual machine, or cleaning up a storage domain's disk space.

Limitations

  • NFS storage domains must use NFS version 4.2 or higher.
  • You cannot sparsify a disk that uses a direct LUN or Cinder.
  • You cannot sparsify a disk that uses a preallocated allocation policy. If you are creating a virtual machine from a template, you must select Thin from the Storage Allocation field, or if selecting Clone, ensure that the template is based on a virtual machine that has thin provisioning.
  • You can only sparsify active snapshots.

Procedure 11.11. Sparsifying a Disk

  1. Click the Virtual Machines tab and select the virtual machine. Ensure that its status displays as Down. If the virtual machine is running you must shut it down before proceeding.
  2. Select the Disks tab in the details pane. Ensure that its status displays as OK.
  3. Select the Sparsify button. A Sparsify Disks window appears asking you to confirm the sparsify operation for the selected disk.
  4. Click OK.
A Started to sparsify event appears in the Events tab at the bottom of the window during the sparsify operation and the disk's status displays as Locked. When the operation is complete, a Sparsified successfully event appears in the Events tab and the disk's status displays as OK. The unused disk space has been returned to the host and is available for use by other virtual machines.

Note

You can sparsify multiple virtual disk(s) in parallel.