0

I am trying to install windows 7 64bit as a kvm guest. I read here that I should install the virtio scsi driver during installation.

I use virt-install to start my installation from the command line

virt-install --connect qemu:///system \
    --name win7vnc --ram 2048 --vcpus=2 --cpuset=auto \
    --disk path=win7.img,bus=virtio 
    --network=network=default,model=virtio,mac=RANDOM 
    --graphics vnc,port=5900 
    --disk device=cdrom,path=../../isos/virtio-win-0.1-81.iso  
    --disk device=cdrom,path=../../isos/win7_sp1_ult_64bit/Windows\ 7\ SP1\ Ultimate\ \(64\ Bit\).iso 
    --os-type=windows --os-variant=win7 --boot cdrom,hd    

The installation start fine and as expected windows do not detect a hard disk. So I load driver and the disk is indeed detected. The problem is it only has 99MB capacity, while I created the disk to be 100GB with the command

qemu-img create -f qcow2 win7.img 100G

what could be wrong and the capacity is not correct?

EDIT: picture of the problem

enter image description here

  • Does your virtual disk already have a partition table on it? Use DISKPART to erase it. – Michael Hampton Sep 25 '14 at 18:11
  • @MichaelHampton hi there! could you please elaborate on DISKPART abit ? (invocation, usage, etc) because I cannot find any info on diskpart wrt kvm. thanks – nass Sep 25 '14 at 22:45
  • Why would you? It's a Windows command! – Michael Hampton Sep 25 '14 at 22:48
  • there seems to be NO more space. really. DISKPART shows the same please see the added image – nass Sep 26 '14 at 10:44
  • hm ok I found a solution. I start the installation by suggesting size and format for the disk image. – nass Sep 26 '14 at 11:59
1

in the end, i set disk settings as if I will create a new disk at the time the virt-install command is run, even though I have a disk image ready in advance. so I run:

virt-install --connect qemu:///system \
    --name win7vnc --ram 2048 --vcpus=2 --cpuset=auto \
    --disk path=win7.img,bus=virtio,size=100,format=qcow2 \
    --network=network=default,model=virtio,mac=RANDOM \
    --graphics vnc,port=5900
    --disk device=cdrom,path=../../isos/virtio-win-0.1-81.iso \
    --disk device=cdrom,path=../../isos/win7_sp1_ult_64bit/Windows\ 7\ SP1\ Ultimate\ \(64\ Bit\).iso \
    --os-type=windows --os-variant=win7 --boot cdrom,hd 
0

i have written a little shell script to automate installation of Windows 7 in KVM that works for Ubuntu Linux 12.04 as host system:

http://torsten-traenkner.de/linux/create_virtual_machine_with_windows_7.sh.tgz

With a little video:

https://www.youtube.com/watch?v=xwHmdAWkbx4

The script creates a sparse file as a raw disk image. This has the advantage that the virtual disk does not use the complete real disk space at once and that you can mount the raw image easily. If the script does not work for your Linux distribution you can look inside the script to see how it's done.

dd if=/dev/zero of="$DISK_IMAGE_NAME" bs=1 count=0 seek="$virtualMachineSizeInGB"G > /dev/null 2>&1
-1

I wrote up my experience here:

http://www.returnbooleantrue.com/2015/04/making-your-windows-kvm-guest-boxes-fly.html

You can certainly add VirtIO after you finish installing windows.

  • 1
    Instead of just linking to your site you should add the main solution to you answer. Then, you can add your blog as a reference. – Esa Jokinen Apr 14 '15 at 6:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.