Moving Windows to a Virtualbox

Resuming this topic since not making any progress... I've tried following various guides for creating a Windows image of an existing installation but all the guides lead me down rabbit holes showing options in programs which are no longer pertinent. Does anyone know how I can currently create an image which can be imported into VirtualBox? With VMWare, I think I need to download the Standalone Converter, but I can't just download it I need apply for an account first.
 
Eventually managed to register and download VMware vCenter Converter Standalone which has created two files a *.vmdk and a *.vmx...

How do I import them into VirtualBox, or do I need to convert them first?
 
I see you have some sort of converter program. That might work, but you should start with a fresh image just to learn the process.
The vmdk format is a pre-formated VM.
 
One can import a .vmdk into Virtualbox much like one creates an instance of a virtual machine in it. The instance of the virtual machine takes the size of the vmdk file. No other installation required.
 
There are two "different" vmdk disk formats: one is for a virtual disk image, another is to describe an actual physical disk to attach, see the corresponding chapter of the VB's manual.
 
After another break, time to make some progress. I've downloaded and installed VMware Converter Standalone. The system I'm trying to convert has two installations of Windows and I'm trying to convert the one I haven't booted from but it is on the local machine. But when I select
'This local machine' I get 'Permission to perform this operation was denied'...

Is it possible to convert the local machine?
 
I'm not sure why you may want to use a third-party converter. Just make images of needed partitions using dd(), "construct" a virtual disk (=disk image file) and copy those partitions to it. Perfectly works, I've done it many times. Windows may complain about boot environment, so have a Windows installer handy, use it (if needed) to fix the current installation when booted from your virtual disk. Also, before dd-ing I'd recommend shrinking Windows partition(s) down using Windows Disk Manager to eliminated copying unused blocks. When everything is up and running, you can expand them back.
 
I'm not sure why you may want to use a third-party converter. Just make images of needed partitions using dd(), "construct" a virtual disk (=disk image file) and copy those partitions to it. Perfectly works, I've done it many times. Windows may complain about boot environment, so have a Windows installer handy, use it (if needed) to fix the current installation when booted from your virtual disk. Also, before dd-ing I'd recommend shrinking Windows partition(s) down using Windows Disk Manager to eliminated copying unused blocks. When everything is up and running, you can expand them back.
To be honest I'm using this VMware tool because someone suggested it.

Are you suggesting that I create a virtual disk using dd()? Although if I shrink the partition then presumably ifs would be /dev/ada0s1 ?
What about the system partition? Never really known what that was for. Windows is really a big mystery to me and am usually happy for it to stay that way.
 
Use gpart() to list the current partitions, save its output in a file. You're right, Windows is tricky, and it doesn't like when you change the partitions' numbers (indices). That's why, if you need e.g Windows installation on partition 4, but there is another one on partition 3, just create a tiny partition 3 on your virtual disk to keep the same indices (I'm not sure about the recent Windows releases, but before they used to re-arrange indices, so just assigning index 4 and skipping 3 didn't help).
If the original disk is GPT, it's easier (IMO): the first partition is EFI, you can just copy files instead of dd-ing (it's FAT). If it's MBR, make sure to make the first partition active (check with gpart()'s output first). The "system" partition is the boot partition, I guess. The first one, right? You need it, but you definitely don't need a "recovery" (or whatever it is) partition which is regularly the last one.

If you shrink a partition, its index won't change, you'll have a hole between partitions, you don't need exactly the same hole in the destination disk, just space you'd like to expand that partition later into.
 
I've wasted a couple of days trying to recover a Windows system which suddenly wouldn't boot because the BCD file got removed after I booted a different installation of Windows on the same system. Went through dozens of explanations of how to recover the file and eventually found one which worked.

I have now shrunk the Windows partition as much as I can using Windows builtin administrative tools.

So am I at the point where I can create the Windows.VHD by booting up FreeBSD and mounting the Windows partition using ntfs-3g?

Assuming I run

ntfs-3g /dev/da0s1 /mnt/ntfs

I'm not really clear what should be done next. Can't see how truncate() fits into the scheme of things... Obviously missing something. An example of its usage would be useful...
 
I'm not sure why do you need to mount a Windows partition?
What I usually do:
Code:
# create an empty file:
truncate -s 32g windisk.img

# create a device node:
mdconfig windisk.img

# partition virtual disk:
gpart <command> md0

# copy partitions from physical disk to virtual:
dd if=/dev/ada0pX of=/dev/md0pX bs=1m
 
I see.... didn't really understand how to do this...

My Windows partition is 171GB. Would this be a problem? I have 200GB spare space on the disk which has Virtual Box installed.

When running gpart add what partition type should I use?

One thing I just noticed is that I'm running a 64-bit version of Windows does that mean I won't be able to run this in Virtual Box after all?
 
171GB? I can't imagine what really Windows specific can occupy such space. Anyway, you'll still have 29GB remaining.
Have you resized that Windows partition? I found, that ntfsresize() can do it even better than Windows Disk Manager, although, more dangerous. I'd recommend starting Windows after resizing - it will run filesystem check (real Windows, not "virtual").
Regarding the 64bit: VirtualBox executes instructions directly on the CPU, if your CPU is 32bit, it's not going to work. Even if VirtualBox can do full emulation (if - just guessing), the performance will not be acceptable.
 
171GB? I can't imagine what really Windows specific can occupy such space.

Maybe I'm trying to do something which can't be done... I have a Windows system which has numerous apps installed. Office, Photoshop, Chrome. Currently the partition takes up 171GB after shrinking the partition to the max, although Windows still reports 52GB free. I was hoping to migrate this to Virtual Box, but maybe this isn't viable.

When creating the virtual disk partition what partition type should it be?
 
My goodness, man! A little bit off-topic wisdom, if you can put up with this :) I've done this trick so many times before -- I mean copy/restore Windows partition to another disk/computer.
Theoretically, it all can be done. I've done that before: converting etc. Migrated the existing installation to VMplayer -- yes, I did it.
But don't you forget that for Windows THIS will be like taking your HDD and inserting into a completely different MACHINE. There are big chances it won't boot at all... So, in the end of it, I felt like the time I spent fiddling with it wasn't worth the result.

Now won't it be easier to do fresh install and reinstall all your apps, given you have the licenses for all of them safe somewhere... Really, OS Windows makes it all SO complicated! With Linux/FreeBSD you just put your HDD in there and -- voila! But not in Windows :(.

On the other hand, with fresh install you can just call the number and re-register your product. I did it recently with Win 10 Pro under bhyve -- no problem at all.
 
Maybe I'm trying to do something which can't be done... I have a Windows system which has numerous apps installed. Office, Photoshop, Chrome. Currently the partition takes up 171GB after shrinking the partition to the max, although Windows still reports 52GB free. I was hoping to migrate this to Virtual Box, but maybe this isn't viable.
Now that you're mentioning it, you could use the Disk Cleaner tool to clean up updates and other stuff. BEFORE the migration, that is.
Alternatively, you can copy your user data over to some medium and delete your user before migrating. Those user directories are where most junk gets collected. I could bet you would recover some 50G by that.
 
Back
Top