Converting a Generation 2 HyperV VM to boot in KVM\Openstack

Brining a HyperV Gen2 VM into Openstack

Convert the vhdx to raw and into ceph
qemu-img convert -f vpc -O raw AC-TS01-C.VHD rbd:volumes/AC-TS01.raw

Attach the old(Existing) disk and the new blank disk to a linux box
Install clonezilla from apt
On the new disk create a new partition(This will be an MBR partition not a GPT partition and is key to being able to boot in KVM)
Fdisk/dev/sdX
N
P
..
..
Clone the Windows volume(Just the big volume, ignore the small piss-ant recovery volumes)
Might then need to mount this volume on a windows box to check the NTFS partition is ok, if it’s not showing a drive letter I had some success with resizing the partition with Easus partition manger, which presumable re-wrote the ntfs partition headers and then the disk appeared in windows
THEN you need to boot the os, it’ll fail

Attach a windows server ISO, boot to recovery(Needs to be the correct OS recovery environment. I tried using a 2016 DVD to recover 2012 R2 and it didn’t work)
Run

bcdboot C:\windows
Or
bcdboot C:\windows /s c: /f ALL

BOOTREC /FIXMBR

BOOTREC /FIXBOOT

Then reboot and all good
If you haven’t preinstalled virtio might need to boot on sata then install virtio drivers

Fix sluggish mouse cursor

I find the cursor speed is sometimes to slow on my Ubuntu machine with a Logitech MX trackball

And for reasons I dont recall I wanted to set the speed with a script instead of the setting application

 

#!/bin/bash
xinput set-prop "pointer:Logitech MX Ergo" "libinput Accel Speed" 1

Running CollectD as a container

Dockerfile

FROM ubuntu:18.04
RUN apt update
RUN apt-get --no-install-recommends install collectd -y
RUN apt install -y python-pip
RUN pip install collectd-gnocchi

Running the container

docker run -it --net=host --privileged -v:collectd.conf: /etc/collectd/collectd.conf collectDContainerImage collectd -C /etc/collectd/collectd.conf -f