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.


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!


is there a way to remove a certain drive from the pass-through list, a drive got degraded in freenas and i had to remove it physically so i could boot up, but freenas can’t see my hds in the right order now :frowning:

Edit: solution is to remove the link that was made in the pass-through folder

I have followed the instructions but not able to see the drives in the storage repository “Pass_Drives” in xen orchestra or xcp-nc center.
I see the drives in the console when i type “lsblk”.
I can use cfdisk and see the drives sizes there.
The simbolic links are made and checked in the console.
The storage repository “Pass_Drives” is made and visible in xen orchestra and xcp-nc center.
Also the rescan is not working.
Has somebody a clue what i am missing?

xcp-ng version 8.1
xpc-ng center version 20.40.00