Return to Level1Techs.com

How to use seperate hdd as vfio+kvm+qemu vm disk

 I need help understanding a few things about VM setup using vfio+kvm+qemu. I have had a working pci passthrough setup before but i was using qemu's image files on my host boot ssd and this time around i wanted to use a dedicated whole hdd for the vm.
 Here are my questions. What format should the drive be? I know how to use fdisk and mkfs to format drives. Do i need to mount the drive? Can i use virtual-manager to make the vm with its own drive or do i have to use virsh commands?
 I'm on arch linux and have all the passthrough stuff set up. I am going to use the virtio windows drivers and want the best performance for hdd.

Welcome to the forums!

So vfio, you want to pass an entire NVMe / pci-e drive through to a guest? or do you mean virtio, the high performance IO routines available to KVM?

If you’re going to do pci passthrough for an nvme drive, you don’t want to do anything to it from the host. In fact, you want it blacklisted, and bound to the vfio stub so the host can’t even see it.

If you’re going for virtio, there’s little benefit to passing a raw disk over using a virtual drive like qcow2. You won’t see a dramatic speed increase.

Ok so my setup is this: ssd for linux host and a 2tb hdd for virtual machine. I want to install windows in the virtual machine on the hdd. I know that i want to use the windows virtio drivers on the windows install to decrease performance overhead and i want to use the entire 2tb hdd in the vm. I read that raw format is faster and also wondered what i would have to do to do this: “If you want to minimize IO overhead, go into “Add Hardware” and add a Controller for SCSI drives of the “VirtIO SCSI” model. You can then change the default IDE disk for a SCSI disk, which will bind to said controller.”

*Edit yes i mean virtio performance io routines

This site appears to explain the process:

On the last image, where it says “BUS TYPE”, set that to virtio

You also want to add a CDROM device… Attach the virtio driver ISO file, so you can load the drivers during Windows installation. Without this step, Windows will not find the hdd.

Alright, I think i have a direction to go now. I just was wondering what I should format the hdd that windows will be installed on. ext4 or ntfs or what.

Don’t format the disk at all, let the Windows installer handle that. I’m not familiar with Arch, but if it has an automatic mounting feature, make sure to exclude the drive you are using with the Windows VM, so the host OS doesn’t try to grab the disk.

Thats great man! I actually just booted into windows right now. I have the Hdd set up with virtio drivers and am going to add my passthrough gpu in a minute. its working perfectly thanks to your help. Yes the Os did the formatting and that article you gave me was the key to use with virt-manager. thanks again and how can i make this as solved and give you credit?

1 Like

No probs, glad to help. I think you can flag a post as a solution using the little “…” menu, not sure TBH.