Screwtape |
Posted on 20-09-08, 09:21
|
Full mod
Post: #416 of 443 Since: 10-30-18 Last post: 1103 days Last view: 174 days |
A while ago I needed Actual Genuine Windows for something, so I booted up VirtualBox and installed Windows 10. I picked VirtualBox because it was familiar and its GUI was more approachable than the inscrutable command-line of QEMU. It worked pretty well, but I don't have a lot of disk space free right now, and although VirtualBox lets you create a "dynamically sized" disk image, that size only ever goes *up*. You can shrink the size back down, but it requires doing a defrag, and running a command to zero unused portions of the disk, and then shutting down the VM and running a lengthy command-line process to scan for zeroed disk chunks and deallocating them. But wait! (I thought) in this modern age we have the ATA TRIM command! Surely we can trick Windows into thinking it's installed on an SSD, and then it will just send TRIM commands when it deletes data, and the VM can automatically deallocate the corresponding chunk of the disk image and everything stays neat and tidy with no additional effort! Unfortunately no; VirtualBox does have experimental support for TRIM (that you have to manually edit config files to enable) but apparently it just crashes the VM. Well, that's a blow, and honestly I'm a bit tired of VirtualBox having to recompile its kernel module every week. Isn't KVM the Linux standard VM system these days? And GNOME 3 has an adorably simplified app called Boxes that will probably (maybe) do the right thing without me having to think too hard, I should give that a go. In my first attempt, I told Boxes I wanted to pick an OS install image myself, but instead of picking an ISO I picked VirtualBox's .vdi disk image, which it happily converted to QEMU's qcow2 format and booted up. To my intense surprise, it booted first go! But of course it still had all the VirtualBox guest tools installed, not the QEMU/KVM ones, so it didn't adjust its desktop resolution or have clipboard integration or auto-release the mouse cursor when I moved it outside the VM window, which was annoying. I uninstalled the guest tools, rebooted, and... Windows blue-screened. Every time. Oops. Luckily, my second attempt worked. Here's what I did: - In GNOME Boxes, I imported the VirtualBox disk image, creating a new QCOW2 disk image, which I could then boot successfully - I downloaded the SPICE Guest Tools installer and... installed it, which added all the QEMU/KVM compatible drivers, and when I rebooted desktop-resizing and mouse-auto-release worked - I uninstalled the VirtualBox guest tools and rebooted again, and this time Windows did *not* bluescreen - To get file-sharing working between host and guest, I installed spice-webdavd into the VM as directed. That caused a "shared folders" UI to appear in GNOME Boxes, but didn't actually result in a network drive appearing in Windows. I poked around and discovered "C:\Program Files\SPICE webdavd\map-drive.bat", which mapped the network drive and it's still there on subsequent reboots happily enough. - Unfortunately, Windows 10 did not report its disk image as an SSD, so I didn't know if it would trim. Running "debug /L c:" claimed to be retrimming the drive, which was an improvement over VirtualBox (which just said "TRIM not supported" or similar), but I wasn't sure what that actually did - Luckily, GNOME Boxes is not *just* a simplified front-end for QEMU/KVM, it's actually a simplified front-end for RedHat's libvirt virtual machine management software. So I installed the full virt-manager package, booted it up, and not only did I get a *lot* more GUI options to tinker with, I also got a nice syntax-highlighted view of the underlying XML configuration I could edit. - Specifically for the TRIM use-case, I went to the virt-manager configuration for "IDE Disk 1", opened "Advanced options" and "Performance options", and I changed "Discard mode" from "Hypervisor default" to "unmap", just to be sure. I did find some reports that TRIM only really worked if you used the "virtio" or "virtio-scsi" disk controllers, instead of emulated-IDE or emulated-SATA, but either of those options just made Windows blue-screen at boot again, even with the fancy virtio drivers installed, so I went with the thing that worked. I also found a ServerFault answer that suggested Windows 10 should automatically recognise QCOW2 disk images as thin-provisioned disks and treat them as SSDs with TRIM, but that didn't happen for me. virt-manager also has an "Operating System" setting that's set to "Generic Default". It can be set to "Windows 10" but it's not entirely clear what that would do, and I haven't tried it. The ending of the words is ALMSIVI. |
tomman |
Posted on 20-09-08, 14:29 (revision 1)
|
Dinosaur
Post: #769 of 1317 Since: 10-30-18 Last post: 1 day Last view: 5 hours |
I see myself migrating away from VirtualBox in my not-so-distant future, if this ridiculous Debian-Orrible licensing/bugfixing spat continues. It's the time to seriously research into libvirt and friends. I'm no friend of GNOME software, but on virtualization you're expected to get your hands dirty with CLI anyways. BTW: is your W10 VM Genuine Microsoft Software™? Preserving activation on my XP VM from VPC/VMWare to VBox was anything but straightforward - to this date it still involves the use of hacked VBox BIOS dumps, for which Orrible folks don't even want to talk about (in comparison, VPC->VMWare is straight forward as long as you obey the MS licensing restrictions). But then that's a very special case - the usual is having to call MS and get it done. Did you had to reactivate your license or whatever? Licensed Pirate® since 2006, 100% Buttcoin™-free, enemy of All Things JavaScript™ |
Screwtape |
Posted on 20-09-08, 22:00
|
Full mod
Post: #417 of 443 Since: 10-30-18 Last post: 1103 days Last view: 174 days |
Yes, I had to reactivate. I'm not sure if it's normal, but Windows didn't say "we're not sure if your licence is still valid", it claimed it had no licence. So I typed in the same licence code I'd used previously (A Win8.1 key from the ACPI tables of my laptop) and it was perfectly happy. I wonder if anybody's experimented with automatically exporting that ACPI table to from the host to the VM... Yeah, I'm sure I could whack together a QEMU command-line that would do the same thing (and in fact, when the VM is running, I can just copy that command-line from `/proc/whatever/cmdline`) but for something as wild and complex as modern PC architecture, I do appreciate the hand-holdiness of a GUI. If you'd rather not use libvirt, there's other QEMU front-ends. But libvirt is RedHat's alternative to enterprisey systems like VMware Server - it wraps Xen as well as QEMU, it can serve VMs over a network, automatically start VMs at boot time, etc. It's probably overkill for my "just run Win10 locally" needs, but I figure I have a better chance of migrating from libvirt to something else in the future than from some custom thing I whipped together. The ending of the words is ALMSIVI. |