Rich Mingin (PLUG) via plug on 23 Nov 2022 19:18:42 -0800 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: [PLUG] Switching VM drive from SATA to virtio |
On Wed, Nov 23, 2022 at 10:06 PM Walt Mankowski via plug <plug@lists.phillylinux.org> wrote: > > On Tue, Nov 22, 2022 at 09:41:20PM -0500, Walt Mankowski via plug wrote: > > On Tue, Nov 22, 2022 at 09:20:38PM -0500, Rich Mingin (PLUG) via plug wrote: > > > On Tue, Nov 22, 2022 at 9:15 PM Walt Mankowski via plug > > > <plug@lists.phillylinux.org> wrote: > > > > > > > > Hi all, > > > > > > > > I've got a Win10 VM running under virt-manager/qemu on Ubuntu 22.10. I > > > > set it up during lockdown, and it's become my go-to way to access the > > > > work VPN when I'm working from home. > > > > > > > > It works about as well as a Win10 box can, with one exception -- it's > > > > very slow, especially when doing disk IO. This wasn't a huge problem > > > > when I was running it every day, but now that I'm only firing it up > > > > occasionally, there's a system update nearly every time, and they can > > > > take hours to install. It's gotten to the point where if I know I need > > > > to work from home, I'll start it up the prior evening so that it will > > > > be usable in the morning. > > > > > > > > I've got the VM booting off a 250 GB partition. (This is part of what > > > > I'm using my 3 TB RAID1 array for from my previous questions.) After > > > > doing some google searches, I think maybe a big reason for the > > > > slowness is that the drive is set as SATA, but performance would be a > > > > lot better if it were virtio. > > > > > > > > Does anyone know if it's possible to switch the drive from SATA to > > > > virtio without having to rebuild everything? I've found some links > > > > that suggest it is, but if so, the process seems fairly complicated. > > > > If anyone could point me towards some instructions that they trust, > > > > I'd appreciate it. > > > > > > > > > > You can. It's not even particularly complicated. Create a new disk, > > > size doesn't matter. 16GB or whatever. Attach it to the VM via virtio. > > > Once that's done, boot the VM, install the virtio drivers via > > > https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso > > > > > > Once Windows has the virtio drivers loaded, reboot once or twice to > > > make sure it's solid, then change the main virtual disk's type to > > > virtio. It should boot fine. After another reboot or two to be sure > > > Windows is settled and happy, remove the temporary virtio disk. Done. > > > > OK, that doesn't sound too bad. I'll give it a try over the long > > weekend. > > I've done most of what you suggested. I attached a 16 GB disk image > via virtio. I installed the virtio drivers in windows from that > ISO. I've rebooted a few times and everything seems stable. > > But I can't figure out how to switch the main virtual disk's type from > SATA to virtio. In the GUI it's listed as "SATA Disk 1" but there's no > obvious way to change it. > > The config files all live under /etc/libvert. I found a file named > /etc/libvirt/qemu/win10.xml which contained the config for the > drive. Following the example for my 16GB drive, I made this change: > > --- win10.xml.save 2022-11-23 21:06:50.092083902 -0500 > +++ win10.xml 2022-11-23 21:35:53.740685051 -0500 > @@ -49,7 +49,7 @@ > <disk type='file' device='disk'> > <driver name='qemu' type='qcow2'/> > <source file='/storage/libvert_pool/win10.qcow2'/> > - <target dev='sda' bus='sata'/> > + <target dev='vda' bus='virtio'/> > <address type='drive' controller='0' bus='0' target='0' unit='0'/> > </disk> > <disk type='file' device='cdrom'> > > But it's still showing as SATA Drive 1 in the GUI. I've tried > rebooting a few times. It might be a tad faster, but maybe that's just > because I've rebooted so many times that everything is cached. > > The only other thing I can think to do is to remove SATA Drive 1, then > try to re-add it using virtio. It seemed wise to ask here first before > I try that. > > One other odd thing -- I was expecting to see the 16 GB image as a > letter drive in Windows, but it's not appearing there. > > Walt > ___________________________________________________________________________ > Philadelphia Linux Users Group -- http://www.phillylinux.org > Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce > General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug It *should* work with just that XML edit. You can remove and readd it, just be careful that removing it doesn't remove the backing file. If that ends up being the issue, I'd blame your virt manager. You might also need your edit plus removing the address line. That's a SATA/SCSI specific line that might be confusing things. Here's an example of a working XML stanza: <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/home/forge/vfio/win10/nvidia-win10.qcow2'/> <target dev='vda' bus='virtio'/> </disk> On the off chance that you get the famous INACCESSIBLE BOOT DEVICE blue screen after the swap, it's not hard to fix. Lots of good solutions here: https://superuser.com/questions/1057959/windows-10-in-kvm-change-boot-disk-to-virtio To summarize the fix; Switch back to SATA, boot, run an elevated command prompt, enter [bcdedit /set "{current}" safeboot minimal]. Shut down. Swap back to virtio. Boot. It should work normally. After seeing it's up and running, run another elevated cmd, and enter [bcdedit /deletevalue "{current}" safeboot] - This will exit safe boot on next restart and things should be good. tl;dr of why: Windows 10+ does some really dumb things in the name of working around self-inflicted performance problems. Specifically, the OS only loads the ultra-minimal needed drivers until it's closer to the desktop. If it has been SATA before, and is NVME now, or virtio now, it may refuse to load any drivers it didn't need before, causing the BSOD. I like to imagine some cubicle drone loudly and shrilly whining "But I never had to do this step before!" when I have this breakage. ___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug