How to convert RAW image to VDI and otherwise

VirtualBox command-line interface (VBoxManage) provides an easy way to convert raw disk image to the VDI/VMDK format and otherwise.

Let's assume that we have raw image of the sdb device:

$ sudo dd if=/dev/sdb of=./sdb.raw

To use it with VirtualBox we need to convert it to the VDI format:

$ VBoxManage convertdd sdb.raw sdb.vdi --format VDI

To use it with VMware we need to convert it to the VMDK format:

$ VBoxManage convertdd sdb.raw sdb.vmdk --format VMDK

Convert between VDI/VMDK formats:

$ VBoxManage clonehd sdb.vdi sdb.vmdk --format VMDK
$ VBoxManage clonehd sdb.vmdk sdb.vdi --format VDI

Convert to the RAW image:

$ VBoxManage clonehd sdb.vdi sdb.raw --format RAW

Alternative solution to get back raw image after applying modifications is to use qemu-img command from qemu package:

$ qemu-img convert -f vmdk sdb.vmdk -O raw sdb.raw

Now we can write image to the device:

$ sudo dd if=./sdb.raw of=/dev/sdb
0 (0)
Article Rating (No Votes)
Rate this article
Attachments
There are no attachments for this article.
Comments
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
How to Migrate from RHEL 8 to CentOS 8
Viewed 3259 times since Fri, May 15, 2020
RHEL: Retrieve and generate a unique SCSI identifier
Viewed 3302 times since Sat, Jun 2, 2018
Do you Know These 5 Use of V$session View ?
Viewed 114556 times since Thu, Jun 21, 2018
How to recover error - Audit error: dispatch err (pipe full) event lost
Viewed 26309 times since Tue, Aug 6, 2019
RHCS6: Debug and test multicast traffic between two hosts
Viewed 6875 times since Sun, Jun 3, 2018
LVM: Recovering Physical Volume Metadata
Viewed 13295 times since Sat, Jun 2, 2018
Watchdog script to keep an application running
Viewed 18915 times since Tue, Jul 31, 2018
How to use yum command on CentOS/RHEL
Viewed 11227 times since Wed, Oct 17, 2018
RHEL: Adding a boot entry to GRUB/GRUB2 configuration
Viewed 4892 times since Sun, May 27, 2018
How to encrypt a partition using LUKS?
Viewed 1992 times since Fri, Jul 13, 2018