Disk passthrough in Proxmox

Recently, I’ve added a few gigs of RAM to my main homeserver, so I figured I could transform it into a VM hypervisor, P2V the original config and then have some room to play with other stuff.

I chose to go with Proxmox, as it’s Debian-based, and I had trouble with both Hyper-V and ESXi (installation from/to USB, network drivers, etc.)

Because I use Puppet to manage all my configuration, I didn’t do anything particular to backup the original configuration, except saving some dotfiles.

The first difficulty I encountered was uploading ISOs through the web interface, it would always timeout after about 400MB transferred so I just sent them through SFTP.

Since I have multiple disks in the server which are used for Samba, I wanted to pass them through to the new VMs, but couldn’t find a way to do so through the web interface. After looking around for a bit, I found two solutions which work together.

The first step is to identify the disk you want to pass through. For this, there are multiple methods:

fdisk -l
ls -l /dev/disk/by-label
ls -l /dev/disk/by-uuid
ls -l /dev/disk/by-id

Note that using /dev/sdX is not a great option since the letter attribution can change, whereas a disk’s uuid will not.

Then, you’ll want to copy whatever label/uuid/id that is relevant, and to allow passthrough there are now two options:

1. Through the Proxmox console

qm set {vmid} -{ide|sata|scsi}# /dev/disk/by-{label|uuid|id}/{reference}

with vmid the ID of your VM, ide or sata the type of disk you want to add.

Note that ide value can be 0-3, sata can be 0-5 and scsi 0-13. Also, ide0 is generally the boot disk and ide2 will be the CD drive; Adjust depending on your configuration.

example:

qm set 101 -sata0 /dev/disk/by-label/data01

This will modify the {vmid}.conf file, which bring us to option 2.

2. By directly modifying the {vmid}. conf file in /etc/pve/qemu-server/

Add a line as follows:

{ide|sata|scsi}#: /dev/disk/by-{label|uuid|id}/{reference}

example:

sata0: /dev/disk/by-label/data01

 

You’ll want to shutdown then boot the VM (not just a regular restart) for the changes to take effect, after which the disk should be accessible in your VM.

This entry was posted in Linux and tagged , , , , , , . Bookmark the permalink.

One Response to Disk passthrough in Proxmox

  1. Pingback: VFIO, Because I Got Tired of Rebooting my Server – Potatoblog

Leave a Reply

Your email address will not be published. Required fields are marked *