I have a file called BaseSystem.dmg
which contains a hfs+ system image as well as other files.
flex@flex-ubuntu:~/Documents/MacOS2$ 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)
I am trying to extract just the hfs+ system image file using 7z
from the p7zip-full
package. I have tried in both Windows 10 and in Ubuntu.
I have tried all these commands and others too...
7z x BaseSystem.dmg
7z e BaseSystem.dmg
7z x BaseSystem.dmg 4.hfs
Instead of extracting just the 4.hfs file I either get nothing or 7z goes straight to extracting all files and folders in BaseSystem.dmg.
I get the same result when I use 7-Zip 19.00 (32 bit or 64 bit) on Windows
and also when I use 16.02 (64 bit) on Ubuntu
.
I know that this is possible because Boot Disk Utility uses 7-Zip 19.00 (32 bit)
and IS able to extract 4.hfs from BaseSystem.dmg. However I don't know what parameters it uses.
I actually also downloaded 7-Zip 19.00 (32 ) separately for my Windows OS and again when I run it myself it does not extract just the 4.hfs file. Instead it extracts ALL files and folders.
So it must be something about what 7z parameters I am using that are not the same as what parameters the "Boot Disk Utility" program uses?
I am able to use dmg2img
like this and it works...
dmg2img -p 4 -i BaseSystem.dmg -o 4.hfs
But my question is about how do I use the 7z command
to extract just the 4.hfs file from BaseSystem.dmg? I wish I could see what parameters tha Boot Disk program uses? But it just opens a command window when it runs.. here are the first few lines I get..
7-Zip 19.00 (x86) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21
Scanning the drive for archives:
1 file, 498625205 bytes (476 MiB)
Extracting archive: C:\Users\flex\Downloads\BaseSystem.dmg
--
Path = C:\Users\flex\Downloads\BaseSystem.dmg
Type = Dmg
Physical Size = 498625205
Method = Copy Zero2 ZLIB CRC
Blocks = 594
Would you like to replace the existing file:
Path: C:\Users\flex\Downloads\4.hfs
Size: 2004299776 bytes (1912 MiB)
Modified: 2021-05-23 20:13:50
with the file from archive:
Path: 4.hfs
Size: 2004299776 bytes (1912 MiB)
? (Y)es / (N)o / (A)lways / (S)kip all / A(u)to rename all / (Q)uit?
In the above example the 4.hfs
file was already created from a previous run of the Boot Utility program but I just wanted to show that it does try to extract just the 4.hfs
file. It doesn't proceed directly to extracting all files and folders in BaseSystem.dmg. So this should be possible to do with 7z?