10.6. Virtual Disk Tasks
10.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 11.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 10.6.2, “Explanation of Settings in the New Virtual Disk Window”.
Creating a Virtual Disk Attached to a Virtual Machine
-
Click
. - 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 10.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 10.6.2, “Explanation of Settings in the New Virtual Disk Window”.
Creating a Floating Virtual Disk
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
. - 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 10.6.2, “Explanation of Settings in the New Virtual Disk Window” for more details on each option for each disk type.
- Click OK.
10.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.
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.
|
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 next 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.
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 |
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. |
Use 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 11.2.4, “Adding an OpenStack Block Storage (Cinder) Instance for Storage Management” for more information.
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. |
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).
10.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.
10.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
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.
10.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
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
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.
10.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
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.
10.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 8.8.1, “Uploading Images to a Data Storage Domain”.
10.6.8. Importing a Disk Image from an Imported Storage Domain
Import floating virtual disks from an imported storage domain.
Only QEMU-compatible disks can be imported into the Manager.
Importing a Disk Image
-
Click
. - 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.
10.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.
Only QEMU-compatible disks can be imported into the Manager.
Importing a Disk Image
-
Click
. - Click the storage domain’s name to open the details view.
-
Click
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.
10.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
. - 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.
10.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.
Virtual disks can only be exported if they do not have multiple volumes, are not thin provisioned, and do not have any snapshots.
-
Click
and select the disks to export. -
Click
. - 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.
10.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
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
. - 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.