Hot answers tagged

25

Old question, but it might still interest people. Short anwser : qemu -nographic -serial mon:stdio -append 'console=ttyS0' binary.img ttyS0 valid on most PC. it would be something different on ARM system. Then the serial port and the QEMU are multiplexed on your output. You can switch between them with ctrl-A + C + ENTER. Long answer: check this blog, ...


21

Noop conversion (qcow2-to-qcow2) removes sparse space: qemu-img convert -O qcow2 source.qcow2 shrunk.qcow2 You can also try add compression (-c) to the output image: qemu-img convert -c -O qcow2 source.qcow2 shrunk.qcow2 Before running above command be sure to shutdown the VM. After you are satisfied with the result, you can rename shrunk.qcow2 to ...


20

virt-sparsify can do all this with less hassle on your part: http://libguestfs.org/virt-sparsify.1.html


19

For your specific use case (base image + qcow2 overlay), the RAW format should be preferred: It's faster: as it has no metadata associated, it is as fast as possible. On the other hand, Qcow2 has two layer of indirection that must be crossed before to hit the actual data As the overlay layer must be a Qcow2 file, you don't lose the ever-useful snapshot ...


19

Not all cached data can be discarded immediately. For example, cached dirty pages have to be written back to disk before they can be removed from RAM. You have no swap, so until those writes complete, there simply isn't enough available space for QEMU. You really should add a reasonable amount of swap. You can't expect the memory manager to do a good job ...


13

Most current hypervisors that run on Intel hardware use CPUID leaves 0x40000000 et seq. to pass information about the hypervisor from host to guest. KVM, Xen, VMware and Hyper-V all use this method. This is in addition to the hypervisor feature flag set in CPUID leaf 0x1, which indicates that the machine is a virtual machine. It's therefore trivial for a ...


12

The only thing you are missing is to quiesce the guest filesystem before taking the snapshot, to ensure that it is consistent. This can be done with virsh domfsfreeze if you are using libvirtd. For example, the order of operations is: # Freeze guest filesystems virsh domfsfreeze $VM_NAME # Create snapshot qemu-img create -f qcow2 -b $VM_NAME.qcow2 ...


12

You created your guest with virsh create (or its equivalent). This creates transient domains, which are deleted when they power off. To create persistent domains, use virsh define instead. These remain defined after they are powered off or destroyed, and can be started again at any time.


11

Try virt-sparsify - it will zerofill the unused blocks in the image and then deduplicate the zeroes.


11

Changes made to a network take place the next time the network is started. You need to perform this series of operations. virsh net-edit somenet virsh net-destroy somenet virsh net-start somenet For confirmation of this, see functionality of virsh net-edit Note that restarting a network like this will terminate network connectivity for any VMs using this ...


11

This is not a distro problem, but a bug in Windows: http://keyliner.blogspot.se/2009/11/windows-7-slow-keyboard-response.html (second clause) That is what helped me: Start, Run, regedit Find this key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\i8042prt\Parameters On the detail side, right-click the blank area and add a new "DWORD (32-bit)" ...


11

You can't use switch port security on the Cisco since all the VMs will be sharing a physical switch port. And you can't use Linux iptables because the traffic is being bridged, not routed, through the hypervisor machine. But you can emulate switch port security on the hypervisor with Linux ebtables, which is a lesser-known layer 2/3 firewall on the Linux ...


10

I asked the mailing list, here's what I got: qemu-arch like /usr/local/bin/qemu-x86_64 is for running a program of that arch on the host machine of what ever arch, but not a virtual machine qemu-system-arch like /usr/local/bin/qemu-system-x86_64 is for running a system of that arch on the host machine to enable kvm support, qemu parameter -enable-kvm is ...


10

qemu-img and du both report the actual allocated space from host point of view. They can not know/understand if the guest OS is really using that space or if, as in you case, it was freed by the user. To inform the host that your guest has a ton of free space you need to fstrim your guest filesystem and you must be sure that your qemu/guest block device ...


9

I will give very rough idea/explanation. In OP situation, besides measuring within the VM, the host should be look at too. In this case, we can assume the following are correct In all the test, the host I/O(disk) bandwidth is not max out. As VM("monitoring") I/O increases with more CPUs allocated to it. If host I/O was already max out, there should be no ...


9

