13.6. Virtual Disk Tasks 13.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 14.2.4, "Adding an OpenStack Block Storage (Cinder) Instance for Storage Management" for more information. You can create a virtual disk that is attached to a specific virtual machine. Additional options are available when creating an attached virtual disk, as specified in Section 13.6.2, "Explanation of Settings in the New Virtual Disk Window" . Creating a Virtual Disk Attached to a Virtual Machine Click Compute Virtual Machines . Click the virtual machine's name to open the details view. Click the Disks tab. Click New . Click the appropriate button to specify whether the virtual disk will be an Image , Direct LUN , or Cinder disk. Select the options required for your virtual disk. The options change based on the disk type selected. See Section 13.6.2, "Explanation of Settings in the New Virtual Disk Window" for more details on each option for each disk type. Click OK . You can also 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. Some options are not available when creating a virtual disk, as specified in Section 13.6.2, "Explanation of Settings in the New Virtual Disk Window" . 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/ . Click Storage Disks . Click New . Click the appropriate button to specify whether the virtual disk will be an Image , Direct LUN , or Cinder disk. Select the options required for your virtual disk. The options change based on the disk type selected. See Section 13.6.2, "Explanation of Settings in the New Virtual Disk Window" for more details on each option for each disk type. Click OK . 13.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. Table 13.2. New Virtual Disk and Edit Virtual Disk Settings: Image Field Name Description Size(GB) 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. Interface This field only appears when creating an attached disk. The virtual interface the disk presents to virtual machines. VirtIO is faster, but requires drivers. Red Hat Enterprise Linux 5 and later include these drivers. Windows does not include these drivers, but they can be installed from the guest tools ISO or virtual floppy disk. IDE devices do not require special drivers. The interface type can be updated after stopping all virtual machines that the disk is attached to. Data Center This field only appears when creating a floating disk. 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 thin 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. 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. Thin provisioned disks are faster to create than preallocated disks and allow for storage over-commitment. Thin 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. Activate Disk(s) This field only appears when creating an attached disk. Activate the virtual disk immediately after creation. Wipe After Delete Allows you to enable enhanced security for deletion of sensitive material when the virtual disk is deleted. Bootable This field only appears when creating an attached disk. 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. Read-Only This field only appears when creating an attached disk. Allows you to set the disk as read-only. The same disk can be attached as read-only to one virtual machine, and as rewritable to another. Enable Discard This field only appears when creating an attached disk. Allows you to shrink a thin provisioned disk while the virtual machine is up. For block storage, the underlying storage device must support discard calls, and the option cannot be used with Wipe After Delete unless the underlying storage supports the discard_zeroes_data property. For file storage, the underlying file system and the block device must support discard calls. If all requirements are met, SCSI UNMAP commands issued from guest virtual machines is passed on by QEMU to the underlying storage to free up the unused space. The Direct LUN settings can be displayed in either Targets > LUNs or LUNs > Targets . Targets > LUNs sorts available LUNs according to the host on which they are discovered, whereas LUNs > Targets displays a single list of LUNs. Fill in the fields in the Discover Targets section and click Discover to discover the target server. You can then click the Login All button to list the available LUNs on the target server and, using the radio buttons to each LUN, select the LUN to add. 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. Table 13.3. New Virtual Disk and Edit Virtual Disk Settings: Direct LUN Field Name Description 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. By default the last 4 characters of the LUN ID is 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. Interface This field only appears when creating an attached disk. The virtual interface the disk presents to virtual machines. VirtIO is faster, but requires drivers. Red Hat Enterprise Linux 5 and later include these drivers. Windows does not include these drivers, but they can be installed from the guest tools ISO or virtual floppy disk. IDE devices do not require special drivers. The interface type can be updated after stopping all virtual machines that the disk is attached to. Data Center This field only appears when creating a floating disk. The data center in which the virtual disk will be available. Host The host on which the LUN will be mounted. You can select any host in the data center. Storage Type The type of external LUN to add. You can select from either iSCSI or Fibre Channel . Discover Targets 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 user name - 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. Activate Disk(s) This field only appears when creating an attached disk. Activate the virtual disk immediately after creation. Bootable This field only appears when creating an attached disk. 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. Read-Only This field only appears when creating an attached disk. Allows you to set the disk as read-only. The same disk can be attached as read-only to one virtual machine, and as rewritable to another. Enable Discard This field only appears when creating an attached disk. Allows you to shrink a thin provisioned disk while the virtual machine is up. With this option enabled, SCSI UNMAP commands issued from guest virtual machines is passed on by QEMU to the underlying storage to free up the unused space. Enable SCSI Pass-Through This field only appears when creating an attached disk. 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. Read-Only is not supported when this check box is selected. When this check box is not selected, the virtual disk uses an emulated SCSI device. Read-Only is supported on emulated VirtIO-SCSI disks. Allow Privileged SCSI I/O This field only appears when creating an attached disk. 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. Using SCSI Reservation This field only appears when creating an attached disk. Available when the Enable SCSI Pass-Through and Allow Privileged SCSI I/O check boxes are selected. Selecting this check box disables migration for any virtual machine using this disk, to prevent virtual machines that are using SCSI reservation from losing access to the disk. 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 14.2.4, "Adding an OpenStack Block Storage (Cinder) Instance for Storage Management" for more information. Table 13.4. New Virtual Disk and Edit Virtual Disk Settings: Cinder Field Name Description Size(GB) 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. Interface This field only appears when creating an attached disk. The virtual interface the disk presents to virtual machines. VirtIO is faster, but requires drivers. Red Hat Enterprise Linux 5 and later include these drivers. Windows does not include these drivers, but they can be installed from the guest tools ISO or virtual floppy disk. IDE devices do not require special drivers. The interface type can be updated after stopping all virtual machines that the disk is attached to. Data Center This field only appears when creating a floating disk. 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. 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. Activate Disk(s) This field only appears when creating an attached disk. Activate the virtual disk immediately after creation. Bootable This field only appears when creating an attached disk. 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. Read-Only This field only appears when creating an attached disk. Allows you to set the disk as read-only. The same disk can be attached as read-only to one virtual machine, and as rewritable to another. Important Mounting a journaled file system requires read-write access. Using the Read-Only option is not appropriate for virtual disks that contain such file systems (e.g. EXT3 , EXT4 , or XFS ). 13.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. 13.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. Moving a Virtual Disk Click Storage Disks and select one or more virtual disks to move. Click Move . From the Target list, select the storage domain to which the virtual disk(s) will be moved. From the Disk Profile list, select a profile for the disk(s), if applicable. 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. 13.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. Changing a Disk Interface Type Click Compute Virtual Machines and stop the appropriate virtual machine(s). Click the virtual machine's name to open the details view. Click the Disks tab and select the disk. Click Edit . From the Interface list, select the new interface type and click OK . You can attach a disk to a different virtual machine that requires a different interface type. Attaching a Disk to a Different Virtual Machine using a Different Interface Type Click Compute Virtual Machines and stop the appropriate virtual machine(s). Click the virtual machine's name to open the details view. Click the Disks tab and select the disk. Click Remove , then click OK . Go back to Virtual Machines and click the name of the new virtual machine that the disk will be attached to. Click the Disks tab, then click Attach . Select the disk in the Attach Virtual Disks window and select the appropriate interface from the Interface drop-down. Click OK . 13.6.6. Copying a Virtual Disk You can copy a virtual disk from one storage domain to another. The copied disk can be attached to virtual machines. Copying a Virtual Disk Click Storage Disks and select the virtual disk(s). Click Copy . Optionally, enter a new name in the Alias field. From the Target list, select the storage domain to which the virtual disk(s) will be copied. From the Disk Profile list, select a profile for the disk(s), if applicable. Click OK . The virtual disks have a status of Locked while being copied. 13.6.7. Uploading Images to a Data Storage Domain You can upload virtual disk images and ISO images to your data storage domain in the Administration Portal or with the REST API. See Section 11.8.1, "Uploading Images to a Data Storage Domain" . 13.6.8. Importing a Disk Image from an Imported Storage Domain Import floating virtual disks from an imported storage domain. Note Only QEMU-compatible disks can be imported into the Manager. Importing a Disk Image Click Storage Domains . Click the name of an imported storage domain to open the details view. Click the Disk Import tab. Select one or more disks and click Import . Select the appropriate Disk Profile for each disk. Click OK . 13.6.9. Importing an Unregistered Disk Image from an Imported Storage Domain Import floating virtual disks from a storage domain. 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. Importing a Disk Image Click Storage Domains . Click the storage domain's name to open the details view. Click More Actions ( ), then click Scan Disks so that the Manager can identify unregistered disks. Click the Disk Import tab. Select one or more disk images and click Import . Select the appropriate Disk Profile for each disk. Click OK . 13.6.10. Importing a Virtual Disk from an OpenStack Image Service 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. Click Storage Domains . Click the OpenStack Image Service domain's name to open the details view. Click the Images tab and select an image. Click Import . Select the Data Center into which the image will be imported. From the Domain Name drop-down list, select the storage domain in which the image will be stored. Optionally, select a quota to apply to the image from the Quota drop-down list. Click OK . The disk can now be attached to a virtual machine. 13.6.11. Exporting a Virtual Disk to an OpenStack Image Service Virtual disks can be exported to an OpenStack Image Service that has been added to the Manager as an external provider. Important Virtual disks can only be exported if they do not have multiple volumes, are not thin provisioned, and do not have any snapshots. Click Storage Disks and select the disks to export. Click More Actions ( ), then click Export . From the Domain Name drop-down list, select the OpenStack Image Service to which the disks will be exported. From the Quota drop-down list, select a quota for the disks if a quota is to be applied. Click OK . 13.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. You can sparsify multiple virtual disks in parallel. Red Hat recommends performing 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. Sparsifying a Disk Click Compute Virtual Machines and shut down the required virtual machine. Click the virtual machine's name to open the details view. Click the Disks tab. Ensure that the disk's status is OK . Click More Actions ( ), then click Sparsify . Click OK . A Started to sparsify event appears in the Events tab 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.

Commands: