-
Notifications
You must be signed in to change notification settings - Fork 2
/
research.txt
99 lines (68 loc) · 3.58 KB
/
research.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
////////
//////// APFS disk image research...
////////
hdiutil create -layout GPTSPUD -partitionType Apple_APFS -fs APFS -size 100m -type UDIF /Volumes/Test\ HD/test.dmg
hdiutil attach /Volumes/Test\ HD/test.dmg
/dev/disk26 GUID_partition_scheme
/dev/disk26s1 Apple_APFS
/dev/disk27 EF57347C-0000-11AA-AA11-0030654
/dev/disk27s1 41504653-0000-11AA-AA11-0030654 /Volumes/untitled
asr imagescan --source /Volumes/Test\ HD/test.dmg
=> OK
maybe restorable...
////////
//////// creating container image as device research...
////////
diskutil unmountDisk /dev/disk1
hdiutil create -layout GPTSPUD -partitionType Apple_APFS -srcdevice /dev/disk1 -format UDZO /Volumes/Test\ HD/container.dmg
is same as:
hdiutil create -layout GPTSPUD -partitionType Apple_APFS -srcdevice /dev/disk0s2 -format UDZO /Volumes/Test\ HD/container.dmg
hdiutil create -srcdevice /dev/disk1 -format UDZO /Volumes/Test\ HD/container.dmg
hdiutil create -srcdevice /dev/disk0s2 -format UDZO /Volumes/Test\ HD/container.dmg
asr imagescan --source /Volumes/Test\ HD/container.dmg
=> NG (internal error)
asr restore --source /Volumes/Test\ HD/container.dmg --target /dev/disk2 --erase
=> NG (has no container disk)
hdiutil attach /Volumes/Test\ HD/container.dmg
=> attached as diskXX
asr restore --source /dev/diskXX --target /dev/disk2 --erase
=> OK (however, apfs_invert command required)
########
"container image as device" contains meeningfull whole APFS container (including Preboot, Recovery, VM).
However, this type of image has no partition map information and volume title information.
So, "asr imagescan" and "asr restore" goes to fail.
We have to mount image first by "hdiutil attach", then use "asr restore" command.
When we do this process in booted by macos USB installer, "asr restore"'s last process will be fail.
Because last process is inverting APFS container process, but, macos USB installer has no apfs_invert command.
We need do this process in standard installed macos system or inject apfs_invert to macos USB installer's BaseSystem.dmg.
Restored APFS container has no VM volume, however don't be afraid.
It will be automatically created in next boot process.
### hint to next research...
It seems that overallocation problem (original container has) is fixed by inverting process.
However, rebooted by restored container and use it, that problem will revive.
////////
//////// creating container image as folder research...
////////
hdiutil create -srcfolder /dev/disk0s2 -format UDZO /Volumes/Test\ HD/folder.dmg
=> it makes HFS+ image
hdiutil create -layout GPTSPUD -partitionType Apple_APFS -srcfolder /dev/disk0s2 -format UDZO /Volumes/Test\ HD/folder.dmg
=> NG (no mountable file system)
hdiutil create -layout GPTSPUD -partitionType Apple_APFS -fs APFS -srcfolder /dev/disk0s2 -format UDZO /Volumes/Test\ HD/folder.dmg
=> OK
is same as:
hdiutil create -layout GPTSPUD -partitionType Apple_APFS -fs APFS -srcfolder /dev/disk1 -format UDZO /Volumes/Test\ HD/folder.dmg
########
"container image as folder" contains no meeningfull information,
because of hdiutil doesn't understand APFS container slice (like HFS+'s volume).
We cannot use this scheme.
////////
//////// creating volume image as folder research...
////////
hdiutil create -srcfolder /Volume/Macintosh\ HD -format UDZO /Volumes/Test\ HD/volume.dmg
=> OK
maybe scannable...
maybe restorable...
########
"volume image as folder" contains meeningfull one APFS volume.
We can use this scheme to restore one volume at once.
However, we cannot restore whole APFS container (including Preboot, Recovery, VM) at once.