linux下使用苹果dmg格式文件
参考红帽官网:http://www.cn.redhat.com/kbase/0708/5667.php
安装环境:
Download dmgmounter
http://sourceforge.net/projects/dmgmount/files/dmgmount/dmgmounter-0.1/dmgmounter-0.1.tar.gz/download
版本:CentOS 5.4
# uname -r
2.6.18-128.el5
详细步骤:
# ll -d 'Squid Manager 1.2.dmg'
-rwxrwxrwx 1 root root 403641 Jan 26 2003 Squid Manager 1.2.dmg
# file 'Squid Manager 1.2.dmg' =================此处和官网上描述的不一致
Squid Manager 1.2.dmg: VAX COFF executable not stripped - version 2274
我们先按照官网的试一下:
# mount -t hfsplus -o loop 'Squid Manager 1.2.dmg' /mnt
mount: wrong fs type, bad option, bad superblock on /dev/loop1,
missing codepage or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
根据提示我们尝试dmesg 和tail两个命令,出现下面结果:
# tail 'Squid Manager 1.2.dmg'
<key>Name</key>
<string></string>
</dict>
</array>
</dict>
</dict>
</plist>
ld[1]\mish[1] ..
`de.锌?憷V?V?.杩?阈.????? [1]?沭20
de.Qx??V?e.锌??g[1]?[1]????[1][1][1]PMSingle VolumeApple_HFS ???? ldhFblkxplst?P??P[1]`Single Volume (Apple~S : 0??[1]0??�
..[1] /~?q`[1]|[1]|.锌?嗬r???%@.`.?嗬..\.锌?嗬$B.X?淅~k[1] ?.[root@song ~]# XshellXshellXshellXshellXshellXshellXshellXshellXshellXshell
-bash: XshellXshellXshellXshellXshellXshellXshellXshellXshellXshell: command not found
# dmesg 'Squid Manager 1.2.dmg'
: : :
eth1: link up
eth1: no IPv6 routers present
eth1: link down
eth1: link up
hfs: unable to find HFS+ superblock
hfs: can't find a HFS filesystem on dev loop0.
hfs: unable to find HFS+ superblock
hfs: unable to find HFS+ superblock
hfs: unable to find HFS+ superblock
hfs: unable to find HFS+ superblock
hfs: can't find a HFS filesystem on dev loop1.
Google后得知须下载一个额外的挂载脚本:
下载
http://sourceforge.net/projects/dmgmount/files/dmgmount/dmgmounter-0.1/dmgmounter-0.1.tar.gz/download
解压缩
# tar -zxvf dmgmounter-0.1.tar.gz �CC /root/dmgmounter
执行如下命令:
# /root/dmgmounter/dmg2img/dmg2img /root/Squid\ Manager\ 1.2.dmg /mnt/my.img
dmg2img v0.3a is derived from dmg2iso by vu1tur ([email protected])
/root/Squid Manager 1.2.dmg --> /mnt/my.img
reading property list, 3947 bytes from address 396670 ...
decompressing:
opening partition 0 ... 99.97 % ok
opening partition 1 ... ok
Archive successfully decompressed as /mnt/my.img
Linux users should be able to mount the archive [as root] by :
modprobe hfsplus
mount -t hfsplus -o loop /mnt/my.img /mnt
# modprobe hfsplus
# lsmod | grep hfsplus
hfsplus 75589 0
# mount -t hfsplus -o loop /mnt/my.img /media
mount: wrong fs type, bad option, bad superblock on /dev/loop1,
missing codepage or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
Google后,网上有的说kernel需要时2.6.15版本以上,但是我们还是出现问题了。在网上查了很久也没有线索。其实我们仔细观察的话,我们会发现在dmesg命令报错时,我专门把末尾的内容贴出来了,我们会发现,系统提示说dmg文件本来就是hfs格式的。
hfs: unable to find HFS+ superblock
hfs: can't find a HFS filesystem on dev loop0.
hfs: unable to find HFS+ superblock
hfs: unable to find HFS+ superblock
hfs: unable to find HFS+ superblock
hfs: unable to find HFS+ superblock
hfs: can't find a HFS filesystem on dev loop1.
我也不知道我分析的对不。如果有高手知道有其他的原因的话,请多指点。
我们用一下的命令试试:
# mount -t hfs -o loop /mnt/my.img /media
# cd /media/
# ll
total 4
-rw-r--r-- 1 root root 1024 Dec 12 2002 Desktop DB
-rw-r--r-- 1 root root 2 Dec 12 2002 Desktop DF
-rw-r--r-- 1 root root 2354 Jan 23 2003 Licence Agreement.rtf
drwxr-xr-x 1 root root 16 Jan 23 2003 Read Me.rtfd
drwxr-xr-x 1 root root 3 Jan 25 2003 Squid Manager.app
ok