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 –C /root/dmgmounter
執行如下命令:
# /root/dmgmounter/dmg2img/dmg2img /root/Squid\ Manager\ 1.2.dmg /mnt/my.img
dmg2img v0.3a is derived from dmg2iso by vu1tur (to@vu1tur.eu.org)
/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
[火星人 ] linux下使用蘋果dmg格式文件已經有1139次圍觀