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
SYS: Configure a local repository. local repo
Viewed 618 times since Mon, Oct 29, 2018
Linux – Securing your important files with XFS extendend attributes
Viewed 489 times since Wed, Jul 25, 2018
Increase A VMware Disk Size (VMDK) Formatted As Linux LVM without rebooting
Viewed 967 times since Wed, May 30, 2018
debian Install a newer kernel in Debian 9 (stretch) stable
Viewed 474 times since Sun, Sep 23, 2018
How To Ping Specific Port Number
Viewed 339 times since Mon, Jun 1, 2020
Epoch & Unix Timestamp Conversion Tools
Viewed 14051 times since Fri, Jun 22, 2018
RHCS: Configure an active/backup pacemaker cluster
Viewed 904 times since Sun, Jun 3, 2018
OpenSSL: Check SSL Certificate Expiration Date and More
Viewed 586 times since Mon, Feb 18, 2019
Linux - Cannot login from remote console but can access via ssh
Viewed 565 times since Fri, Jun 8, 2018
Need to set up yum repository for locally-mounted DVD on Red Hat Enterprise Linux 7
Viewed 774 times since Mon, Oct 29, 2018