首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何从dmg文件中仅提取.hfs分区

如何从dmg文件中仅提取.hfs分区
EN

Ask Ubuntu用户
提问于 2021-05-23 23:30:57
回答 1查看 1.4K关注 0票数 0

我有一个macOS dmg文件。BaseSystem.dmg。它被压缩并包含各种hfs分区。

代码语言:javascript
复制
# file BaseSystem.dmg 
BaseSystem.dmg: zlib compressed data

What我想做,我只想解压4.hfs分区文件。但我不能。这在使用引导磁盘实用程序工具作为在此演示的Windows上是可能的。

Here就是我尝试过的如果我像这样使用dmg2img .

代码语言:javascript
复制
flex@flex-ubuntu:~/Documents/MacOS$ dmg2img BaseSystem.dmg 

dmg2img v1.6.7 (c) vu1tur (to@vu1tur.eu.org)

BaseSystem.dmg --> BaseSystem.img


decompressing:
opening partition 0 ...             100.00%  ok
opening partition 1 ...             100.00%  ok
opening partition 2 ...             100.00%  ok
opening partition 3 ...             100.00%  ok
opening partition 4 ...             100.00%  ok
opening partition 5 ...             100.00%  ok
opening partition 6 ...             100.00%  ok
opening partition 7 ...             100.00%  ok

Archive successfully decompressed as BaseSystem.img

如果我现在尝试挂载BaseSystem.img..

代码语言:javascript
复制
$ sudo mount -o loop -t hfsplus BaseSystem.img /mnt/macimage
mount: /mnt/macimage: wrong fs type, bad option, bad superblock on /dev/loop7, missing codepage or helper program, or other error.

这样该命令就不会挂载它。这个命令返回一个回送设备:# sudo losetup -P -f --show BaseSystem.img,我可以像这样挂载它:# sudo mount /dev/loop8p1 /mnt/macimage/

但是我想要的是只提取4.hfs分区文件?!

如果我看看BaseSystem.img的特性..。

代码语言:javascript
复制
# file BaseSystem.img
BaseSystem.img: DOS/MBR boot sector; partition 1 : ID=0xee, start-CHS (0x3ff,254,63), end-CHS (0x3ff,254,63), startsector 1, 4176871 sectors, extended partition table (last)

从Ubuntu终点站:# 7z l BaseSystem.dmg我得到..。

代码语言:javascript
复制
7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=en_GB.UTF-8,Utf16=on,HugeFiles=on,64 bits,8 CPUs Intel(R) Core(TM)

Scanning the drive for archives:
1 file, 498625205 bytes (476 MiB)

Listing archive: BaseSystem.dmg

--
Path = BaseSystem.dmg
Type = Dmg
Physical Size = 498625205
Method = Copy Zero2 ZLIB CRC
Blocks = 594
----
Path = 4.hfs
Size = 2004299776
Packed Size = 498579443
Comment = disk image (Apple_HFS : 4)
Method = Copy Zero2 ZLIB CRC
--
Path = 4.hfs
Type = HFS
Physical Size = 2004299776
Method = HFS+
Cluster Size = 4096
Free Space = 678445056
Created = 2020-10-30 08:13:26
Modified = 2020-10-30 16:31:38

我如何提取只是文件4.hfs

当我运行以下命令:# 7z x BaseSystem.dmg时,它会提取整个dmg文件,以给出dmg文件中所有文件的目录树。但是我只想从dmg文件中提取一个文件:4.hfs

如果我运行以下命令:7z x BaseSystem.dmg 4.hfs,我得到..。

代码语言:javascript
复制
7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=en_GB.UTF-8,Utf16=on,HugeFiles=on,64 bits,8 CPUs Intel(R) Core(TM)

Scanning the drive for archives:
1 file, 498625205 bytes (476 MiB)

Extracting archive: BaseSystem.dmg
--            
Path = BaseSystem.dmg
Type = Dmg
Physical Size = 498625205
Method = Copy Zero2 ZLIB CRC
Blocks = 594
----
Path = 4.hfs
Size = 2004299776
Packed Size = 498579443
Comment = disk image (Apple_HFS : 4)
Method = Copy Zero2 ZLIB CRC
--
Path = 4.hfs
Type = HFS
Physical Size = 2004299776
Method = HFS+
Cluster Size = 4096
Free Space = 678445056
Created = 2020-10-30 08:13:26
Modified = 2020-10-30 16:31:38


No files to process
Everything is Ok

Files: 0
Size:       0
Compressed: 498625205

但是,在我期望4.hfs出现的文件夹中没有输出。

我做错了什么?在Linux上可能不可能吗?

EN

回答 1

Ask Ubuntu用户

发布于 2021-06-04 16:56:10

我发现dmg2img7z都可以从dmg文件中只提取一个分区。

使用dmg2img,我们可以看到dmg文件的内容:

代码语言:javascript
复制
# dmg2img -l BaseSystem.dmg 

dmg2img v1.6.7 (c) vu1tur (to@vu1tur.eu.org)

BaseSystem.dmg --> (partition list)

partition 0: Protective Master Boot Record (MBR : 0)
partition 1: GPT Header (Primary GPT Header : 1)
partition 2: GPT Partition Data (Primary GPT Table : 2)
partition 3:  (Apple_Free : 3)
partition 4: disk image (Apple_HFS : 4)
partition 5:  (Apple_Free : 5)
partition 6: GPT Partition Data (Backup GPT Table : 6)
partition 7: GPT Header (Backup GPT Header : 7)

使用dmg2img v1.6.7

此命令提取4.hfs分区:

代码语言:javascript
复制
# dmg2img -p 4 -i BaseSystem.dmg -o 4.hfs

使用7z

在7-Zip9.20中,您可以使用以下命令:

代码语言:javascript
复制
7z e BaseSystem.dmg 4.hfs

在7-Zip16.02中,您需要使用以下命令:

代码语言:javascript
复制
7z e -t* BaseSystem.dmg 4.hfs

-t*是必需的,否则在这个版本的7z中,它不会提取到一个层次的深度,而是会将所有内容提取到文件和文件夹中。

票数 1
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1340250

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档