---
title: "dmg转iso"
author: "vergilwang"
date: "2013-08-13T14:54:00Z"
tags: []
categories: ["非技术"]
slug: "dmg-iso"
draft: false
lastmod: "2014-02-15T12:24:17Z"
id: 2011125
url: "https://vergilwang.iteye.com/blog/2011125"
---

dmg格式是Mac系统下使用的文件,在Ubuntu下不能直接使用.

iso格式则是大多数Linux和Windows下常用的镜像文件格式.

为了方便在Ubuntu或者Windows下安装Mac虚拟机,需要转换个iso格式出来.

1\. 打开终端，安装dmg2img。sudo apt-get install dmg2img

2\. 将dmg格式转化为img格式. dmg2img /path/to/example.dmg /path/to/example.img

3\. 挂载img文件.

sudo mkdir /media/example

sudo modprobe hfsplus

sudo mount -t hfsplus -o loop example.img /media/example

这时候会遇到一个错误：

mount: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error In some cases useful info is found in syslog – try dmesg | tail or so

这时候用

/usr/sbin/sfdisk img\_Mac\_X\_Lion.img 来调整分区

各种回车，最后输入y即可.如图

[![](http://sonyfe25cp-wordpress.stor.sinaapp.com/uploads/2012/02/sfdisk-276x300.png "sfdisk")](http://sonyfe25cp-wordpress.stor.sinaapp.com/uploads/2012/02/sfdisk.png)

然后把这玩意再挂载到/media/mac上

 

4\. 用Brasero把img转换成iso格式. Brasero在 Applications -&gt;Sound & Video

5\. 翻刻一个iso就出来了

参考资料：

1.[http://hi.baidu.com/heutsnc/blog/item/777ac861f68ab25eeaf8f850.html](http://hi.baidu.com/heutsnc/blog/item/777ac861f68ab25eeaf8f850.html)

2.[http://webcache.googleusercontent.com/search?q=cache:-uQE6LHwnFcJ:wiki.aranym.org/afs/hd\_partition\_linux+unrecognized+partition+table+typeOld+situation&cd=2&hl=en&ct=clnk&gl=hk&client=ubuntu](http://webcache.googleusercontent.com/search?q=cache%3A-uQE6LHwnFcJ%3Awiki.aranym.org%2Fafs%2Fhd_partition_linux%20unrecognized%20partition%20table%20typeOld%20situation&cd=2&hl=en&ct=clnk&gl=hk&client=ubuntu)

3.[http://webcache.googleusercontent.com/search?q=cache:83pRiZ6MMKEJ:www.psibo.unibo.it/areait/partitions.html+bad+superblock+on+/dev/loop0&cd=1&hl=en&ct=clnk&gl=hk&client=ubuntu](http://webcache.googleusercontent.com/search?q=cache%3A83pRiZ6MMKEJ%3Awww.psibo.unibo.it%2Fareait%2Fpartitions.html%20bad%20superblock%20on%20%2Fdev%2Floop0&cd=1&hl=en&ct=clnk&gl=hk&client=ubuntu)

 

 

分类:[Linux](http://www.cnblogs.com/li-baibo/category/428804.html)