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
LUKS dm-crypt/Device encryption GUIDE
Viewed 3018 times since Fri, Jul 13, 2018
Procedura powiekszania OCFS2 online
Viewed 6009 times since Fri, Jun 8, 2018
stunnel How To Set Up an SSL Tunnel Using Stunnel on Ubuntu
Viewed 2439 times since Sun, Dec 6, 2020
stunnel Howto A Guide to create SSL access to a HTTP-only webserver with stunnel
Viewed 3336 times since Fri, Sep 28, 2018
Sample logrotate configuration and troubleshooting part 2
Viewed 10282 times since Fri, Nov 30, 2018
Linux Chage Command to Set Password Aging for User
Viewed 3168 times since Tue, Sep 11, 2018
sed Delete / Remove ^M Carriage Return (Line Feed / CRLF) on Linux or Unix
Viewed 11538 times since Thu, Feb 7, 2019
YUM How to use yum command on CentOS/RHEL
Viewed 8013 times since Thu, Oct 25, 2018
Kernel sysctl configuration file for Linux
Viewed 6041 times since Fri, Aug 3, 2018
debian How to Upgrade Debian 8 Jessie to Debian 9 Stretch
Viewed 2976 times since Sun, Sep 23, 2018