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
linux ssh Remotely Initiated Reverse SSH Tunnel
Viewed 4556 times since Wed, Apr 22, 2020
Linux nslookup Command Examples for DNS Lookup
Viewed 10287 times since Sat, Sep 29, 2018
Red Hat ADDING SWAP SPACE
Viewed 3051 times since Fri, Jun 8, 2018
Fake A Hollywood Hacker Screen in Linux Terminal linux FUN
Viewed 8245 times since Thu, Apr 18, 2019
6 easy steps to setup offline two factor authentication in Linux
Viewed 15576 times since Mon, Apr 6, 2020
RHEL: Building a custom kernel on RHEL 6
Viewed 5471 times since Sat, Jun 2, 2018
10 Linux DIG Command Examples for DNS Lookup
Viewed 12179 times since Sun, Sep 30, 2018
RHEL: Create a local RPM repository
Viewed 12668 times since Sun, May 27, 2018
Installing and Configuring stunnel on CentOS 6
Viewed 5095 times since Fri, Sep 28, 2018
How To Create a Linux Swap File
Viewed 3602 times since Fri, Jun 8, 2018