PWSHub News

Create a VirtualBox Virtual machine from .img disk image

Do you have an .img disk file? Here’s how you can create a virtual machine in VirtualBox using img file.

So, here’s what happened. The other day, while I was trying the distribution review for EasyOS, I faced a little trouble converting its default img installer file to iso. I did manage to convert the img to iso using the dd command (below).

dd if=easy-5.7-amd64.img of=easy-5.7-amd64.iso bs=512B conv=sync,noerror

But unfortunately, VirtualBox couldn’t recognize the boot sector, which is part of the default img file.

So, the only option left is to convert it to the native VirtualBox virtual machine image format, vdi.

Convert img to vdi for VirtualBox

If you have an img file and want to convert it to the default vdi image format of VirtualBox, use the following command. Not to mention that you need to have Virtualbox installed for it to work.

VBoxManage convertfromraw your-img-file-name.img target-file-name.vdi
Converting the img file to vdi

After creating the vdi file, open VirtualBox and don’t select any ISO file and hit next in the first window. On the disk setup window, select the vdi file which you created under the option “Use an existing virtual hard disk file”.

Follow the onscreen instructions.

If all goes well, you should be able to boot the vdi file created from the img file.

Virtualbox – create virtual machine 1
VirtualBox – create virtual machine 2

Using the vdi file in KVM on virt-manager

The most interesting about the vdi file is it can also be used in virt-manager which uses KVM.

When you are creating a new machine in virt-manager, choose “Import existing disk image” in step 1. Then select the vdi image in the following screen, and you are good to go.

That’s it.

virt-manager create virtual machine
choose the vdi file
final screen in virt-manager
converted vdi file from img is booting in virt-manager

If this article helped you, do let me know in the comment box below.

Source: debugpoint.com

Related stories
2 weeks ago - A new release of EasyOS 5.7 is now available, I did a quick review of this version. EasyOS is an experimental and standalone distribution, pushing the boundaries with its unique concepts and features. The recently released EasyOS 5.7...
1 day ago - A fresh list of the best 50 Ubuntu apps of 2024 which caters to essentials, productivity, editing, gaming, development and more.
3 weeks ago - A simple guide which can help you to fix the VboxLinuxAdditions.run permission denied Error in Debian Linux. You typically encounter vboxlinuxadditions.run permission denied error in Debian Linux while trying to install VirtualBox Guest...
1 month ago - This tutorial walks you through the process of building a powerful reminder system with Laravel, WhatsApp, and Inertia.js. It empowers users to create appointments and set specific notification times,
Other stories
2 hours ago - Using voice memos to brainstorm ideas is quick, and easier than ever thanks to AI-powered apps. Here's how to get started.
2 hours ago - Mistral Medium only came out two months ago, and now it's followed by Mistral Large. Like Medium, this new model is currently only available via their API. It scores well …
2 hours ago - Have you started learning React, only to face bugs that made you contemplate a career in goat herding? Don't worry – we've all been there. In this guide, you'll join me on a quest through the quirky wonders of React. I'll help you...
2 hours ago - The Geolocation API is a standard API implemented in browsers to retrieve the location of the people who are interacting with a web application. This API enable users to send their location to a web application to enable relevant...
2 hours ago - Explore the intricacies of reading and writing files in various formats, handling directories, mastering error-handling techniques, and harnessing the efficiency of streams for powerful, performance-boosting file operations.
2 hours ago - WordPress is a popular content management system (CMS) known for its flexibility and user-friendly interface. But its built-in editor is not ideal for collaborative editing. Many publishers who work with writers need collaborative writing...