Importing private ISO for booting

Importing private ISO for booting

This a proof of concept for importing private ISOs to boot from. It is not intended for general usage, it involves steps that are not publicly available full features yet and as such are not available in the UI.

Use case

User wants to install VM from an ISO “cd-rom” that contains private data. They want to upload the ISO to their personal space and then create a new VM and boot it from that ISO to install and set up an operating system.

Example

Booting an ISO that is not provided by the platform like netboot.xyz.

Steps to import and install

The process involves working with two VMs: one for making the bootable disk from, and one “empty” VM for booting and proceeding with the installation capable ISO

Create or use existing VM for importing ISO

Have a VM on the platform. We are going to use a linux type OS here.
Import the ISO file into your VM, for example using scp or by some other means. Let’s assume the ISO is now in the VM at /home/user/netboot.xyz.iso.

Take note of the VM UUID, you’ll need it to call the API.

Create a disk that will become the ISO

Create an additional disk for the VM. Make sure it is big enough to fit the ISO.

image-20250926-083259.png

Take a note of the UUID of this new disk, we’ll need this to call the API.

image-20250926-083410.png

Write ISO to disk

Switch to root user to have low level access to disks.

Check the disks inside the VM with lsblk, you’ll probably see something like this:

[root@iso-import ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS zram0 251:0 0 1.9G 0 disk [SWAP] vda 253:0 0 30G 0 disk ├─vda1 253:1 0 2M 0 part ├─vda2 253:2 0 100M 0 part /boot/efi ├─vda3 253:3 0 1000M 0 part /boot └─vda4 253:4 0 28.9G 0 part /var /home / vdb 253:16 0 20G 0 disk

Looks like the new disk is called vdb. You can now write the ISO data to the disk with dd. Input file if is in our example case /home/user/netboot.xyz.iso, output of is the second disk at /dev/vdb. Block size bs of 10 MB is a reasonable choice, but you can experiment with other numbers. It is always useful to have status=progress, especially with bigger ISO files.

This is the full command to write ISO to the second disk:

dd if=/home/user/netboot.xyz.iso of=/dev/vdb bs=10M status=progress

To really make sure that the data has reached the disk, it is advisable to synchronise cached writes before continuing.

sync

Or, better yet, just shut down the OS gracefully.

Detach disk

Use the Detach API call, the endpoint is.

Here’s the full API call with cURL:

curl -X POST 'https://{{API_HOST}}/v1/{{LOCATION_SLUG}}/user-resource/vm/storage/detach' \ --header 'apikey: {{APIKEY}}' \ --data-urlencode 'storage_uuid={{DISK_UUID}}' \ --data-urlencode 'uuid={{VM_UUID}}'

Replace {{DISK_UUID}} and {{VM_UUID}} with the values obtained earlier. Other placeholder values are explained in the regular user API documentation.

Change disk to ISO type

Let’s now change the disk to a bootable ISO. Also, it is advisable to give it a nice name.

curl -X PATCH 'https://{{API_HOST}}/v1/{{LOCATION_SLUG}}/storage/disks/{{DISK_UUID}}' \ --header 'apikey: {{APIKEY}}' \ --data-urlencode 'display_name=My own netboot.xyz' \ --data-urlencode 'read_only_bootable=true'

Create a clean target VM

Now create an empty VM that will be booted from the ISO. This is the VM that will have the OS installed from the ISO.

image-20250926-085957.png

Make sure it has enough resources to accommodate the installed OS and services.

Boot to private ISO

Now open the detail view of the new VM and click on ISO boot. You may need to refresh the page if it does not show your private ISO right away.

image-20250926-090318.png

Select your ISO and press Start. Once booted, open the Terminal to start the actual installation.

image-20250926-090418.png

Stop and Start VM

After installation is complete, it is necessary to Stop the VM from the platform UI or API to “release” ISO. Stopping will disconnect the virtual ISO disk, otherwise it will remain as the boot device for this VM.

image-20250926-091218.png

Delete ISO

If you don’t need the ISO anymore, you should delete it so it does not take up space. At some point, you could be charged for the ISO by standard block storage price.

curl -X DELETE 'https://{{API_HOST}}/v1/{{LOCATION_SLUG}}/storage/disks/{{DISK_UUID}}' \ --header 'apikey: {{APIKEY}}'