How to Add HDD Passthrough to a Proxmox VM
Adding physical disk passthrough to a Proxmox VM can significantly improve performance by granting direct access to the disk, bypassing virtual layers. Here, we’ll walk through setting up a hard disk (HDD) passthrough, gathering the disk’s serial information, and configuring the passthrough with Proxmox commands.
Requirements:
- A Proxmox Virtual Environment (VE) installed and configured
- A physical disk that is not being used by the Proxmox host
Step 1: Install Hardware Information Tool (Optional)
To identify disk information, it’s helpful to install lshw
, a tool for displaying detailed hardware configurations. Use the following command:
apt install lshw
Step 2: Identify the Disk
Gather details about the disk you want to pass through using one of the following commands:
Option 1: Using lshw
Run lshw
with disk and storage classes to display only the relevant storage devices:
lshw -class disk -class storage
This command will output information about each disk, including the serial number and the device path, such as /dev/sda
or /dev/sdb
.
Option 2: Using lsblk
Another way to gather details is by listing block devices with their names, sizes, models, and serial numbers:
lsblk -o NAME,SIZE,MODEL,SERIAL
This will give you the disk ID and serial number for each attached disk, such as /dev/disk/by-id/ata-<disk_serial>
, which we’ll use in the passthrough setup.
Step 3: Add the Disk to the Proxmox VM
After identifying the disk path and serial, you can attach the disk to the VM using the qm set
command. Let’s assume:
- VM ID: 100
- Disk path:
/dev/disk/by-id/ata-xxxxxxxxx-xxxxx_xxx
- SCSI Controller: scsi5 (or any available scsi slot)
Use the following command:
qm set 100 -scsi5 /dev/disk/by-id/ata-xxxxxxxxx-xxxxx_xxx
This command attaches the specified disk directly to VM 100 under the scsi5
controller.
Note: This command handles the disk size automatically, so there’s no need to specify the disk size explicitly here.
Step 4: Add Serial Number to the VM Configuration
For better disk identification inside the VM, manually edit the VM configuration file to include the disk’s serial number. Here’s how:
- Open the VM configuration file in a text editor:bashCopy code
nano /etc/pve/qemu-server/100.conf
- Locate the disk entry you just added (e.g.,
scsi5
). - Add a
serial
parameter, using the disk’s serial number:plaintextCopy codescsi5: /dev/disk/by-id/ata-xxxxxxxxx-xxxxx_xxx,serial=xxxxxxxxx
- Save and close the file.
Further Reading
For more on disk passthrough setups and configurations, you can refer to this guide on Proxmox passthrough.
Conclusion
Using HDD passthrough in Proxmox offers improved performance for storage-heavy applications. By directly linking physical disks to VMs, you ensure that the VM has full access to the disk, making this setup ideal for database servers or data-intensive applications.
Leave a Reply