Attaching ISO images to virtual machines

You can attach ISO images to running or stopped virtual machines, for example, to install additional software inside them or to restore their operating system in the rescue mode. To attach an ISO image, you need to convert it to a volume, and then attach this volume to a VM.

When you finish installing software from an ISO volume, you can detach it without stopping the VM first.

To create a volume from an ISO image

Admin panel

  1. On the Compute > Virtual machines > Images tab, click the required ISO image.
  2. On the image right pane, click Create volume.
  3. In the Create volume from image window, specify a name for the volume, and then click Create.

Command-line interface

Use the following command:

vinfra service compute volume create [--description <description>] [--image <image>]
                                     --storage-policy <storage_policy> --size <size-gb> <volume-name>
--description <description>
Volume description
--image <image>
Source compute image ID or name
--storage-policy <storage_policy>
Storage policy ID or name
--size <size-gb>
Volume size, in gigabytes
<volume-name>
Volume name

For example, to create a volume called guest-tools-lin with the size of 1 GB and the default storage policy from the guest-tools-lin-iso image, run:

# vinfra service compute volume create guest-tools-lin --image guest-tools-lin-iso \
--storage-policy default --size 1

The new volume will appear in the vinfra service compute volume list output:

#  vinfra service compute volume list | grep guest-tools
| 132908e4-3543-419f-a4bf-c219f74e2640 | guest-tools-lin | 1    | available | node003.vstorage<…> |

To attach an ISO volume to a virtual machine

Admin panel

  1. On the Compute > Virtual machines > Virtual machines tab, click the required VM.
  2. On the Overview tab, click the pencil icon in the Volumes field.
  3. In the Volumes window, click Attach.
  4. In the Attach volume window, select the created volume, and then click Attach. The attached volume will be marked as ISO.
  5. In the Volumes window, click Done to save your changes.

The attached volume will appear inside the VM operating system.

Command-line interface

Use the following command:

vinfra service compute server volume attach --server <server> <volume>
--server <server>
Virtual machine ID or name
<volume>
Volume ID or name

For example, to attach the guest-tools-lin volume to the centos7 VM, run:

# vinfra service compute server volume attach guest-tools-lin --server centos7
+--------+--------------------------------------+
| Field  | Value                                |
+--------+--------------------------------------+
| device | /dev/sda                             |
| id     | 132908e4-3543-419f-a4bf-c219f74e2640 |
+--------+--------------------------------------+

The attached volume will appear in the vinfra service compute server volume list output:

# vinfra service compute server volume list --server centos7
+--------------------------------------+----------+
| id                                   | device   |
+--------------------------------------+----------+
| 1dc6750e-22ee-4fa5-8718-7cbcb7553c59 | /dev/vda |
| 132908e4-3543-419f-a4bf-c219f74e2640 | /dev/sda |
+--------------------------------------+----------+

To detach an ISO volume from a virtual machine

Admin panel

  1. On the Compute > Virtual machines > Virtual machines screen, click the required VM.
  2. On the Overview tab, click the pencil icon in the Volumes field.
  3. In the Volumes window, click the ellipsis icon next to the ISO volume, and then click Force detach.
  4. Click Done to save your changes.

Command-line interface

Use the following command:

vinfra service compute server volume detach --server <server> <volume>
--server <server>
Virtual machine ID or name
<volume>
Volume ID or name

For example, to dettach the guest-tools-lin volume from the centos7 VM, run:

# vinfra service compute server volume detach guest-tools-lin --server centos7
Operation successful.