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
There are no attachments for this article.
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
How To Run Multiple SSH Command On Remote Machine And Exit Safely
Viewed 1927 times since Tue, Aug 6, 2019
VMWare tools free
Viewed 7385 times since Mon, Jul 16, 2018
HowTo: Send Email from an SMTP Server using the Command Line
Viewed 1064 times since Mon, Feb 18, 2019
Linux - How to get CPU information
Viewed 1129 times since Fri, Jun 8, 2018
RHCS6: Quorum disk and heuristics
Viewed 3108 times since Sun, Jun 3, 2018
Linux – How to check the exit status of several piped commands
Viewed 2134 times since Wed, Jul 25, 2018
Create a Linux Swap File
Viewed 2209 times since Fri, Jun 8, 2018
sed Delete / Remove ^M Carriage Return (Line Feed / CRLF) on Linux or Unix
Viewed 8593 times since Thu, Feb 7, 2019
How to schedule crontab in Unix Operating Systems
Viewed 1195 times since Fri, Jun 8, 2018
linux ssh How to Hide the OpenSSH Version Details when Telnet to Port 22
Viewed 2360 times since Wed, Apr 22, 2020