Mount an ISO on a Running VM by Using an ISO Carrier Volume
Overview
The Mount ISO VM action attaches an ISO from the image library as a read-only optical drive, and it requires the VM to be powered off. When you cannot stop a VM, you can use an ISO carrier volume instead.
An ISO carrier volume is a small data volume that stores one or more ISO files on a Universal Disk Format (UDF) file system. Because the carrier is an ordinary data volume, you can attach it to a running VM and detach it again without stopping the VM. Inside the VM, the guest operating system mounts the ISO file natively: Windows presents it as a DVD drive, and Linux mounts it as a loop device. The guest sees the original ISO, including its volume label and file system.
The workflow has two parts:
Once per set of ISOs: build a carrier image on a Linux machine and add it to the image library.
Each time you need the ISO in a VM: create a volume from the carrier image, attach it to the running VM, mount the ISO in the guest, then unmount it and detach the volume.
In this guide, you will build a carrier image, create a carrier volume from it, attach the volume to a running VM, mount the ISO in a Windows or Linux guest, and detach the volume when you are done.
Prerequisites
A Linux machine running Ubuntu or Debian, with
sudoaccess and free disk space of about twice the combined size of the ISO files. Themkudffstool that formats the carrier is not packaged for Rocky Linux 10 or Red Hat Enterprise Linux 10. Any Ubuntu VM works, including a VM that runs in Private Cloud Director.The ISO files you want to provide to the VM.
Access to the Private Cloud Director UI, or
pcdctlinstalled and configured for your region.A guest operating system that can mount the ISO:
Windows: Windows Server 2012 or Windows 8, or later, for the
Mount-DiskImagecmdlet.Linux: a kernel with UDF and loop device support. Mainstream distributions include both by default.
A VM that has a free hot-plug slot for one more disk. VMs that use the q35 machine type have a limited number of hot-plug slots. See Troubleshooting.
To attach the carrier from the UI, a VM that boots from a volume. For a VM with an ephemeral root disk, use
pcdctlto attach and detach the carrier.
Why the Carrier Uses UDF
The carrier must be readable by the guest operating system without installing extra packages, and it must hold ISO files larger than 4 GB. UDF is the only file system that met both requirements on every guest that was tested:
UDF
Mounts while the disk is read-only
Mounts with no extra packages
Mounts with no extra packages
NTFS
Mounts only after you clear the disk's read-only attribute
Mounts through the preinstalled ntfs-3g package
Fails: no NTFS support in the kernel
exFAT
Mounts
Fails: no exFAT support in the cloud kernel
Mounts
Step 1: Build the Carrier Image
Run these commands on the Ubuntu or Debian machine, in the directory that contains your ISO files.
Install the tools that partition, format, and convert the carrier image.
Set the carrier name, list the ISO files to include, and calculate the carrier size. The size is the combined size of the ISO files, rounded up to a whole GiB, plus 1 GiB of headroom.
Note the size. You need it when you create the carrier volume.
Create the disk image with a single partition. The partition type
0x07makes Windows assign a drive letter to the carrier.Format the partition as UDF 2.01 with a 512-byte block size and the label
ISOCARRIER. The guest steps later in this guide find the carrier by this label.mkudffswarns that a UDF file system on a partition cannot be read on Apple systems. You can ignore this warning.Copy the ISO files onto the carrier.
Convert the image to compressed QCOW2 to reduce the upload size.
The
virtual sizein the output equals the carrier size from step 2. After you upload the image, you can delete${CARRIER}.raw.
Step 2: Add the Carrier Image to the Image Library
Set the disk format to qcow2. Do not select iso. An image with the iso disk format is attached to VMs as an optical drive, which requires the VM to be powered off.
Navigate to Virtual Machines > Images and VM Snapshots in the left-hand navigation menu.
Select Add Image.
In the Image Selection section, choose Upload Image File and select
iso-carrier.qcow2, or choose Upload Image via URL and enter the Image Download URL.Under Image Settings, enter a Name, for example
iso-carrier.Set Operating System to Other.
Confirm that Disk Format is
qcow2.Optionally, set Visibility. The default is Private.
Select Add Image. The image status changes from
queuedtoactivewhen the upload completes.
For details about uploading images through the UI, including the Image Library Service certificate, see Upload an Image Using the UI.
To add the image with pcdctl instead, authenticate pcdctl as described in Import Images, then run:
To make the carrier image available to other tenants, see Share Images Across Tenants.
Step 3: Create a Carrier Volume
Use one carrier volume per VM. To provide the same ISO files to several VMs at once, create a separate carrier volume for each VM from the carrier image.
Navigate to Storage > Volumes in the left-hand navigation menu.
Select Create New Volume.
Under Choose a Source, select Image, then select the carrier image in the image list.
Enter a Name, for example
iso-carrier-vol, and a Size in GiB that is at least the carrier size from Step 1. Choose a Volume Type.Select Create Volume and wait until the volume status is available.
To create the volume with pcdctl, replace <size-gib> with the carrier size:
Optional: Make the Carrier Volume Read-Only
A read-only carrier volume cannot be modified from inside the VM, which is useful when you reuse the same volume across VMs. Set the flag while the volume is not attached. There is no UI action for this today.
Windows and Linux guests mount the carrier and its ISO files normally when the volume is read-only. To make the volume writable again, run:
Step 4: Attach the Carrier Volume to the Running VM
You do not need to stop the VM.
Navigate to Virtual Machines > Virtual Machines in the left-hand navigation menu.
Select the VM in the VM grid view, then choose Other > Manage Volumes.
Select Attach for the carrier volume.
In the attach confirmation, leave Delete volume when VM is deleted cleared if you plan to reuse the carrier volume, then select Attach.
You can also attach the volume from the Volumes list: select the volume, choose Actions > Attach Volume, select the VM, then select Attach Volume.
To attach the volume with pcdctl:
The volume status changes to in-use within a few seconds, and the VM keeps running.
Step 5: Mount the ISO in the Guest
Run these commands in PowerShell as an administrator.
Find the carrier disk. By default, Windows Server brings a newly attached disk up offline and read-only.
Bring the carrier disk online. Replace
<disk-number>with the number from the previous command. The disk stays read-only, which does not prevent you from mounting the ISO files.Find the carrier's drive letter and list the ISO files on it.
Mount an ISO file. Replace
<file-name>with the name of the ISO file. The output shows the drive letter of the new DVD drive, with the drive typeCD-ROM.
Mount the carrier read-only by its label. The label path works regardless of the device name the disk receives in the guest.
Mount an ISO file from the carrier. Replace
<file-name>with the name of the ISO file.
Step 6: Unmount the ISO and Detach the Carrier Volume
Unmount the ISO files and release the carrier disk inside the guest before you detach the volume.
Windows: if an ISO is still mounted or a file on it is open, Windows blocks the removal. The detach fails after several retries, and the volume stays attached to the VM. To recover, close the open files, complete the steps below, and detach the volume again.
Linux: Linux does not block the removal. The detach succeeds, and any program that still reads from the ISO receives I/O errors. Unmount first to avoid interrupting running programs.
Release the carrier inside the guest.
Run these commands in PowerShell as an administrator. Replace <file-name> and <disk-number> with the values you used in Step 5.
Then detach the carrier volume from the VM. You do not need to stop the VM.
Navigate to Virtual Machines > Virtual Machines in the left-hand navigation menu.
Select the VM in the VM grid view, then choose Other > Manage Volumes.
Select Detach for the carrier volume, then select Detach in the confirmation.
To detach the volume with pcdctl:
The volume status returns to available, and the VM keeps running.
Step 7: Reuse or Delete the Carrier Volume
To reuse the carrier volume, attach it to another VM by repeating Steps 4 through 6.
When you no longer need the carrier volume, delete it:
Navigate to Storage > Volumes in the left-hand navigation menu.
Select the volume, then select the delete icon.
Select Confirm in the confirmation dialog.
To delete the volume with pcdctl:
The carrier image stays in the image library, so you can create a new carrier volume from it at any time.
Limitations
The carrier is a data disk, not an optical drive, so a VM cannot boot from the ISO files on it. To install an operating system from an ISO, create the VM with the Install from ISO option, as described in Install OS from ISO Wizard. To attach an ISO to a powered-off VM as an optical drive, use the Mount ISO action.
Use one carrier volume per VM. To use the same ISO files on several VMs at once, create a carrier volume for each VM from the same carrier image.
The carrier holds the ISO files that you copied onto it when you built it. To add or update ISO files, build and upload a new carrier image.
This guide does not remove an ISO that is already attached to a VM as an optical drive, for example with the Mount ISO action. Detaching that ISO still requires the VM to be powered off. See Virtual Machine Actions.
Troubleshooting
Attaching the volume to a VM that uses the q35 machine type fails, and the volume returns to available. The VM has no free hot-plug slot. VMs that use the q35 machine type have a limited number of hot-plug slots, and each volume that you attach to the running VM uses one. On the hypervisor host, the Compute Service log records
No more available PCI slots. Detach another volume that was attached to the running VM to free a slot, then attach the carrier volume again.The carrier disk is offline or read-only in Windows. This is the default behavior of Windows Server for newly attached disks. Bring the disk online as described in Step 5. You do not need to clear the read-only attribute.
The volume status stays in-use after you detach it from a Windows VM. Windows still uses the carrier. Unmount the ISO files, take the carrier disk offline, then detach the volume again.
Programs in a Linux VM report I/O errors after you detach the volume. The volume was detached while the ISO was still mounted. Stop the programs that use the ISO, then remove the stale mounts:
The carrier appears as an optical drive, or the UI reports "Stop the VM before attaching or detaching an ISO-based volume". The carrier image was uploaded with the
isodisk format. Upload the carrier again with theqcow2disk format, and create a new carrier volume from the new image.Manage Volumes is unavailable for the VM, or the VM is not listed when you attach the volume. The VM uses an ephemeral root disk, and the UI attaches volumes only to VMs that boot from a volume. Attach the carrier volume with
pcdctl server add volume.Adding the carrier image with Upload Image via URL fails with
Request failed with status code 400. The URL uses a port other than 80 or 443. Serve the file on port 80 or 443 from a location the Image Library Service host can reach.
Related Pages
Virtual Machine Actions: the Mount ISO and Unmount ISO actions for powered-off VMs
Upload an Image Using the UI: upload options and the Image Library Service certificate
Volume: attaching and detaching volumes, and other volume actions
Last updated
Was this helpful?
