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
Get UUID of Hard Disks [Update]
Viewed 2308 times since Tue, Jul 17, 2018
ZFS: Remove an existing zfs filesystem
Viewed 2210 times since Sun, Jun 3, 2018
How to automate SSH login with password? ssh autologin
Viewed 2814 times since Fri, Jun 8, 2018
RHCS6: Mirror/unmirror a GFS2 volume
Viewed 5353 times since Sun, Jun 3, 2018
Using renice and taskset to manage process priority and CPU affinity with Linux OEL 6.4
Viewed 3740 times since Mon, Feb 17, 2020
Top 20 OpenSSH Server Best Security Practices - good article
Viewed 10790 times since Mon, Oct 1, 2018
KONTO SFTP Z CHROOTEM Z UŻYCIEM OPENSSH-SERVER NA CENTOS/RHEL6
Viewed 1941 times since Fri, Nov 30, 2018
Linux LVM recovery
Viewed 17889 times since Wed, Jan 23, 2019
UUIDs and Linux: Everything you ever need to know [Update]
Viewed 5033 times since Tue, Jul 17, 2018
Set Up SSH Tunneling on a Linux / Unix / BSD Server To Bypass NAT
Viewed 11405 times since Fri, May 15, 2020