Got it to work: qemu-system-i386 -net nic,model=rtl8139 -net user,hostfwd=tcp::3389-:3389 -redir tcp:443::443 -redir tcp:992::992 -redir tcp:1194::1194 -redir tcp:5555::5555 -redir udp:1194::1194 -redir udp:500::500 -redir udp:4500::4500 -m 512M -localtime -cpu core2duo,+nx -smp 2 -usbdevice tablet -k en-us -hda win.img -nographic


8

I believe the tool you're looking for is kpartx. The general procedure is: List partitions in the disk image: kpartx -l /dev/vg0/mylv Add the partitions to device-mapper: kpartx -a /dev/vg0/mylv Mount the partition you're interested in: mount -o ro /dev/mapper/loop0p5 /mnt


8

I did not found out "why", but I did find way to get it work. So, if anyone has same problem, solution was like that: dumped network config with virsh net-dumpxml /tmp/somenet.xml stopped network virsh net-destroy somenet inactivated network virsh net-undefine somenet made needed changes in /tmp/somenet.xml created network again virsh net-create /tmp/...


8

qemu-img convert -f qcow2 -O vmdk whatever.qcow2 whatever.vmdk


8

To shrink a Windows Guest OS, you have to shrink the partition inside the guest, shutdown the VM, create a new smaller disk of the desired size, copy the data from the old disk to the new smaller disk, swap the disk names and reboot the VM. It’s straightforward, yet if done improperly could lead to loss of data – and hair. Here are the steps for KVM with ...


7

This seems to me like a permission issue on the host: By default, the qemu/kvm process is started as a non-privileged user (libvirt-qemu in Debian Wheezy). So only files accessible (or writable) by that user are accessible (writable) by the VM guests. You might try setting ownership of the directory to the user qemu is run as (see user= and group= in /etc/...


7

If you want to do what @James recommended via the cli you can do the following: $ parted /dev/sde --script -- mklabel msdos $ parted /dev/sde --script -- mkpart primary 0 -1 This was of course on a smaller HDD (1TB) so as was mentioned in the comments, anything over 2TB will require a different label, and yes you should be using GPT for that. $ parted /...


7

Do not use the .vmdk image itself but the smaller .vmdk file which references the image.


7

Please be advised....if you are using linux you can use raw and get the same benifits of qcow2 as far as size goes. ...If your file system supports holes (for example in ext2 or ext3 on Linux or NTFS on Windows), then only the written sectors will reserve space. https://docs.fedoraproject.org/en-US/Fedora/18/html/Virtualization_Administration_Guide/sect-...


7

You're seeing this error because Ubuntu put their own customizations into its version of libvirt and qemu/KVM. RHEL, of course, did the same thing. But there's always a machine type that will work, namely, pc. This is always aliased to the latest i440fx machine type available on the hypervisor at the time the VM is defined. Somewhere in the XML you'll find ...


7

Research Qemu treats discard=unmap and discard=on the same: block.c (line 773): } else if (!strcmp(mode, "on") || !strcmp(mode, "unmap")) { It also seems to support multiple of the Linux ioctls as described here for writing or discarding zeros at the block level: block/file-posix.c (line 581): if (ioctl(s->fd, BLKDISCARDZEROES, &...


6

There are a bunch of steps you need to do, if memory serves. Firstly, you'll need to use pvresize to expand the existing PV to the new top-of-partition. Then you'll need to use lvresize or lvextend to resize the existing LV volume(s) into the enlarged PV. Then you can use resize2fs to resize the file system(s) into the new enlarged volume(s).


6

First of all install latest version of libvirt-bin(>=1.0.0) on the host system. Installing libvirt-bin(>=1.0.0) on Ubuntu12.04 is itself a challenge because of dependencies.This link may help to do so: https://tad-do.net/2013/02/22/testing-new-libvirt-features-on-ubuntu-12-04/ Then execute following commands on host: mkdir -p /var/lib/libvirt/qemu/channel/...


6

KVM and it's derivatives have a VNC server in its video subsystem. So you have to take a VNC client (any from widely availables), configure your KVM VM machine with a VNC connection (I usually do this by supplying a --graphics vnc,port=5900,listen=0.0.0.0 option to the virt-install program) and use it to remotely install any operating system you want. This ...


Only top voted, non community-wiki answers of a minimum length are eligible