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
List DNS records, nameservers of a domain from command line
Viewed 2874 times since Sun, Sep 30, 2018
Netcat shell zabezpieczony hasłem
Viewed 3086 times since Thu, May 24, 2018
Setting up encrypted tunnel using stunnel
Viewed 3568 times since Fri, Sep 28, 2018
CentOS / RHEL : How to move a Volume Group from one system to another
Viewed 5837 times since Mon, Jan 28, 2019
LVM: Recovering Physical Volume Metadata
Viewed 14360 times since Sat, Jun 2, 2018
Top 25 Best Linux Performance Monitoring and Debugging Tools
Viewed 8418 times since Sun, Sep 30, 2018
20 IPtables Examples For New SysAdmins
Viewed 3190 times since Fri, May 15, 2020
Fix rpmdb: Thread died in Berkeley DB library
Viewed 22357 times since Fri, Feb 14, 2020
Tip: SSD and Linux. Enable TRIM and check if it works
Viewed 18826 times since Fri, May 15, 2020
What is yum-cron ?
Viewed 3613 times since Fri, Oct 26, 2018