Return to Level1Techs.com

Need help dual booting a physical disk virt-manager VM

kvm
virtualization
qemu

#1

I set up a physical disk VM this way in the past: Can't setup Physical Disk storage pool through virt-manager

The bare metal performance sucks and I can’t play most higher end games without lots of stuttering and FPS drops. Games a 390x should be able to handle no problem.

I’ve tried booting the hard disk and every other boot option but most booted to linux and the others failed to boot windows.

Booting the hard disk entry resulted in a black screen with a blinking white cursor. Sometimes (but not always) a “Windows Boot Manager… (hard disk not found)” entry shows up which fails to boot and puts be back at the boot device selection screen.

The VM boots on its own with a proper boot loader no problem from linux so what’s going on here? Is there any way to get this to dual boot on bare metal?


#2

Based on your other thread I don’t think the disk is partitioned in the way it normally would be, looked to me like you ended up passing through a partition instead of the whole disk. Please provide fdisk -l output for the disk in question.

P.S. Would recommend passing through your entire SATA controller if that’s possible, that way everything works and operates like normal in a dual boot scenario because it will use the same driver for the controller instead of using like a VirtIO SCSI driver for VM and actual controller on bare metal. I used to pass through my entire disk but when trying to boot on bare metal sometimes it had to set up some things on boot or it wouldn’t boot at all but last I checked it boots on bare metal just fine since I pass the whole controller. Windows creates a hell of a lot of partitions… The 2.4GB partition I created though.

Disk /dev/sda: 477 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: ADATA SX900     
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 68B86E5F-070E-453A-BC50-B8D3E343B8CF

Device         Start        End   Sectors   Size Type
/dev/sda1       2048     923647    921600   450M Windows recovery environment
/dev/sda2     923648    1128447    204800   100M EFI System
/dev/sda3    1128448    1161215     32768    16M Microsoft reserved
/dev/sda4    1161216  991636081 990474866 472.3G Microsoft basic data
/dev/sda5  991637504  993349631   1712128   836M Windows recovery environment
/dev/sda6  993351680  998457343   5105664   2.4G Microsoft basic data
/dev/sda7  998457344 1000214527   1757184   858M Windows recovery environment

I found an old XML, looks like this is how I set up the passthrough back when I used to pass the whole disk.

    <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='threads'/>
      <source dev='/dev/disk/by-id/ata-Samsung_SSD_840_EVO_250GB_S1DBNSCF116014V'/>
      <target dev='sda' bus='scsi'/>
      <boot order='1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>

#3
:~$ sudo fdisk -l
Disk /dev/sda: 223.6 GiB, 240057409536 bytes, 468862128 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos              <---------
Disk identifier: 0x2fb0da7b

Device     Boot Start       End   Sectors  Size Id Type
/dev/sda1          63 467668214 467668152  223G 83 Linux    <---------


Disk /dev/sdb: 223.6 GiB, 240057409536 bytes, 468862128 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 3FCF3A12-6252-4558-99C0-EAD5C3AEE5FF

Device         Start       End   Sectors   Size Type
/dev/sdb1       2048   1050623   1048576   512M EFI System
/dev/sdb2    1050624 452083711 451033088 215.1G Linux filesystem
/dev/sdb3  452083712 468860927  16777216     8G Linux swap

That confirms it alright… Do I need to reinstall in that case?

Not sure if I can pass the whole controller through but the linux host system is on a m.2 so maybe it’s isolated. Any pointers on how to do that? I basically just touch the GUI one time to set it up so my memory is pretty fuzzy.

That’s odd regarding your windows partitions though… My installs only every create these 3:

/dev/sda1       2048     923647    921600   450M Windows recovery environment
/dev/sda2     923648    1128447    204800   100M EFI System
/dev/sda4    1161216  991636081 990474866 472.3G Microsoft basic data

#4

It would be possible to migrate the data from underneath a partition to a real disk if you have space for it somewhere else temporarily but a reinstall may be faster depending how much you had set up. Not something I’ve done but the concept makes sense to me so it should work in practice, can’t condone it either way.

Since your other drive is /dev/sdb I doubt you can pass the controller, check if they’re connected to different controllers by looking at the symlinks under /sys/block. My M.2 is NVME so it’s on a different controller than my 2.5" SSD.

lrwxrwxrwx  1 root root 0 Feb 17 12:01 nvme0n1 -> ../devices/pci0000:00/0000:00:1b.0/0000:05:00.0/nvme/nvme0/nvme0n1
lrwxrwxrwx  1 root root 0 Feb 26 01:50 sda -> ../devices/pci0000:00/0000:00:17.0/ata37/host0/target0:0:0/0:0:0:0/block/sda

+-17.0  Intel Corporation 200 Series PCH SATA controller [AHCI mode]
+-1b.0-[05]----00.0  Samsung Electronics Co Ltd NVMe SSD Controller SM961/PM961

#5

Thanks I was able to use Acronis to backup the disk image and restore it on the physical disk - working perfectly.

Performance is night & day better - wish passthrough GPU worked as well.

I may get around to re-configuring a new VM to try passthrough again but it’s pretty garbage for any demanding game.