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
Tips to Solve Linux & Unix Systems Hard Disk Problems
Viewed 5038 times since Fri, May 15, 2020
Understanding System auditing with auditd
Viewed 12324 times since Fri, Apr 5, 2019
OpenSSL: Check SSL Certificate Expiration Date and More
Viewed 8296 times since Mon, Feb 18, 2019
How to Clear RAM Memory Cache, Buffer and Swap Space on Linux
Viewed 4344 times since Mon, Nov 23, 2020
Top 20 OpenSSH Server Best Security Practices ssh linux aix
Viewed 7185 times since Fri, May 15, 2020
red hat 7 tmpfiles service
Viewed 2544 times since Thu, Oct 11, 2018
RHEL: Force system to prompt for password in Single User mode
Viewed 8880 times since Sat, Jun 2, 2018
BIND for the Small LAN
Viewed 4276 times since Sun, May 20, 2018
How to use yum-cron to automatically update RHEL/CentOS Linux 6.x / 7.x
Viewed 6054 times since Tue, Dec 4, 2018
CentOS / RHEL : Configure yum automatic updates with yum-cron service
Viewed 4221 times since Fri, Oct 26, 2018