1

Topic: I tell you how to use VM

In my case for the informatic of my work I need virtuals machines beacose my informatic is diferent, then, for run VM inside VM, I use the next

in a file `/etc/modprobe.d/kvm.conf`

options kvm_intel nested=1

^ is for my beacose I have intel, then

when you want use nested virtualizatione

you can use a normal qemu script, but is needed the next line

          -accel kvm,kernel-irqchip=split, \
          -cpu host                        \

if you want a complete script you can see the next:

#!/bin/bash

isoi=iso.iso
disk=img.img
vm_name=VM
## CPUs
cpus=8
## RAM
ram=6 #GBs de RAM
ram=$(( $ram * 1024 ))
# o se puede comentar lo de arriba y establecer los MBs personalizados
#ram=2560
#net=(-netdev user,id=vmnic -device virtio-net,netdev=vmnic)
net="-netdev user,id=${vm_name} -device e1000,netdev=${vm_name}"

qemu="qemu-system-x86_64"

audio='-device sb16        \
       -device adlib       \
       -device ES1370      \
       -device cs4231a     \
       -device gus         \
       -device AC97        \
       -device intel-hda   \
       -device hda-duplex' \

audio=''

if ! [ -f img.img ]
then
    qemu-img create -f qcow2 -o size=80G img.img
fi

if du -sh img.img | grep G &> /dev/null || \
        du -sh img.img | grep M &> /dev/null && \
            ! echo "$1" | grep boot &> /dev/null
then
    $qemu $audio                           \
          -vga virtio                      \
          -accel kvm,kernel-irqchip=split, \
          -cpu host                        \
          -k es                            \
          -name $vm_name                   \
          -rtc base=utc                    \
          -smp cpus=$cpus -m $ram          \
          $net $disk
else
    $qemu $audio                           \
          -vga virtio                      \
          -accel kvm,kernel-irqchip=split, \
          -cpu host                        \
          -k es                            \
          -name $vm_name                   \
          -rtc base=utc                    \
          -smp cpus=$cpus -m $ram          \
          $net -boot d -cdrom $isoi -hdd $disk
fi

then if you want audio support only comment the line:

audio=''

then that command waiting a iso.iso, and create a img.img, then in this case It will be better have the name of the operative system in the base folder, then use the same command for diferents folders, then when is not img.img created, this command create a new, so, If you want start with a new, only remove or rename your img.img