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
RHCS6: Install a two-node basic cluster
Viewed 3594 times since Sun, Jun 3, 2018
RHCS6: Quorum disk and heuristics
Viewed 4549 times since Sun, Jun 3, 2018
Epoch & Unix Timestamp Conversion Tools
Viewed 63371 times since Fri, Jun 22, 2018
HowTo: Retrieve Email from a POP3 Server using the Command Line
Viewed 11788 times since Mon, Feb 18, 2019
RHEL: Displaying/setting kernel parameters - ’sysctl’
Viewed 3209 times since Sat, Jun 2, 2018
Enabling automatic updates in Centos 7 and RHEL 7
Viewed 2649 times since Wed, Oct 17, 2018
ZPOOL: Detach a submirror from a mirrored zpool
Viewed 2886 times since Sun, Jun 3, 2018
LOGROTATE – ARCHIWIAZACJA LOGÓW
Viewed 2167 times since Fri, Nov 30, 2018
Telnet – Send GET/HEAD HTTP Request
Viewed 3558 times since Mon, Feb 18, 2019
Understanding logrotate utility part 1
Viewed 1913 times since Fri, Nov 30, 2018