Check out my first novel, midnight's simulacra!


From dankwiki
(Redirected from Kvm)

KVM, a drop-in qemu replacement engine making use of VT hardware, is in my mind the best of some 4000 Linux VT Solutions. The page is really nice. The qemu wiki also regularly proves itself useful.

Mounting a QCOW2 image

  • Verify qcow2 format:
[schwarzgerat](130) $ file  /media/vms/win10.img 
/media/vms/win10.img: QEMU QCOW2 Image (v3), 137438953472 bytes
[schwarzgerat](0) $ 
  • Connect it to a network block device:
[schwarzgerat](1) $ sudo qemu-nbd --connect=/dev/nbd0 /media/vms/win10.img 
[schwarzgerat](0) $
  • Find the partition:
[schwarzgerat](1) $ sudo gdisk /dev/nbd0 -l
GPT fdisk (gdisk) version 1.0.9

The protective MBR's 0xEE partition is oversized! Auto-repairing.

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/nbd0: 268435456 sectors, 128.0 GiB
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): DBEAA70E-0076-4A74-A7C4-D2F498223CD0
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 125829086
Partitions will be aligned on 2048-sector boundaries
Total free space is 6077 sectors (3.0 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048         1023999   499.0 MiB   2700  Basic data partition
   2         1024000         1226751   99.0 MiB    EF00  EFI system partition
   3         1226752         1259519   16.0 MiB    0C01  Microsoft reserved ...
   4         1259520       125825023   59.4 GiB    0700  Basic data partition
[schwarzgerat](0) $
  • Mount it: sudo mount /dev/nbd0p4 /media/windows

Integration with virtio

Tmpfs issues

  • See the info on hugetlbfs at Pages

Automated/daemonized use