[clug] I need help with KVM vitualization [SOLVED]

eyal at eyal.emu.id.au eyal at eyal.emu.id.au
Mon Jul 20 04:38:41 UTC 2020


On 2020-07-19 21:48, Eyal Lebedinsky via linux wrote:
> On 2020-07-19 21:07, Michael Still via linux wrote:
>> https://moozing.wordpress.com/2015/06/24/converting-a-physical-machine-to-a-virtual-machine/
>>
>> This looks like a reasonable guide to me.
> 
> Yes, it reads well.

Good progress was made.

Booting fedora live iso works, and I then can mount my system and see it is OK.

Booting my image hangs after a short time. No messages seen in /var/log.
I rebuilt initramfs with added virtio_blk and it continued further but not enough.

At this point I wanted to capture the console log. I created a second serial device with
a device type 'file'. Now the system booted all the way! Turns out the kernel argument
'serial=tty0' needed to change to 'console=tty1'. Go figure.

All in all, it was a straight forward process.

I removed more kernel boot command line options that were required for the old mobo.
Also needed to adjust some permissions on the host (exports, ssh and such) to allow
the bridge. I will probably find more, hiding in some dark corners.

Finally I learnt the hard way how to leave full screen view.

I found out that hibernate does not work (or maybe it is VERY slow, it said 20% and went
quiet for at least 10 minutes). Should I use a qemu feature (I see 'pause' and 'shutdown/save')?
I think 'save' is the persistent equivalent to linux 'hibernate'.

What do people do to ensure that when the host shuts down the guests are safe?
How resilient is libvirt after a cold crash?

cheers,
	Eyal

> Initially I think that I need to create a storage pool on a large partition,
> there is not enough room on /. I may actually modify 'default' to the new location.
> 
> BTW, I have stray items left from the first failure, like
> 
> $ sudo virsh pool-list
>   Name      State    Autostart
> -------------------------------
>   default   active   yes
>   eyal      active   yes
> 
> and 'eyal' is actually my home directory.
> 
> If I do
>      $ sudo virsh pool-destroy eyal
> will the pool be gone but the data remain untouched? The man page says so.
> 
> I also see
> 
> $ sudo virsh list --all
>   Id   Name       State
> ---------------------------
>   -    fedora32   shut off
> 
> But there is no image file anywhere. All I can find is
> 
> $ sudo ls -l `sudo find /var/lib/libvirt/ -name '*fedora32*'`
> /var/lib/libvirt/qemu/channel/target/domain-3-fedora32:
> total 0
> srwxrwxr-x 1 qemu qemu 0 Jul 18 23:38 org.qemu.guest_agent.0
> 
> /var/lib/libvirt/qemu/domain-3-fedora32:
> total 8
> -rw------- 1 qemu qemu 32 Jul 18 23:38 master-key.aes
> srwxrwxr-x 1 root root  0 Jul 18 23:38 monitor.sock
> 
> I expect I can safely 'delete' it in virt-manager? This is the only vm listed there.
> 
> I can see related files under /etc/libvirt/ describing the above resources.
> 
>> Michael
> 
> Thanks,
>      Eyal
> 
>> On Sun, 19 Jul 2020, 8:02 pm Eyal Lebedinsky via linux, <
>> linux at lists.samba.org> wrote:
>>
>>> On 2020-07-19 19:29, Michael Still via linux wrote:
>>>> KVM is a totally cromulent tool to do this sort of thing, but you'd have
>>> a
>>>> better experience if you were using libvirt or a libvirt wrapper
>>>> (virt-manager, a hobby project from a burnt out cloud engineer, that sort
>>>> of thing).
>>>
>>> I am not even clear about how kvm, qemu and libvirt relate to each other.
>>> Hence my search for a good doco.
>>>
>>>> What you describe should just work.
>>>
>>> "should"...
>>>
>>> I did use virt-manager in this case. I pointed it at the vdi file and let
>>> it boot.
>>> It then failed etc.
>>>
>>> My plan now is this:
>>> - start virt-manager, tell it the disk size I want, memory, CPUS... boot a
>>> clonezilla iso.
>>> then:
>>> - clone from the original machine to this empty disk.
>>> or:
>>> - create an ext4 partition. Mount it.
>>> - rsync the content of the original machine into this partition
>>> - probably fix fstab and install grub
>>>
>>>> Michael
>>>>
>>>> On Sun, 19 Jul 2020, 4:51 pm Eyal Lebedinsky via linux, <
>>>> linux at lists.samba.org> wrote:
>>>>
>>>>> The first thing I need is a pointer at a good doco that explains what
>>>>> linux kvm is and how to import
>>>>> a physical machine into the virtual domain.
>>>>>
>>>>> I dd'ed the root disk (/dev/sda) to a file on a local disk of the
>>> machine
>>>>> that will be the VM host.
>>>>> I searched for instructions and found most are missing what I consider
>>>>> essential detail, like where
>>>>> exactly I should run each step etc. Others have a more complicated setup
>>>>> (lvm and what not).
>>>>>
>>>>> My main worry is that I tried it once, used the GUI tool (virt-manager)
>>>>> and pointed it at a disk
>>>>> image (from a VirtualBox I had lying around). It started booting
>>> (offered
>>>>> the grub selection)
>>>>> then showed a screen with three dots and gone quiet. After a few
>>> minutes I
>>>>> got an error message
>>>>> and a dracut prompt.
>>>>>
>>>>> Not knowing how to proceed I decided to just abandon this vm. I issued
>>>>> 'halt' inside the small
>>>>> console window and it did it.
>>>>> It also shut down the host machine (and probably every other linux
>>> machine
>>>>> in Australia - I
>>>>> could not tell).
>>>>>
>>>>> I was surprised that a virtual tool can do this to the host, having used
>>>>> Vmware and VirtualBox
>>>>> where there is a clear fence around the VM world.
>>>>>
>>>>> So much fun, but I probably need to educate myself better about what KVM
>>>>> really is.
>>>>>
>>>>> My need is simple:
>>>>>      - I have an image (dd) of the disk from a physical machine. I want
>>> to
>>>>> run it as a virtual
>>>>>        machine on another host. How do I import the image?
>>>>>      - Is kvm the correct tool for this? Should I go back to using
>>>>> VirtualBox?
>>>>>
>>>>> TIA
>>>>>
>>>>> -- 
>>>>> Eyal at Home (eyal at eyal.emu.id.au)
>>>>>
>>>>> -- 
>>>>> linux mailing list
>>>>> linux at lists.samba.org
>>>>> https://lists.samba.org/mailman/listinfo/linux
>>>>>
>>>
>>>
>>> -- 
>>> Eyal at Home (eyal at eyal.emu.id.au)
>>>
>>> -- 
>>> linux mailing list
>>> linux at lists.samba.org
>>> https://lists.samba.org/mailman/listinfo/linux
>>>
> 
> 


-- 
Eyal at Home (eyal at eyal.emu.id.au)



More information about the linux mailing list