dump 混合光盘镜像中的 ISO 9660 分区

Leopard / Snow Leopard 光盘镜像是混合 (hybrid) 分区格式,也就是一个磁盘镜像中,既有 HFS+ 分区,也有 ISO 9660 分区 (Boot Camp 驱动就存放在这个分区上),在 Mac OS X 上只会挂载前者,在 Windows 下只会挂载后者。虽然可以在 Terminal 下手工挂载后者,但也不是很方便,这里记录一个脚本,方便直接把 ISO 9660 分区 dump 为 ISO 文件:

$ cat dump.sh
#!/usr/bin/env bash
DISK=`hdiutil attach -noverify $1 | awk '/Apple_partition_scheme/ { print $1 }'`
dd if=$DISK of=$2 bs=512 count=`hdiutil pmap $DISK | awk '/WINDOWSSUPPORT/ { print $6 }'`
hdiutil detach $DISK

使用方法:

$ ./dump.sh snowleopard_10a354_userdvd.dmg bc.iso

Author: jjgod

A software engineer from China, working on text rendering for a fruit company. Interested in typography and science fiction.

Leave a Reply

Your email address will not be published. Required fields are marked *