Converting GNU/Linux Generation 1 VMs to Generation 2 on Hyper-V 2012 R2 – Part 1

I was thinking about the best way to kick off my new blog and I believe that sharing how to convert GNU/Linux Generation 1 VMs to Generation 2 on Hyper-V 2012 R2 is the best one, since I couldn’t find anything online when I searched for it.

In this series on Converting GNU/Linux Generation 1 VMs to Generation 2 on Hyper-V 2012 R2, I will go over this subjects:

Introduction

Last week I was talking with a colleague at work about generation 2 virtual machines in Hyper-V 2012 R2, their characteristics, differences with generation 1 VMs and why would be interesting to start using them.
Unfortunately the VM generation type is something that you choose when you create the VM and it can’t be changed afterwards. So for example, if you realized that by mistake you deployed a Gen1 VM that should be Gen2 instead, the only way to solve the problem would be to create a new Gen2 VM and reinstall the operative system (OS) and all the applications running on it.
Sometimes, because of the nature of the applications on the VM, or the lack of documentation about particular configurations, etc., you can’t afford to reinstall the VM from scratch unless you really need to.


After some research I realized that although it’s not possible, I could find some articles and powershell scripts on the Internet to “convert” a Gen1 VM running Windows to Gen2 without reinstalling the OS, or loosing data. I’m saying “convert” because actually they apply some changes to the gues OS of the Gen1 VM and then move the VHDX to a different Gen2 VM that was previously created. So it’s not really a conversion of the VM because you will end up using a different VM already created as Gen2.
In any case I couldn’t find anything about how to achieve the same on VMs running GNU/Linux.
Hence that’s why I decided to test and document a procedure to achieve this that I will be sharing with you.

Stay tuned for my next posts.