Setting up a disk image/clone to run on a VM

Hello Friends,

As per title I am trying to figure out how to make my Windows 10 current system set up works on a VM in Manjaro.

To give you an idea, all I have is a i5 CPU, no GPU, a 256 GB SSD currently dual bood (Windows 10 - Manjaro) and 2 TB HDD of space available.

After my first discussion on the topic and a quick research I’m starting to lay out my strategy:

  1. my hardware lacks performance so the best would be to get some bare-metal hypervisors based VM;
  2. once chosen the VM software for the work I need to understand how to mount my guest OS, either in a:
    a. disk image;
    b. disk clone;
  3. It seems working with images is better than with clones. In that case I need an app for imaging (clonezilla?);
  4. I have to make sure the image is compatible with the VM software;

Am I on the right path?

This was not enough info to create a disk image from your existing Windows installation, to then use that in a VM like VirtualBox??

1 Like

Maybe I am missing something here, but… Why waste all this time playing around and “researching” when you could have already installed Windows from scratch in Virtualbox and tweaked to your liking?

Licensing issues

You have to realize that your Windows activation will be void and you need to reactivate the VM which may fail as the key you try to activate is likely bound to a key in your hardware’s efivarfs.

This perhaps makes it a better choice to cough up a digtal windows license and install from scratch.

Conversion


There is likely several methods available - I have personally used the following with no issues.

It can be done but you have a few hoops to jump and you need a separate storage device with room for your Windows installation.

The old forum topic does not exist anymore.

Keep in mind what mode you current Windows boots (BIOS or EFI) - you will have to ensure the VM boot the same way. If you want a truly portable - independent VM - you need to go the reinstall in a VM defaulting to BIOS boot.

Depending on your choices and the Windows version you may need to do some registry editing prior to installing the system from scratch.

The steps to migrate your current Windows is - roughly - as follows

  1. Locate download and install the Windows tool Disk2VHD - download from Microsoft
  2. Locate and download the windows sdelete utility. - download from Microsoft
  3. use sdelete to zero your running Windows unused space
  4. defrag your windows windows
  5. run sdelete one more time
  6. use windows disk manager to resize the partition something between 80 and 127G
  7. Use disktovhd to convert your running windows to hyperv using the vhdx format
  8. Use vbox-manage to convert the vhdx file to a vdi file
  9. Create a new Windows VM using virtualbox
  10. If your current system is EFI you must use EFI otherwise the vm won’t start
  11. and instead of creating a virtual disk you attach the vdi created above

It is a time consuing process which requires a lot of diskspace.

raw disk option

Another - less used option - is to add the physical device as a raw disk beforehand - so instead of creating a disk - for the newly created vm you can attach the raw device.

If you go down that road - you need to ensure you user has adequate rights to access a raw device - on the /dev/sdxY path - a normal user doesn’t and running the vm as root is not a good solution.

Using a raw device presents it’s own issues - e.g. device access is exclusive to the windows vm

3 Likes

I think so. On this topic, however, I wanted to focus on which type of approach (in terms of VM software) to use given the specs of my hardware. Should I have kept using that same thread?

Is what I am going to do if it gets too complicated.

Thanks for the detailed explanation @linux-aarhus . Sounds fun!

About point 3, 4 especially and 5. Should they be done on a SSD?

My Windows installation made three volumes: a Recovery Partition (500 MB), a EFI System Partition (100 MB) and a Basic Data Partition (the remaining space). In point 6 I have to convert the Basic Data Partition to vhdx format. Correct?

Thanks for your support

you want to create an image of the installation that you already have.
In order to do that efficiently, you do all the steps.

you did not follow the train of thought -
1 through 5 is what you do to the original windows system, before you create an image from it
ssd or not is irrelevant - put it wherever you like

a rather moot point as of now
and: what VM software you use is entirely up to you - your hardware will not pose different limitations in between the (effectively) only three choices that you have.

Sorry, “I think so” meant yes of course those was enough info to create a disk image. Poorly stated…
I guess I should have stayed on the previous thread.

I understand. I was just wondering whether zeroing or defrag an SSD would wear it. But I guess that is a necessary evil to make a good system image.

It is actually what I was trying to understand, which hypervisor software was better, whether a type 1 or 2. That makes things easier. Thanks.

Not necessarily.

If your Linux root filesystem is btrfs then you need to take into account how btrfs works with CoW which can be a severe pain when storing large files.

Either create a partition using ext4 for storage or disable CoW for the VirtualBox VMs folder.

That would be correct.

I remember one step you could add before creating the image.

if the partition is larger than 127GB - resize the partition to a reasonable size using windows diskpart gui.

It’s ext4.

It is larger. If I do not want to upset the current settings on the SSD, I was wondering, can I make a clone of the Basic Data Partition to my HDD and then there do the resizing and point 3, 4 & 5?
I don’t think I can do it directly on the vhdx, can I?

I’ve never run VBox, I must say it is a powerful and interesting tool.

So I went through 1, I skipped 2, 3, 4 & 5 for the moment, then 6, 7 and 8 until I found myself in front of that nice green arrow. Very exiting!

I did for a moment think disappointingly that was it. Luckily though I got this message:

No bootable medium found! Please insert a bootable medium and reboot.

That was so close! The game goes on.

I haven’t have time to delve too much but could it be that the Windows boot is on the Manjaro partition since I am in dual boot?

I haven’t found such setting in Vbox, in case this has anything to do with the above mentioned issue.

I’ll try to figure out whether I can solve it loading the original Window installation somehow, but if you have a clue on how to solve this I would be happy to opt for that too.

whatever happened afterward is irrelevant
why skip these steps?
all sdelete does is write zeroes to all of the disk that isn’t occupied by any file.
It makes compression much more efficient - to be able to create a small sized disk image.
That is the reason it is used - similar for the recommended defrag.

… if you don’t know what you are doing
and rely on help -
why go ahead and change the recommended procedure?
and then wonder what might have happened …

I’ll now just watch - will not interfere anymore.
Promise! - and good luck!

ps:
you should try learning VirtualBox (or whatever software you chose to use)
by simply using it to install and run the very same ISO of Manjaro that you used to install your now working system.
Or some other ISO - whatever you have got.
As an example, as an exercise … to get to know how to use it.

:point_down:

You should really - really do the described maintenance on your Windows before creating a vm from it.

In any case - your system - your rules.

There is no need for periodic defrag of ssd devices - such device is fundamentally different from a spinning disk. But when planning on moving to a vm it is good practise to ensure the initial vm is as small as technically possible. @Nachlese already pointed you to the why’s of the maintenance described.

Learning is always fun - and if you are on a learning path - I suggest you do more reading and more experimenting on your own - hands-on, notes, making mistakes, repetition, repetion and then some repetiion - not to mention muscle memory are fundamental in learning and remembering what you learned

Please say no more!! I gotta solve this by myself :triumph: :slightly_smiling_face:

Anyways thanks, you gave me lots of useful info. I’ll do more experimentation on my own and come back later