Red Hat Training

A Red Hat training course is available for Red Hat Virtualization

5.3. Virtual Disks

5.3.1. Adding a New Virtual Disk

You can add multiple virtual disks to a virtual machine.

Image is the default type of disk. You can also add a Direct LUN disk or a Cinder (OpenStack Volume) 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 Adding an OpenStack Volume (Cinder) Instance for Storage Management for more information. Existing disks are either floating disks or shareable disks attached to virtual machines.

Adding Disks to Virtual Machines

  1. Click ComputeVirtual Machines.
  2. Click a virtual machine name to go to the details view.
  3. Click the Disks tab.
  4. Click New.
  5. Use the appropriate radio buttons to switch between Image, Direct LUN, or Cinder.
  6. Enter a Size(GB), Alias, and Description for the new disk.
  7. Use the drop-down lists and check boxes to configure the disk. See Section A.4, “Explanation of Settings in the New Virtual Disk and Edit Virtual Disk Windows” for more details on the fields for all disk types.
  8. Click OK.

The new disk appears in the details view after a short time.

5.3.2. Attaching an Existing Disk to a Virtual Machine

Floating disks are disks that are not associated with any virtual machine.

Floating disks can minimize the amount of time required to set up virtual machines. Designating a floating disk as storage for a virtual machine makes it unnecessary to wait for disk preallocation at the time of a virtual machine’s creation.

Floating disks can be attached to a single virtual machine, or to multiple virtual machines if the disk is shareable. Each virtual machine that uses the shared disk can use a different disk interface type.

Once a floating disk is attached to a virtual machine, the virtual machine can access it.

Attaching Virtual Disks to Virtual Machines

  1. Click ComputeVirtual Machines.
  2. Click a virtual machine name to go to the details view.
  3. Click the Disks tab.
  4. Click Attach.
  5. Select one or more virtual disks from the list of available disks and select the required interface from the Interface drop-down.
  6. Click OK.
Note

No Quota resources are consumed by attaching virtual disks to, or detaching virtual disks from, virtual machines.

5.3.3. Extending the Available Size of a Virtual Disk

You can extend the available size of a virtual disk while the virtual disk is attached to a virtual machine. Resizing a virtual disk does not resize the underlying partitions or file systems on that virtual disk. Use the fdisk utility to resize the partitions and file systems as required. See How to Resize a Partition using fdisk for more information.

Extending the Available Size of Virtual Disks

  1. Click ComputeVirtual Machines.
  2. Click a virtual machine name to go to the details view.
  3. Click the Disks tab and select the disk to edit.
  4. Click Edit.
  5. Enter a value in the Extend size by(GB) field.
  6. Click OK.

The target disk’s status becomes locked for a short time, during which the drive is resized. When the resizing of the drive is complete, the status of the drive becomes OK.

5.3.4. Hot Plugging a Virtual Disk

You can hot plug virtual disks. Hot plugging means enabling or disabling devices while a virtual machine is running.

Note

The guest operating system must support hot plugging virtual disks.

Hot Plugging Virtual Disks

  1. Click ComputeVirtual Machines.
  2. Click a virtual machine name to go to the details view.
  3. Click the Disks tab and select the virtual disk to hot plug.
  4. Click More ActionsActivate to enable the disk, or click More ActionsDeactivate to disable the disk.
  5. Click OK.

5.3.5. Removing a Virtual Disk from a Virtual Machine

Removing Virtual Disks From Virtual Machines

  1. Click ComputeVirtual Machines.
  2. Click a virtual machine name to go to the details view.
  3. Click the Disks tab and select the virtual disk to remove.
  4. Click More ActionsDeactivate.
  5. Click OK.
  6. Click Remove.
  7. Optionally, select the Remove Permanently check box to completely remove the virtual disk from the environment. If you do not select this option - for example, because the disk is a shared disk - the virtual disk will remain in StorageDisks.
  8. Click OK.

If the disk was created as block storage, for example iSCSI, and the Wipe After Delete check box was selected when creating the disk, you can view the log file on the host to confirm that the data has been wiped after permanently removing the disk. See Settings to Wipe Virtual Disks After Deletion in the Administration Guide.

If the disk was created as block storage, for example iSCSI, and the Discard After Delete check box was selected on the storage domain before the disk was removed, a blkdiscard command is called on the logical volume when it is removed and the underlying storage is notified that the blocks are free. See Setting Discard After Delete for a Storage Domain in the Administration Guide. A blkdiscard is also called on the logical volume when a virtual disk is removed if the virtual disk is attached to at least one virtual machine with the Enable Discard check box selected.

5.3.6. Importing a Disk Image from an Imported Storage Domain

You can import floating virtual disks from an imported storage domain.

This procedure requires access to the Administration Portal.

Note

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

Importing a Disk Image

  1. Click StorageDomains.
  2. Click an imported storage domain to go to the details view.
  3. 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.

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

You can 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.

This procedure requires access to the Administration Portal.

Note

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

Importing a Disk Image

  1. Click StorageDomains.
  2. Click More ActionsScan Disks so that the Manager can identify unregistered disks.
  3. Select an unregistered disk name and 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.