Search for a command to run...
Passing a physical disk directly to a virtual machine in Proxmox can improve performance and simplify storage management. This guide explains how to locate the disk, assign it to a VM, and detach it if needed.
Run this command in the Proxmox shell to list disks by ID:
find /dev/disk/by-id/ -type l | xargs -I{} ls -l {} | grep -v -E '[0-9]$' | sort -k11 | cut -d' ' -f9,10,11,12
Locate the path corresponding to your disk (e.g., /dev/disk/by-id/ata-WDC...
).
Use the qm
command to attach the disk:
qm set <vmid> -<disk-type><number> /dev/disk/by-id/<disk-serial>
Replace <vmid>
with your VM ID (e.g., 100).
Use scsi
or virtio
depending on the guest OS.
scsi
is recommended for Linux and Windows.virtio
may be better for macOS guests.Example:
qm set 100 -scsi1 /dev/disk/by-id/ata-WDC...
To detach the disk from the VM, use:
qm unlink <vmid> --idlist <disk-type><number>
Example:
qm unlink 100 --idlist scsi1
This will unlink the passthrough disk without affecting the VM configuration.
Using a physical disk passthrough in Proxmox allows your VM to access storage with near-native performance. This is useful for dedicated drives, testing, or improving I/O. You can attach and remove disks easily using the qm
CLI and Proxmox UI.
Stay in the loop with my latest projects and insights! Follow me on Twitter to catch all the updates as they happen. Don't miss out on the journey – let's connect and explore the world of tech together. Click to follow now!