DMG to VDI

Discussions related to using VirtualBox on Mac OS X hosts.
Post Reply
tbg10101
Posts: 4
Joined: 31. Aug 2008, 08:06

DMG to VDI

Post by tbg10101 »

Does anyone know a DMG to VDI converter?
stefan.becker
Volunteer
Posts: 7639
Joined: 7. Jun 2007, 21:53

Post by stefan.becker »

Have you tried "qemu-img" from the qemu-Packages?

That can convert to raw Image or vmdk.

vmdk is readable in VBOX. Both format can be converted to vdi with "VBoxManage convert ...".
amagine
Volunteer
Posts: 177
Joined: 28. Jul 2008, 19:52

Post by amagine »

Curious:

What is your DMG that you want converted to VDI?

What are your trying to do?

There are a lot of different options here native to Mac OS X depending on what your needs are.

You can just use:
VBoxManage convertdd yourdmgfile.dmg yournewvdiimage.vdi
This will convert the DMG to a VDI image although the file format will be HFS+ which is only readable to Mac, or using $MacDRIVE$ application from Windows OS.

However, IF you wish to simply READ this DMG file from a GUEST that has shared folder usage, you can MOUNT the DMG file in Mac OS X, then ADD this DMG file to your shared folder and now READ in your GUEST.

However, IF you wish to CREATE another SLAVE harddrive (VDI) for your GUEST system you will need to CONVERT your HFS+ DMG file to a universally readable format NTFS.

You will need to install the MACFUSE framework, then install the NTFS-3G framework for mac. (It's incredibly handy to have these frameworks installed anyways and simply extends the capability of READING NTFS filesystems to also allowing WRITING of NTFS filesystems.)

Once the frameworks are installed (a logout may be needed... perhaps not?)

1. Open DiskUtility.app

2. Create New Blank Image
2.1 Select a Volume Size that you will want your VDI disk size to be
2.2 Select the Volume Format - Windows NT File System - NTFS-3G
2.3 Partitions: Master Boot Record
2.4 Read/Write disk image

3. Once the IMAGE is created, select it from DiskUtility and select RESTORE
3.1 SOURCE will be your original DMG file
3.2 DESTINATION will be your newly created IMAGE

4.0 You will now be able to convert the new IMAGE wth your original.DMG files to a VDI file using
VBoxManage convertdd yourdmgfile.dmg yournewvdiimage.vdi
tbg10101
Posts: 4
Joined: 31. Aug 2008, 08:06

Post by tbg10101 »

2.2 Select the Volume Format - Windows NT File System - NTFS-3G
that is what goes wrong. there are no more choices in the menu. The files are installed. I checked all the places they went.

Suggestions?
amagine
Volunteer
Posts: 177
Joined: 28. Jul 2008, 19:52

Post by amagine »

I understand from your response that you have installed MacFUSE and then mac NTFS-3G.

Try restarting OS X, it may take a restart for the frameworks.

FYI. I have gone through all these steps many times before, it does work fine. If anyone knows of a more direct way, I would love to know... I suppose I could create a shell script to do this... hmmm...
tbg10101
Posts: 4
Joined: 31. Aug 2008, 08:06

Post by tbg10101 »

i did restart
amagine
Volunteer
Posts: 177
Joined: 28. Jul 2008, 19:52

Post by amagine »

So you Installed MacFUSE then Installed mac NTFS-3G, RESTARTED and you Can not Write to Windows NT FileSystem.

Interesting. I would suggest then you will have to Debug this issue with MacFUSE and mac NTFS-3G groups to find out what is wrong with your OS X system.

ie.

Image

and

Image

Just to help illustrate.

From the NTFS-3G User Guide:
3.2 Creating NTFS file systems
NTFS-3G is fairly integrated with the operating system's utilities, such as the Graphical “Disk
Utility” and the command line version diskutil. Disk Utility in Mac OS X 10.4 (Tiger) will not list
third party file systems when it comes to creation and formatting, but it works in Mac OS X 10.5
(Leopard). The command line utility diskutil works with third party file systems in both OS X
versions though.
Are you using OS X.5 or OS X.4?

If you are using 10.4 then you will need to go to the Terminal.app and use hdiutil for example:

Code: Select all

yourshell$ hdiutil create -size 10M -fs NTFS-3G imagename.dmg
Will create a 10MB read/write NTFS image

We really do not have a lot to go on here except that you use Mac OS X (intel inferred since on the VBox forum) and you wish to convert a DMG image to a VDI image.

I have used Q (Qemu for Mac) and it works in a round-a-bout way also.

Maybe you need to start shaking a rubber chicken at your Mac.. I find that helps sometimes ;-)
tbg10101
Posts: 4
Joined: 31. Aug 2008, 08:06

Post by tbg10101 »

Ya, srry. 10.4.11. I have a different computer with 10.5 so I'll use that.

How do I do this:

Code: Select all

VBoxManage convertdd yourdmgfile.dmg yournewvdiimage.vdi
Srry, in a real noob at this.

Thx.
amagine
Volunteer
Posts: 177
Joined: 28. Jul 2008, 19:52

Post by amagine »

Okay, no problem. It is not quite as mysterious as it all seems.

To use VBoxManage and other shell commands from the Terminal.app you will need to somehow tell the shell where to look for commands.

There are default areas of your Mac OS X file system that are used to "hold" commands. For instance /bin and /usr/Bin. These "folders" are placed in your PATH so that when you run Terminal.app and you type in a command, your SHELL knows where to look for these COMMANDS.

Either you can ADD the VirtualBox COMMANDS to your PATH, (which would break if you ever moved VirtualBox.) Or you can do it the lazy OS X way:

1. Go to your VirtualBox.app
2. Right Click - choose Show Package Contents from context menu
3. Navigate to the MacOS folder
4. Drag the VBoxManage command to your Terminal.app window
5. add convertdd
6. drag yourdmgfile.dmg to the Terminal.app
7. then type in the name of the VDI image you wish to create: yourvdiimage.vdi (add the .vdi)
8. The VDI image will be created in your HOME folder, move it to where you feel would be good... HOME/Library/VirtualBox/VDI would be a good place.

try that. Typing in a hurry, so forgive if there are mistakes, must go play with my kids...

cheers
grahamperrin
Posts: 57
Joined: 27. Apr 2008, 15:19

virtual disk image of a device, with or without a .dmg

Post by grahamperrin »

With a .dmg

Whether the resulting .vdi will be usable may depend on the content of the .dmg.

If the format of the .dmg was entire device, then VBoxManage convertfromraw should produce a usable virtual disk image.

Without a .dmg

It's possible to produce a .vdi from a device (from a physical disk, or a slice of a disk) without an intermediary .dmg.

10.7.x or 10.8 (Build 12A269) in VirtualBox includes, as an example:

Code: Select all

sudo cat /dev/disk4 | VBoxManage convertfromraw stdin ~/Documents/Mountain\ Lion\ template.vdi 15879634944
– where slices of /dev/disk4 included an OS X startup volume.

For this topic – which seems to involve imaging a volume where Windows is installed – you might instead image just one slice of a disk.
Post Reply