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
tcpdump usage examples
Viewed 1083 times since Fri, Jul 27, 2018
RHEL7: Create and configure LUKS-encrypted partitions and logical volumes to prompt for password and mount a decrypted file system at boot.
Viewed 4200 times since Mon, Aug 6, 2018
Extending Linux LVM partitions - scripts
Viewed 4187 times since Sun, May 20, 2018
Inxi: Find System And Hardware Information On Linux
Viewed 1235 times since Sat, Jun 2, 2018
linux unix aix banner /etc/issue
Viewed 885 times since Fri, Aug 3, 2018
SSH ProxyCommand example: Going through one host to reach another server
Viewed 10007 times since Tue, Aug 6, 2019
HowTo: Kill TCP Connections in CLOSE_WAIT State
Viewed 6567 times since Thu, Feb 14, 2019
How to accurately determine when the system was booted
Viewed 1097 times since Wed, Oct 3, 2018
Red Hat Cluster Tutorial
Viewed 1134 times since Sun, Jun 3, 2018
zabbix linux How to solve apache error No space left on device: Cannot create SSLMutex
Viewed 357 times since Wed, Nov 11, 2020