Linux img to vmdk

How To Convert A Linux Disk Or Image File To VMDK File

In this post I will show you how to convert a Linux disk or raw image file to a VMDK file so you can create a VMWare Workstation virtual machine from it. The basic steps are creating a raw image file of the physical disk using dd and converting the raw image file to a VMware disk/vmdk file. I was using Windows to do this but I’ll mention some Linux instructions as well.

Why this scenario

For on-line Linux machines you can use vCenter Converter to create a virtual machine the catch is it only supports ESXi. In my case I had to create a virtual machine from a disk /off-line machine for VMware Workstation on a Windows machine. At the time I couldn’t find a free native Windows tool that would create a raw image of the Linux disk. Potentially you could use disk imaging software to clone the disk in a virtual machine but the free Windows ones I tried didn’t have the necessary drivers included in their boot environments for VMWare disk controllers.

Creating the raw image file

To run dd on Windows requires Cygwin, there are no additional settings or packages required. I just accepted all the defaults during installation. It is important to run Cygwin as administrator in Windows or you will get permission denied errors in Linux when you run dd. Once inside Cygwin run the following to identify your attached disks:

Читайте также:  Advanced system administration in linux

The device name of your disks will depend on the type and number of attached devices, in my case it was /dev/sdc (the third disk). You can read about Linux device naming here. I wanted to write the image file to my Windows D: drive which will be mounted as /cygdrive/d. Once you identified the source and destination you can run dd to create the image file.

dd if=/dev/sdc of=/cygdrive/d/diskimage.img

Note: I looked into using Windows Subsystem for Linux instead of Cygwin but from what I Googled WSL doesn’t have the ability to address block devices so dd won’t work.

Converting the raw image file to VMDK

I used Starwind V2V Converter to convert the raw img file to a VMDK file, it is free but you have to supply some personal details to get the download link. The app is easy enough to use so I won’t show all the steps here, just choose Local file for the source and Local file VMDK as the destination. Starwind V2V has the option to convert a physical disk to a VMDK file but it didn’t show my Linux disks as a source, only the Windows ones.

On Linux you can use Qemu to convert img files to VMDK and other virtual disk formats. You can also use Qemu to convert a physical disk directly to VMDK file without creating the raw image file first.

I looked into using Qemu in Cygwin instead of Starwind V2V Converter but at the time Qemu packages weren’t available for Cygwin but I guess you could compile it from source and install the dependencies if you really want to go that way.

Читайте также:  Linux fingerprint reader driver

Creating the VM

Once you have the VMDK file you can create a new Linux virtual machine in VMWare Workstation. Be sure to match the Linux distribution of your source machine. I was converting an Ubuntu machine and it booted successfully without any additional work.

LinuxVM

The final step is to install open-vm-tools for desktop or server.

#Desktop
sudo apt install open-vm-tools-desktop
#Server
sudo apt install open-vm-tools

I am a cloud and devops consultant, technology fan and previously a professional C# developer with a keen interest in system design and architecture. Currently I am involved in projects using Azure, the Microsoft stack and DevOps. I am based in Melbourne, Australia. Email: [email protected]

Источник

🛠️ Как преобразовать Linux dd образ img в .VDI, VMDK, VHD с помощью команды VIrtualBox

В этой статье мы расскажем о том, как конвертировать IMG файлы в формат VDI, VMDK, VHD для Oracle VirtualBox, Vmware и XenCenter.

Сначала нам нужно взять образ из системы Linux, и это займет некоторое время.

dd if=/dev/sda of=/mnt/run/media/filename.img bs=4M

Нажмите Выполнить -> cmd -> Enter

2. Обратите внимание, что Windows открывает окно DOS.

Затем перейдите к dd image drive.

3. Для этой работы необходимо установить Oracle Virtual box.

I:\>VBoxManage convertfromraw --format VDI sourcefile.dd filename.VDI
I:\>VBoxManage convertfromraw --format VMDK sourcefile.dd filename.VMDK
I:\>VBoxManage convertfromraw --format VHD sourcefile.dd filename.VHD

Нажмите Enter, чтобы начать преобразование.

Подождите около полутора минут, пока конвертирование будет происходить, а затем создайте новую виртуальную машину с файлом VDI.

Как преобразовать образ диска гостевой виртуальной машины VirtualBox из VMDK в VDI

Администратор VirtualBox хочет перенести формат образа диска существующей импортированной гостевой ВМ из VMDK в собственный формат файлов VirtualBox, например VDI.

VirtualBox обеспечивает поддержку преобразования файлов образов дисков с помощью команды “VBoxManage clonemedium”.

Как всегда, административной “лучшей практикой” считается сохранение критически важных компонентов в архиве резервных копий перед выполнением инвазивных административных действий такого рода.

Читайте также:  Линукс сервер локальной сети

Пример синтаксиса команды для этой операции в VirtualBox 6.0:

# VBoxManage clonemedium disk [inputfile] [outputfile] --format VDI

Примечание: Более ранние версии VirtualBox предоставляли аналогичную функциональность с помощью команд clonevdi и clonehd.

Источник

How to convert Linux dd .img to .VDI, VMDK, VHD with VIrtualBox Command

In this post, we will discuss about how to convert IMG Files to VDI, VMDK, VHD format for Oracle VirtualBox, Vmware and XenCenter. First We have to take Image from Linux System and It will take some time.

take image from linux system

1. Open the windows cmd. Click Run -> cmd -> Enter

2. Notice that Windows open a DOS window. Then go to dd image drive.

windows dos dd image drive

3. Oracle Virtual box should be installed for this activity.

install oracle virtualbox

I:\>VBoxManage convertfromraw --format VDI sourcefile.dd filename.VDI
I:\>VBoxManage convertfromraw --format VMDK sourcefile.dd filename.VMDK
I:\>VBoxManage convertfromraw --format VHD sourcefile.dd filename.VHD

convert Linux dd .img to .VDI,VMDK,VHD

Press Enter to start the conversion. Wait about serveral minute or so while the conversion takes place, and then create the new virtual machine with the VDI file.

How to Convert a VirtualBox Guest’s Disk Image from VMDK to VDI

A VirtualBox Administrator would like to migrate the underlying disk image format of an existing, imported Guest VM from VMDK to a VirtualBox native file format, such as VDI. VirtualBox provides support for disk-image file conversions using the “VBoxManage clonemedium” command.

As always, it is considered an Administrative “Best Practice” that critical components are preserved within a back-up archive prior to performing invasive administrative actions of this kind. An example command syntax for this operation within VirtualBox 6.0:

# VBoxManage clonemedium disk [inputfile] [outputfile] --format VDI

Note: Earlier versions of VirtualBox provided similiar functionality, via the clonevdi and clonehd commands.

Источник

Оцените статью
Adblock
detector