Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
QEMU/KVM For Starters
QEMU/KVM For Starters
There are two recent tutorials for those who are interested in playing with QEMU/KVM:
https://linuxconfig.org/setting-up-virt ... ian-ubuntu
(Setting Up Virtual Machines with QEMU, KVM, and Virt-Manager on Debian)
https://linuxconfig.org/converting-virt ... deployment
(Converting VirtualBox OVA to QCOW2 for QEMU/KVM Deployment)
We have been using VirtualBox before it was acquired by Sun Microsystems and then Oracle and have been very pleased with our experience, but are also interested in getting our hands dirty on QEMU/KVM
https://linuxconfig.org/setting-up-virt ... ian-ubuntu
(Setting Up Virtual Machines with QEMU, KVM, and Virt-Manager on Debian)
https://linuxconfig.org/converting-virt ... deployment
(Converting VirtualBox OVA to QCOW2 for QEMU/KVM Deployment)
We have been using VirtualBox before it was acquired by Sun Microsystems and then Oracle and have been very pleased with our experience, but are also interested in getting our hands dirty on QEMU/KVM
Re: QEMU/KVM For Starters
You'll find Qemu/KVM machines are much faster than Virtualbox (at least since the more recent releases)
Re: QEMU/KVM For Starters
I have noticed the same speed improvement when I ran a Windows 11 VM (but Debian VMs run very smoothly in VirtualBox). However, it is very much involved to try to optimally configure Qemu/KVM (and then I totally forgot what I did). VirtualBox has a great (I mean "GREAT"!) gui and is much easier for those who don't run virtual machines on a regular basis.
Thus I am posting the above two entry-level tutorials in the hope more people will try and post questions. Probably the best way to learn and broaden its use base.
Re: QEMU/KVM For Starters
Nowadays, most laptops come with at least 16GB of DDR. Even our new machines, an inexpensive (<$300) but very powerful mini-PC, come with 16GB RAM:
viewtopic.php?t=157844&start=2
Now is really a great time to start building experiences regarding virtual machines.
viewtopic.php?t=157844&start=2
Now is really a great time to start building experiences regarding virtual machines.
-
- Global Moderator
- Posts: 2719
- Joined: 2018-06-20 15:16
- Location: Colorado
- Has thanked: 41 times
- Been thanked: 201 times
Re: QEMU/KVM For Starters
This maxim needs to be upgraded--at least as far as VM is concerned.
The truth is, if "you" tried VM yesterday (or even today), because the hardware is very likely to be inadequate, "you" are very likely to be discouraged by your experience. And probably will never go back.
But things are changing. As I mentioned above, a complete AMD PC with Ryzen 7 5700U, Radeon Vega 8, 16 GB DDR, and 500 GB Nvme can now cost less than $300*. Both Qemu/KVM and VirtualBox allow VMs to run very well with this spec!
To spread the Linux desktops gospel to the general public, we really need a tool that can run Windows apps inside Linux (& WINE will never cut it). At least to provide a smooth transition. We can download Windows 10/11 images from Microsoft's official web sites**, and install the Windows images as a VM via Qemu/KVM or VirtualBox. I have heard that Windows 11 under Qemu/KVM can approach native speed. I am anxious to try it out.
* You can velcro this palm-sized "super" PC to the rear of a large 4K LED TV and create a gigantic AIO (All-in-One) machine. Many of my friends gauge the prowess of my computer based on the size of the computer screen!
** This is the link to download a Windows 11 iso (current release: Windows 11 2023 Update l Version 23H2):
https://www.microsoft.com/en-us/softwar ... /windows11
Last edited by pwzhangzz on 2024-02-21 23:52, edited 1 time in total.
-
- Global Moderator
- Posts: 2719
- Joined: 2018-06-20 15:16
- Location: Colorado
- Has thanked: 41 times
- Been thanked: 201 times
Re: QEMU/KVM For Starters
I recently was talking over this idea with an RV'er. There are some brackets available that sandwich in the typical DIN mount to hold 1U style mini computers. Or I can custom make a heat piped milled aluminum...$$$...never mind. In the corner I still have a few snowmobile radiators for base stock. Anyway, favoring 3.5 sbc's with intel xeons I can do some really nice solutions. They bought a high end amd with nvidia gamer laptop instead, I'm out.
For me, dual 43 and a 21:9 below! All dumb, one with MHL (whatever) which would work with that laptop probably.
Re: QEMU/KVM For Starters
Installing Windows 11 in Debian (I am running Sid, fully updated) is quite easy, probably much easier than in any other distro. The only thing you need to do is to install two packages:pwzhangzz wrote: ↑2024-02-19 01:40** This is the link to download a Windows 11 iso (current release: Windows 11 2023 Update l Version 23H2):
https://www.microsoft.com/en-us/softwar ... /windows11
Code: Select all
sudo apt install virtualbox linux-headers-$(uname -r)
Code: Select all
sudo apt install virtualbox-guest-additions-iso
Hardware is the above-mentioned mini PC. Performance is amazingly good with this amazingly inexpensive machine.
Would really appreciate it if one or more Qemu/KVM experts in this forum could share their experience. Or best, post their config file.
Re: QEMU/KVM For Starters
The following is a screenshot of running Windows 11 in Sid via qemu/kvm:
I basically followed the steps described in the following article:
https://sysguides.com/install-a-windows ... ine-on-kvm
Thanks for the excellent tutorial.
I basically followed the steps described in the following article:
How to Properly Install a Windows 11 Virtual Machine on KVM
https://sysguides.com/install-a-windows ... ine-on-kvm
Thanks for the excellent tutorial.
Re: QEMU/KVM For Starters
One apparent advantage that I can see--and I am speaking as a seasoned VBox user--of qemu over vbox, is that qemu allows an ummap discard option when selecting VirtIO as the emulated storage controller. In vbox, a file can be deleted but the "freed" disk space is not released, causing the vm to be indefinitely expanded (with time)*. As described in the above tutorial, "[w]hen you set the discard mode to unmap, the qcow2 disk image will automatically shrink to reflect the newly freed space]**.
When installing the Windows vm in qemu/kvm, I also needed to download the virtio-win driver (as part of an iso image) from the following site maintained by fedora/RedHat developers:
https://github.com/virtio-win/virtio-wi ... /README.md
* This problem can be greatly ameliorated by designating one or more partitions in the host (thus allowing files to be operated on the bare metal) as vbox shares which are automatically mounted during vm starts
** Debian developers have already set the qemu/kvm default storage option to "VirtIO with unmap discard mode" for (at least) Debian vm's***. Plse see the attached screenshot:
The default cache mode for the virtual disk is "hypervisor default". Not knowing what it means, I set the value to "none".
*** Since this thread is intended for qemu/kvm beginners (i.e., myself), I need to point out the even with the discard=unmap option, the previously occupied disk space will not be automatically freed. In order to reclaim the space, I needed to execute a fstrim (in the guest):
The following example shows that deleting a file does not cause the vm to shrink, only after executing the fstrim command will do:
Before file removal:
ryzen@L32:/extra/qemu-images$ du debian13.qcow2
6490992 debian13.qcow2
After file removal:
ryzen@L32:/extra/qemu-images$ du debian13.qcow2
6497776 debian13.qcow2
After the fstrim command:
ryzen@L32:/extra/qemu-images$ du debian13.qcow2
4556216 debian13.qcow2
When installing the Windows vm in qemu/kvm, I also needed to download the virtio-win driver (as part of an iso image) from the following site maintained by fedora/RedHat developers:
https://github.com/virtio-win/virtio-wi ... /README.md
* This problem can be greatly ameliorated by designating one or more partitions in the host (thus allowing files to be operated on the bare metal) as vbox shares which are automatically mounted during vm starts
** Debian developers have already set the qemu/kvm default storage option to "VirtIO with unmap discard mode" for (at least) Debian vm's***. Plse see the attached screenshot:
The default cache mode for the virtual disk is "hypervisor default". Not knowing what it means, I set the value to "none".
*** Since this thread is intended for qemu/kvm beginners (i.e., myself), I need to point out the even with the discard=unmap option, the previously occupied disk space will not be automatically freed. In order to reclaim the space, I needed to execute a fstrim (in the guest):
Code: Select all
sudo fstrim -av
Before file removal:
ryzen@L32:/extra/qemu-images$ du debian13.qcow2
6490992 debian13.qcow2
After file removal:
ryzen@L32:/extra/qemu-images$ du debian13.qcow2
6497776 debian13.qcow2
After the fstrim command:
ryzen@L32:/extra/qemu-images$ du debian13.qcow2
4556216 debian13.qcow2
Last edited by pwzhangzz on 2024-03-14 02:06, edited 8 times in total.
-
- Global Moderator
- Posts: 2719
- Joined: 2018-06-20 15:16
- Location: Colorado
- Has thanked: 41 times
- Been thanked: 201 times
Re: QEMU/KVM For Starters
I'm not a M$ on libvirt expert, but you can sparsify the ntfs containing qcow2 with virt-sparsify.
This utility is available in libguestfs-tools. I don't think ntfs supports '--in-place' trim but it can be done with a two step temp 'zero' file followed by a qemu-img from qemu-utils with '-c' option to compress.
Without a manual trim and compress sparsness operation while the vm is off, the qcow2 will grow but not indefinitely. The 'sparsness' action on a ntfs qcow2 running 24/7 can be lazy...
This utility is available in libguestfs-tools. I don't think ntfs supports '--in-place' trim but it can be done with a two step temp 'zero' file followed by a qemu-img from qemu-utils with '-c' option to compress.
Without a manual trim and compress sparsness operation while the vm is off, the qcow2 will grow but not indefinitely. The 'sparsness' action on a ntfs qcow2 running 24/7 can be lazy...
Re: QEMU/KVM For Starters
To simplify life, we're ext4-only, except of course the EFI partition.
Speaking of the devil, most people are stingy with the EFI partition (Debian installer suggests at least 300MB), we, on the other hand, typically give it at least 8GB space especially for our persistent LiveUSB sticks. This way, we don't have to create a separate FAT partition when we need to share files with, say Walmart, for printing photos etc.
Speaking of the devil, most people are stingy with the EFI partition (Debian installer suggests at least 300MB), we, on the other hand, typically give it at least 8GB space especially for our persistent LiveUSB sticks. This way, we don't have to create a separate FAT partition when we need to share files with, say Walmart, for printing photos etc.
-
- Global Moderator
- Posts: 2719
- Joined: 2018-06-20 15:16
- Location: Colorado
- Has thanked: 41 times
- Been thanked: 201 times
Re: QEMU/KVM For Starters
I didn't know windows 11 can run on ext4...
I thought the comments were about the file system within the qcow2.
Re: QEMU/KVM For Starters
Of course, to install Windows, you must first create an MSA (MicroSoft Account). Even the great E£on Mu$k was unable to get away from this. Below is his well-timed complaint (90 million views in one day):pwzhangzz wrote: ↑2024-02-22 09:55Installing Windows 11 in Debian (I am running Sid, fully updated) is quite easy, probably much easier than in any other distro.pwzhangzz wrote: ↑2024-02-19 01:40** This is the link to download a Windows 11 iso (current release: Windows 11 2023 Update l Version 23H2):
https://www.microsoft.com/en-us/softwar ... /windows11
https://twitter.com/elonmusk/status/176 ... tosize%3D1Just bought a new PC laptop and it won’t let me use it unless I create a Microsoft account, which also means giving their AI access to my computer! [emphasis added] This is messed up.
Finally, a "desperate (?)" incentive to switch the everyday OS to debian and run windows apps under a vm*.
* In VBox, I can create a desktop icon to execute a Windows program that has been installed in Windows VM. Suppose I can do the same with qemu/kvm.
-
- Global Moderator
- Posts: 2719
- Joined: 2018-06-20 15:16
- Location: Colorado
- Has thanked: 41 times
- Been thanked: 201 times
Re: QEMU/KVM For Starters
There is a way. Involving a 'cancel', a keystroke for a prompt, and a fancy oobe command.
I'm sure that doesn't end the concern if used online, they'll know.
I'm sure that doesn't end the concern if used online, they'll know.
-
- Posts: 1101
- Joined: 2016-01-07 12:25
- Has thanked: 7 times
- Been thanked: 16 times
Re: QEMU/KVM For Starters
Last time I installed Windows 10 I could refuse to connect to internet and it would eventually offer to create a local account, maybe they fixed that in the latest version though...
Re: QEMU/KVM For Starters
Below is a screenshot of running both Debian 12 and Windows 11 vms in Sid:
Installing Debian vm is very straightforward, except that, in order to allow file sharing between guests and host, I needed to install the virtiofsd package, which is included in Sid repo but, for some reason, not in Bkworm repositories including backport:
viewtopic.php?p=794400#p794400
Installing Debian vm is very straightforward, except that, in order to allow file sharing between guests and host, I needed to install the virtiofsd package, which is included in Sid repo but, for some reason, not in Bkworm repositories including backport:
viewtopic.php?p=794400#p794400
-
- Posts: 1101
- Joined: 2016-01-07 12:25
- Has thanked: 7 times
- Been thanked: 16 times
Re: QEMU/KVM For Starters
I find it easier to install nfs-common and connect to my NAS (or any nfs-server), but of course I already have that set-up so it makes sense in my situation.