Is it possible to do this so that the image is transferred over network connection to some other computer? Or is it even possible to resize the partition on the fly to get rid of unnecessary amount of free space?
When you use VMWare Converter you can tell it to save the image to a network drive or a USB drive or something. Sadly it will be as large as your windows partition is. You could always resize your Windows partition to be smaller and then create the VM (that's what I have done in the past).
There's a command line program to manage your virtualbox session. You can't just copy the image and use it. The utility can clone a disk image so you can reuse it under another virtual machine. It's in the help file. Search for 'clone'. You can then copy the file that contains the new cloned disk image anywhere you like.
There's a utility to zero out the unused portions of your disk. The side effect of using it on a virtual box machine is that the virtual disk image manager will shrink the image file size. Something like this one
There's a documented "internal" function that you might be interested in. You can create a "raw disk" image which basically passes all commands to the partition on your hard drive. That way, you can keep your Windows partition and attempt to boot it from VirtualBox as well.
As Matt said, you use the VBoxManage command, and that Windows might not like it. However, there's a faster way that doesn't use up as much disk space. You can use stdin as the input for the convertraw command (which, if you read Matt's answer, is the same as the convertdd command:
Note that I have not tried this myself, and that I believe you might need to use /dev/sda instead of /dev/sda2, assuming you won't be writing to the drive that Windows is on. That way, you capture the partition table and bootloader.
I was just trying to do nearly the exact same thing, albeit from Ubuntu. I didn't want to create an image of the entire hard drive, and it didn't seem like a good idea to me to use the physical disk with the VM. I finally found the solution:
If desired, shrink the windows partition so the image size will be smaller. I prefer to do this from Linux using GParted (to avoid "umovable" files that are in use), then reboot to Windows, let it do a chkdsk, and reboot back into Linux.
I am trying to convert several VMware images towards Virtualbox images. I have succesfully been able to convert my Windows Server 2003 image, but I haven't been able to convert any Windows Server 2008 image.
One solution involves creating a new image giving the previous .vmdk as hard disk. When I try to startup the image, I get a blue screen during booting. (I also tried to delete VMware tools before importing the image, which didn't work).
The HDD types need to match. If you were using SCSI on VMware you need to be using SCSI in VirtualBox. In rare occasions you actually need to experiment a bit with disk types (ie a SCSI VMware disk will work properly only on SATA controler in VirtualBox, go figure).
Another thing that causes instability and bootup problems are IO APIC and PAE/Nx settings under System. Experiment with those. It can take couple of boots till you get it right but so far I've never had a physical (or virtual) machine I couldn't get onto VirtualBox using VMware tools.
Copy the virtual disk image files (vmdk) into the newly created VirtualBox VM folder. If you want, you can rename the disk files. I did that at this point, because, I wanted to have the disk type (C and D) reflected in the file name.
Then, I did choose to add a hard disk, and selected choose existing disk and selected the .vmdk file representing the first disk of the VM. Because, I had two disks, I did repeat this step once for the second disk. You also need to pay attention which on is disk 1 and which one is disk 2. If the OS is on disk 2, the VM will not boot.
Uninstall VMWare tools when booted in VMWare workstation (I didn't do this on first attempt and I had problems with some services not starting and I was unable to remove VMWare tools when booted under Virtual Box)
Combined vmdk file into 1 file (as vmdk had been created with default of split into files of no more than 2GB). You can use vmware-vdiskmanager for this but I was running out of space on vmdk so I created a new bigger vmdk in VMWare workstation, then booted virtual machine using a Linux Live CD (I used Ubuntu 12.04) and did a dd from old disk to new disk and then I extended partition using gparted (on Linux Live CD) into the unused part of the bigger vmdk.
Installed virtualbox additions - this resolved base system device driver which had a question mark in Device Manager and installed video driver which allows any resolution video screen which changes as you resize window.
The packer template you are using is going to be what determins if windows can boot and complete setup without interaction. There should be a autounattend.xml file that will need to match the settings for the windows iso you have.
Hi, yes I did test for that also.
I was able to manually browse and see the disk and the CD is recognised even without specifying "hard_drive_interface": "sata", or "iso_interface": "sata" like the online Packer docs recommend:
image1437900 119 KB
As you manually browse through the OOBE interface, do you see all your devices, such as hard drives? When the hypervisor is switched to EFI mode.The OS will be presented with a different view of the hardware devices.
I use VirtualBox frequently to create virtual machines for testing new versions of Fedora, new application programs, and lots of administrative tools like Ansible. I have even used VirtualBox to test the creation of a Windows guest host.
Never have I ever used Windows as my primary operating system on any of my personal computers or even in a VM to perform some obscure task that cannot be done with Linux. I do, however, volunteer for an organization that uses one financial program that requires Windows. This program runs on the office manager's computer on Windows 10 Pro, which came preinstalled.
This financial application is not special, and a better Linux program could easily replace it, but I've found that many accountants and treasurers are extremely reluctant to make changes, so I've not yet been able to convince those in our organization to migrate.
This set of circumstances, along with a recent security scare, made it highly desirable to convert the host running Windows to Fedora and to run Windows and the accounting program in a VM on that host.
The physical computer already had a 240GB NVMe m.2 storage device installed in the only available m.2 slot on the motherboard. I decided to install a new SATA SSD in the host and use the existing SSD with Windows on it as the storage device for the Windows VM. Kingston has an excellent overview of various SSD devices, form factors, and interfaces on its web site.
That approach meant that I wouldn't need to do a completely new installation of Windows or any of the existing application software. It also meant that the office manager who works at this computer would use Linux for all normal activities such as email, web access, document and spreadsheet creation with LibreOffice. This approach increases the host's security profile. The only time that the Windows VM would be used is to run the accounting program.
Before I did anything else, I created a backup ISO image of the entire NVMe storage device. I made a partition on a 500GB external USB storage drive, created an ext4 filesystem on it, and then mounted that partition on /mnt. I used the dd command to create the image.
I installed the new 500GB SATA SSD in the host and installed the Fedora 32 Xfce spin on it from a Live USB. At the initial reboot after installation, both the Linux and Windows drives were available on the GRUB2 boot menu. At this point, the host could be dual-booted between Linux and Windows.
Now I needed some information on creating a VM that uses a physical hard drive or SSD as its storage device. I quickly discovered a lot of information about how to do this in the VirtualBox documentation and the internet in general. Although the VirtualBox documentation helped me to get started, it is not complete, leaving out some critical information. Most of the other information I found on the internet is also quite incomplete.
First, I installed the most recent version of VirtualBox on the Linux host. VirtualBox can be installed from many distributions' software repositories, directly from the Oracle VirtualBox repository, or by downloading the desired package file from the VirtualBox web site and installing locally. I chose to download the AMD64 version, which is actually an installer and not a package. I use this version to circumvent a problem that is not related to this particular project.
The installation procedure always creates a vboxusers group in /etc/group. I added the users intended to run this VM to the vboxusers and disk groups in /etc/group. It is important to add the same users to the disk group because VirtualBox runs as the user who launched it and also requires direct access to the /dev/sdx device special file to work in this scenario. Adding users to the disk group provides that level of access, which they would not otherwise have.
I then created a directory to store the VMs and gave it ownership of root.vboxusers and 775 permissions. I used /vms for the directory, but it could be anything you want. By default, VirtualBox creates new virtual machines in a subdirectory of the user creating the VM. That would make it impossible to share access to the VM among multiple users without creating a massive security vulnerability. Placing the VM directory in an accessible location allows sharing the VMs.
I created the VM without a virtual disk. The Type should be Windows, and the Version should be set to Windows 10 64-bit. Set a reasonable amount of RAM for the VM, but this can be changed later so long as the VM is off. On the Hard disk page of the installation, I chose the "Do not add a virtual hard disk" and clicked on Create. The new VM appeared in the VirtualBox Manager window. This procedure also created the /vms/Test1 directory.
d3342ee215