How to import ISO image to disk in Proxmox
28 Jul 2024 - 4 min read
Importing an ISO image to a disk in Proxmox involves several steps. This guide will walk you through the process of converting an ISO to a disk image and managing it using Proxmox tools like qm
and qemu-img
.
Table of Contents
- How to Import an ISO to Disk in Proxmox Using
qm
- Alternative: Using
qemu-nbd
to Attach an ISO Directly
How to Import an ISO to Disk in Proxmox Using qm
Step 1: Upload the ISO to Proxmox
Before importing an ISO, you need to upload it to your Proxmox server. You can use either the web interface or the command line.
Upload via Web Interface
Log in to the Proxmox Web Interface:
- Open your browser and go to
https://<your-proxmox-ip>:8006
.
- Open your browser and go to
Navigate to the Storage View:
- Click on the Datacenter in the sidebar.
- Select the Storage where you want to upload the ISO (e.g.,
local
orlocal-lvm
).
Upload ISO:
- Click on the Content tab.
- Click Upload.
- Choose ISO Image from the Content dropdown.
- Select the ISO file from your local machine and click Upload.
Upload via Command Line
Upload the ISO using
scp
:Terminal scp /path/to/your.iso root@<your-proxmox-ip>:/var/lib/vz/template/iso/Replace
/path/to/your.iso
with the path to your ISO file and<your-proxmox-ip>
with the IP address of your Proxmox server.
Step 2: Convert ISO to Disk Image
The next step involves converting the ISO to a disk image format (e.g., QCOW2 or RAW) that can be used by Proxmox.
Convert ISO to Disk Image
Use
qemu-img
to convert the ISO:Terminal qemu-img convert -O qcow2 /path/to/storage/your-iso-file.iso /path/to/storage/your-disk-image.qcow2Replace
/path/to/storage/your-iso-file.iso
with the path to your ISO file and/path/to/storage/your-disk-image.qcow2
with the path where you want to save the disk image.Notes:
qcow2
is a commonly used disk image format. You can also useraw
format:Terminal qemu-img convert -O raw /path/to/storage/your-iso-file.iso /path/to/storage/your-disk-image.raw
Step 3: Import the Disk Image into Proxmox Storage
Identify Your Storage
List available storages with:
Terminal pvesm statusImport Disk Image
Use the
qm importdisk
command to import the disk image:Terminal qm importdisk VMID /path/to/storage/your-disk-image.qcow2 STORAGE --format qcow2Replace
VMID
with a temporary or placeholder VM ID,/path/to/storage/your-disk-image.qcow2
with the path to your disk image, andSTORAGE
with the storage name.
Step 4: Attach the Imported Disk to an Existing VM (Optional)
Attach Disk Image to VM
Use
qm set
to attach the imported disk to an existing VM:Terminal qm set EXISTING_VMID --scsi0 STORAGE:vm-disk.qcow2Replace
EXISTING_VMID
with your VM ID,STORAGE
with the storage name, andvm-disk.qcow2
with the name of the imported disk.Verify the Disk is Attached
Check the VM’s configuration with:
Terminal qm config EXISTING_VMID
Alternative: Using qemu-nbd
to Attach an ISO Directly
If you need to attach an ISO directly to a disk image without creating a VM, use qemu-nbd
.
Step 1: Load nbd Kernel Module
Load the nbd
kernel module:
modprobe nbd max_part=8
Step 2: Connect ISO to nbd Device
Connect the ISO file to an nbd device:
qemu-nbd --connect=/dev/nbd0 /path/to/your-iso-file.iso
Step 3: Copy ISO Content to Disk Image
Create a new disk image and copy the ISO content:
dd if=/dev/nbd0 of=/path/to/disk-image.img bs=4M
Step 4: Disconnect the ISO
Disconnect the nbd device:
qemu-nbd --disconnect /dev/nbd0
Step 5: Import the Disk Image
Import the disk image into Proxmox:
qm importdisk VMID /path/to/disk-image.img STORAGE
Summary
- Convert ISO to Disk Image: Use
qemu-img
for conversion. - Import Disk Image: Use
qm importdisk
for importing. - Attach Disk Image: Use
qm set
to attach the disk to a VM. - Alternative: Use
qemu-nbd
for direct ISO attachment.
This guide provides steps to convert and manage ISO files within Proxmox effectively.