Xenserver Hard Drive / Whole Disk Passthrough with XCP-NG

Log into the XCP-NG host and use lsblk to find disks available

On the XCP-NG host create a directory under /srv/ where you will be linking the drives

mkdir /srv/pass_drives

Create symbolic links to the drives within the created directory, this example uses sda and sdb. Be careful not to use a drive in use either XCP-NG or any other local storage setup.

ln -s /dev/sda /srv/pass_drives/sda
ln -s /dev/sdb /srv/pass_drives/sdb

Create the storage repository

xe sr-create name-label=Pass_Drives type=udev content-type=disk device-config:location=/srv/pass_drives

The drives should show up inside of XenOrchestra, if not choose “Rescan All Disks” option at the top of the storage page for the new SR.

3 Likes

How would I do this with an optical drive? Tried with the same procedure but having some trouble. Thanks!

The best way to load ISO files is not through the optical drive but via adding an ISO SR ( ISO image storage repository)

Absolutely, I agree. However, I am beginning to rip my movie collect for Plex and it would be nice to use a VM on a more powerful server rather than my laptop. So I am trying to pass through DVDs to be ripped by software on a VM. Is this something that’s even possible? Appreciate your help Tom!

I am sure it’s possible, but I have never tested it.

Most hypervisors support hardware pass-through such as a DVD natively. I usually console to a VM and from their I can mount a host DVD drive to a VM. If that is not an option, PCI pass-through might be your answer. https://github.com/xcp-ng/xcp/wiki/PCI-Passtrough

Is there any way to use /dev/disk/by-id instead of /dev/sdX? /dev/sd can change the disks and then it won’t pass through the right disk. When I tried this, it just gave me an error in xen-orchestra that it’s not not the right bus type, even though it’s the same as /dev/sdX. Does XCP-NG not follow links?

Thanks, FredFerrell! This is what I needed to do. However, I had to purchase a separate SATA PCI card, connect the Blu-ray drive to that card and pass that PCI slot through to the VM. It worked perfectly. Thanks again!

2 Likes