Closed rohitagre closed 3 years ago
Use disk5
instead of disk5s1
🙂
drat-0.1.3 % diskutil list
/dev/disk0 (internal, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *500.1 GB disk0
1: EFI EFI 209.7 MB disk0s1
2: Apple_APFS Container disk4 499.9 GB disk0s2
/dev/disk1 (internal, physical):
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *500.1 GB disk1
1: Apple_HFS Media 500.1 GB disk1s1
/dev/disk2 (internal, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *1.0 TB disk2
1: Apple_APFS Container disk5 1000.0 GB disk2s2
/dev/disk3 (internal, physical):
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *120.0 GB disk3
1: Apple_HFS vbox 120.0 GB disk3s1
/dev/disk4 (synthesized):
#: TYPE NAME SIZE IDENTIFIER
0: APFS Container Scheme - +499.9 GB disk4
Physical Store disk0s2
1: APFS Volume Home - Data 169.8 GB disk4s1
2: APFS Volume Home 15.3 GB disk4s2
3: APFS Snapshot com.apple.os.update-... 15.3 GB disk4s2s1
4: APFS Volume Preboot 508.1 MB disk4s3
5: APFS Volume Recovery 625.7 MB disk4s4
6: APFS Volume VM 2.1 GB disk4s5
/dev/disk5 (synthesized):
#: TYPE NAME SIZE IDENTIFIER
0: APFS Container Scheme - +1000.0 GB disk5
Physical Store disk2s2
1: APFS Volume Other 349.9 GB disk5s1
2: APFS Volume Untitled2 2.1 MB disk5s2
I tried sudo ./drat inspect /dev/disk5
drat-0.1.3 % sudo ./drat inspect /dev/disk5
Password:
Opening file at `/dev/disk5` in read-only mode ...
ABORT: Unknown error.
I also tried sudo ./drat inspect /dev/disk2
drat-0.1.3 % sudo ./drat inspect /dev/disk2
Opening file at `/dev/disk2` in read-only mode ... OK.
Simulating a mount of the APFS container.
Reading container superblock at address 0x0, assuming default block size of 4096 bytes ... Actual block size stated in container superblock is 0 bytes; re-reading block 0x0 using new block size ... ABORT: read_blocks: Unexpected beaviour --- `fread` read fewer blocks than expected, but `feof` did not report EOF and `ferror` did not detect an error.
The APFS volume Other
is inaccessible. :(
I created another volume on the APFS drive Untitled2
and it is working fine.
Success on
drat-0.1.3 % sudo ./drat inspect /dev/disk2s2
Opening file at `/dev/disk2s2` in read-only mode ... OK.
Simulating a mount of the APFS container.
Reading container superblock at address 0x0, assuming default block size of 4096 bytes ... validating checksum ... OK.
Details of block 0x0:
--------------------------------------------------------------------------------
Stored checksum: 0x2bc86d47b8aa28b6
OID: 0x1
XID: 0xd618
Storage type: Ephemeral
Type flags: (no flags)
Type: Container superblock
Subtype: (invalid type / no subtype)
Keybag location: none (spans 0 blocks)
Media keybag location: none (spans 0 blocks)
Magic string: NXSB
Latest version of Apple APFS software that mounted this container: 1525.359.282.613.640
Block size: 4096 bytes
Block count: 244139436 (last block 0xe8d45ab)
Supported features:
- The volumes in this container support defragmentation.
Supported read-only compatible features:
- No flags.
Backward-incompatible features:
- This container uses APFS version 2, as implemented in macOS 10.13 and iOS 10.3.
UUID: C5B66826-570B-408A-857A-F5F9E84F88CD
Next OID: 0x470d3
Next XID: 0xd619
Space manager Ephemeral OID: 0x400
Object map Physical OID: 0x289c69
Reaper Ephemeral OID: 0x401
Other flags:
- No flags.
--------------------------------------------------------------------------------
Locating the checkpoint descriptor area:
- Its length is 280 blocks.
- It is contiguous.
- The address of its first block is 0x1.
Loading the checkpoint descriptor area into memory ... OK.
Locating the most recent well-formed container superblock in the checkpoint descriptor area:
- It lies at index 249 within the checkpoint descriptor area.
Details of this container superblock:
--------------------------------------------------------------------------------
Stored checksum: 0x2bcb34f2b8a76010
OID: 0x1
XID: 0xd62b
Storage type: Ephemeral
Type flags: (no flags)
Type: Container superblock
Subtype: (invalid type / no subtype)
Keybag location: none (spans 0 blocks)
Media keybag location: none (spans 0 blocks)
Magic string: NXSB
Latest version of Apple APFS software that mounted this container: 1525.359.282.613.640
Block size: 4096 bytes
Block count: 244139436 (last block 0xe8d45ab)
Supported features:
- The volumes in this container support defragmentation.
Supported read-only compatible features:
- No flags.
Backward-incompatible features:
- This container uses APFS version 2, as implemented in macOS 10.13 and iOS 10.3.
UUID: C5B66826-570B-408A-857A-F5F9E84F88CD
Next OID: 0x470d3
Next XID: 0xd62c
Space manager Ephemeral OID: 0x400
Object map Physical OID: 0x289aed
Reaper Ephemeral OID: 0x401
Other flags:
- No flags.
--------------------------------------------------------------------------------
- The corresponding checkpoint starts at index 248 within the checkpoint descriptor area, and spans 2 blocks.
Loading the corresponding checkpoint ... OK.
Details of each block in this checkpoint:
--------------------------------------------------------------------------------
Stored checksum: 0x8c355ff6b3c77c87
OID: 0xf9
XID: 0xd62b
Storage type: Physical
Type flags: (no flags)
Type: Checkpoint map
Subtype: (invalid type / no subtype)
Flags:
- Last checkpoint-mapping block in the corresponding checkpoint.
Number of mappings: 5
--------------------------------------------------------------------------------
Stored checksum: 0x2bcb34f2b8a76010
OID: 0x1
XID: 0xd62b
Storage type: Ephemeral
Type flags: (no flags)
Type: Container superblock
Subtype: (invalid type / no subtype)
Keybag location: none (spans 0 blocks)
Media keybag location: none (spans 0 blocks)
Magic string: NXSB
Latest version of Apple APFS software that mounted this container: 1525.359.282.613.640
Block size: 4096 bytes
Block count: 244139436 (last block 0xe8d45ab)
Supported features:
- The volumes in this container support defragmentation.
Supported read-only compatible features:
- No flags.
Backward-incompatible features:
- This container uses APFS version 2, as implemented in macOS 10.13 and iOS 10.3.
UUID: C5B66826-570B-408A-857A-F5F9E84F88CD
Next OID: 0x470d3
Next XID: 0xd62c
Space manager Ephemeral OID: 0x400
Object map Physical OID: 0x289aed
Reaper Ephemeral OID: 0x401
Other flags:
- No flags.
--------------------------------------------------------------------------------
Details of each checkpoint-mapping in this checkpoint:
--------------------------------------------------------------------------------
Ephemeral OID: 0x400
Logical block address on disk: 0x6194
Object type: Space manager
Object subtype: (invalid type / no subtype)
Object size: 4096 bytes
Associated volume OID (virtual): 0x0
--------------------------------------------------------------------------------
Ephemeral OID: 0x401
Logical block address on disk: 0x6195
Object type: Container reaper
Object subtype: (invalid type / no subtype)
Object size: 4096 bytes
Associated volume OID (virtual): 0x0
--------------------------------------------------------------------------------
Ephemeral OID: 0x403
Logical block address on disk: 0x6196
Object type: B-tree (root node)
Object subtype: Space manager free-space queue
Object size: 4096 bytes
Associated volume OID (virtual): 0x0
--------------------------------------------------------------------------------
Ephemeral OID: 0x405
Logical block address on disk: 0x6197
Object type: B-tree (root node)
Object subtype: Space manager free-space queue
Object size: 4096 bytes
Associated volume OID (virtual): 0x0
--------------------------------------------------------------------------------
Ephemeral OID: 0x414
Logical block address on disk: 0x6198
Object type: Container reaper list
Object subtype: (invalid type / no subtype)
Object size: 4096 bytes
Associated volume OID (virtual): 0x0
--------------------------------------------------------------------------------
- There are 5 checkpoint-mappings in this checkpoint.
Reading the Ephemeral objects used by this checkpoint ... OK.
Validating the Ephemeral objects ... OK.
Details of the Ephemeral objects:
--------------------------------------------------------------------------------
Stored checksum: 0x4d5dbcf91a46872e
OID: 0x400
XID: 0xd62b
Storage type: Ephemeral
Type flags: (no flags)
Type: Space manager
Subtype: (invalid type / no subtype)
--------------------------------------------------------------------------------
Stored checksum: 0x9b8cc7d8a46c1d95
OID: 0x401
XID: 0xd62b
Storage type: Ephemeral
Type flags: (no flags)
Type: Container reaper
Subtype: (invalid type / no subtype)
--------------------------------------------------------------------------------
Stored checksum: 0xb1f81dcc9dd11b59
OID: 0x403
XID: 0xd62b
Storage type: Ephemeral
Type flags: (no flags)
Type: B-tree (root node)
Subtype: Space manager free-space queue
--------------------------------------------------------------------------------
Stored checksum: 0xaea3ab85750ee69f
OID: 0x405
XID: 0xd62b
Storage type: Ephemeral
Type flags: (no flags)
Type: B-tree (root node)
Subtype: Space manager free-space queue
--------------------------------------------------------------------------------
Stored checksum: 0x3aebaa32fe9cfb78
OID: 0x414
XID: 0xd62b
Storage type: Ephemeral
Type flags: (no flags)
Type: Container reaper list
Subtype: (invalid type / no subtype)
--------------------------------------------------------------------------------
The container superblock states that the container object map has Physical OID 0x289aed.
Loading the container object map ... OK.
Validating the container object map ... OK.
Details of the container object map:
--------------------------------------------------------------------------------
Stored checksum: 0x85f488d8b9b96b10
OID: 0x289aed
XID: 0xd62b
Storage type: Physical
Type flags: (no flags)
Type: Object map
Subtype: (invalid type / no subtype)
Flags:
- No snapshot support
Object mappings tree:
- Storage type: Physical
- Type flags: (no flags)
- Type: B-tree (root node)
- Object ID: 0x289aee
Snapshots tree:
- Storage type: Physical
- Type flags: (no flags)
- Type: B-tree (root node)
- Object ID: 0x0
- Number of snapshots: 0 snapshots
- Latest snapshot XID: 0x0
In-progress revert:
- Minimum XID: 0x0
- Maximum XID: 0x0
--------------------------------------------------------------------------------
Reading the root node of the container object map B-tree ... OK.
Validating the root node of the container object map B-tree ... OK.
Details of the container object map B-tree:
--------------------------------------------------------------------------------
Stored checksum: 0x92c6ce641cf07063
OID: 0x289aee
XID: 0xd62b
Storage type: Physical
Type flags: (no flags)
Type: B-tree (root node)
Subtype: Object map
Flags:
- Root node
- Leaf node
- Fixed size for keys and values
Number of child levels: 0
Number of keys in this node: 2
Location of table of contents:
- Offset from start of node data area: 0x0 = 0
- Length (bytes): 0x1c0 = 448
Location of key–value shared free space:
- Offset from start of keys area: 0x30 = 48
- Length (bytes): 0xd80 = 3456
Info relating to the entire B-tree:
- Flags:
- This B-tree is currently undergoing a series of sequential inserts --- optimise operations if possible
- Child nodes are referred to using Physical OIDs
- Node size: 4096 bytes
- Key size: 16 bytes
- Value size: 16 bytes
- Length of longest key: 16 bytes
- Length of longest value: 16 bytes
- Number of keys: 2
- Number of nodes: 1
--------------------------------------------------------------------------------
The container superblock lists 2 APFS volumes, whose superblocks have the following Virtual OIDs:
- 0x402
- 0x470b6
Reading the APFS volume superblocks ... OK.
Validating the APFS volume superblocks ... OK.
Details of these volume superblocks:
--------------------------------------------------------------------------------
Stored checksum: 0x984f4e7ebe499c16
OID: 0x402
XID: 0xd57c
Storage type: Virtual
Type flags: (no flags)
Type: APFS volume
Subtype: (invalid type / no subtype)
Magic string: APSB
Index within container volume array: 0
Volume name: ### Other ###
Role: (no role)
Flags:
- Volume is unencrypted.
Supported features:
- This volume has hardlink map records.
- Defragmentation is supported.
Supported read-only compatible features:
- No flags.
Backward-incompatible features:
- Filenames on this volume are case-insensitive.
Last unmount time: Tue Sep 7 23:52:27 2021
Last modification time: Tue Sep 7 23:52:26 2021
Reserved blocks: 0 blocks
Block quota: 0 blocks
Allocated blocks: 85434953 blocks
Volume object map Physical OID: 0x290af9
Root tree info:
- OID: 0x404
- Storage type: Virtual
- Type flags: (no flags)
- Object type: B-tree (root node)
Extent-reference tree info:
- OID: 0x1cfbe5
- Storage type: Physical
- Type flags: (no flags)
- Object type: B-tree (root node)
Snapshot metadata tree info:
- OID: 0x1cf6ea
- Storage type: Physical
- Type flags: (no flags)
- Object type: B-tree (root node)
On next mount, revert to:
- snapshot with this XID: 0x0
- APFS volume superblock with this Physical OID: 0x0
Next file-system object ID that will be assigned: 0x18e353
Next document ID that will be assigned: 0x3
Number of:
- regular files: 552849
- directories: 22620
- symbolic links: 26
- other file-system objects: 0
- snapshots: 8
- block allocations ever made: 342152544
- block liberations ever made: 256851948
UUID: B312E750-E7AF-404F-B524-B56959EF3D8C
Formatted by:
- ID: diskmanagementd (1412.120.2)
- Timestamp: Mon Oct 19 14:21:45 2020
- Last XID: 2
Last modified by:
- ID: apfs_kext (1677.141.1)
- Timestamp: Tue Sep 7 23:52:27 2021
- Last XID: d57c
--------------------------------------------------------------------------------
Stored checksum: 0x2c4680eb8c1c1ef2
OID: 0x470b6
XID: 0xd62b
Storage type: Virtual
Type flags: (no flags)
Type: APFS volume
Subtype: (invalid type / no subtype)
Magic string: APSB
Index within container volume array: 1
Volume name: ### Untitled2 ###
Role: (no role)
Flags:
- Volume is unencrypted.
Supported features:
- This volume has hardlink map records.
- Defragmentation is supported.
Supported read-only compatible features:
- No flags.
Backward-incompatible features:
- Filenames on this volume are case-insensitive.
Last unmount time: Mon Sep 27 23:58:53 2021
Last modification time: Tue Sep 28 11:07:38 2021
Reserved blocks: 0 blocks
Block quota: 0 blocks
Allocated blocks: 511 blocks
Volume object map Physical OID: 0x289aeb
Root tree info:
- OID: 0x470b7
- Storage type: Virtual
- Type flags: (no flags)
- Object type: B-tree (root node)
Extent-reference tree info:
- OID: 0x148e2a
- Storage type: Physical
- Type flags: (no flags)
- Object type: B-tree (root node)
Snapshot metadata tree info:
- OID: 0x148de4
- Storage type: Physical
- Type flags: (no flags)
- Object type: B-tree (root node)
On next mount, revert to:
- snapshot with this XID: 0x0
- APFS volume superblock with this Physical OID: 0x0
Next file-system object ID that will be assigned: 0x12d
Next document ID that will be assigned: 0x3
Number of:
- regular files: 83
- directories: 18
- symbolic links: 0
- other file-system objects: 0
- snapshots: 3
- block allocations ever made: 1040
- block liberations ever made: 579
UUID: B984CC26-7BDE-4489-B7ED-14D5D6DB1B1D
Formatted by:
- ID: storagekitd (1677.141.2)
- Timestamp: Mon Sep 27 20:40:44 2021
- Last XID: d57d
Last modified by:
- ID: apfs_kext (1677.141.2)
- Timestamp: Mon Sep 27 23:58:53 2021
- Last XID: d618
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Simulating a mount of volume 0 (Other).
The volume object map has Physical OID 0x290af9.
Reading the volume object map ... OK.
Validating the volume object map ... OK.
Details of the volume object map:
--------------------------------------------------------------------------------
Stored checksum: 0xfe8a6b834104f921
OID: 0x290af9
XID: 0xd57b
Storage type: Physical
Type flags: (no flags)
Type: Object map
Subtype: (invalid type / no subtype)
Flags:
- No flags.
Object mappings tree:
- Storage type: Physical
- Type flags: (no flags)
- Type: B-tree (root node)
- Object ID: 0x290afa
Snapshots tree:
- Storage type: Physical
- Type flags: (no flags)
- Type: B-tree (root node)
- Object ID: 0x1cf6f2
- Number of snapshots: 17 snapshots
- Latest snapshot XID: 0xb8da
In-progress revert:
- Minimum XID: 0x0
- Maximum XID: 0x0
--------------------------------------------------------------------------------
Reading the root node of the volume object map B-tree ... OK.
Validating the root node of the volume object map B-tree ... OK.
Details of the volume object map B-tree:
--------------------------------------------------------------------------------
Stored checksum: 0x64ade39c40d8d678
OID: 0x290afa
XID: 0xd57b
Storage type: Physical
Type flags: (no flags)
Type: B-tree (root node)
Subtype: Object map
Flags:
- Root node
- Fixed size for keys and values
Number of child levels: 2
Number of keys in this node: 15
Location of table of contents:
- Offset from start of node data area: 0x0 = 0
- Length (bytes): 0x240 = 576
Location of key–value shared free space:
- Offset from start of keys area: 0x150 = 336
- Length (bytes): 0xb68 = 2920
Info relating to the entire B-tree:
- Flags:
- This B-tree is currently undergoing a series of sequential inserts --- optimise operations if possible
- Child nodes are referred to using Physical OIDs
- Node size: 4096 bytes
- Key size: 16 bytes
- Value size: 16 bytes
- Length of longest key: 16 bytes
- Length of longest value: 16 bytes
- Number of keys: 134293
- Number of nodes: 1628
--------------------------------------------------------------------------------
The file-system tree root for this volume has Virtual OID 0x404.
Looking up this Virtual OID in the volume object map ... corresponding block address is 0x1cfc4c.
Reading ... validating ... OK.
Details of the file-system B-tree root node:
--------------------------------------------------------------------------------
Stored checksum: 0x7e4fd0ae3e2e7488
OID: 0x404
XID: 0xd57b
Storage type: Virtual
Type flags: (no flags)
Type: B-tree (root node)
Subtype: File-system records tree
Flags:
- Root node
Number of child levels: 3
Number of keys in this node: 14
Location of table of contents:
- Offset from start of node data area: 0x0 = 0
- Length (bytes): 0x80 = 128
Location of key–value shared free space:
- Offset from start of keys area: 0x4ec = 1260
- Length (bytes): 0x994 = 2452
Info relating to the entire B-tree:
- Flags:
- This B-tree is currently undergoing a series of sequential inserts --- optimise operations if possible
- 8-byte alignment of keys and values is not required
- Node size: 4096 bytes
- Key size: 0 bytes
- Value size: 0 bytes
- Length of longest key: 268 bytes
- Length of longest value: 1953 bytes
- Number of keys: 2632209
- Number of nodes: 74761
--------------------------------------------------------------------------------
0xa64b2:
No records found with OID 0xa64b2.
Please suggest how to proceed as the docs in the repo point to a different version of drat
much thanks.
Hmm, strange that /dev/disk5
didn't work but /dev/disk2s2
did, I shall have to look into that. I am able to reproduce that issue.
Your drat inspect
output looks fine, so it would seem that the only issue is with your volume omap (as reported by fsck_apfs
). You can try to list the contents of directories with drat list
, e.g.
drat list /dev/disk2s2 0 /Users
Try listing various directories/files you're interested in and seeing the output. If you get an error for any particular item, try its parents, e.g. if /Users/john
throws an error, try /Users
and /
. In this way, we can identify which dentries are problematic.
For those files that are successfully listed, you should be able to recover them with drat recover
, e.g.
drat recover /dev/disk2s2 0 /Users/john/Desktop/file.txt
will output the file contents to stdout
; redirect to file to save the recovered file, e.g.
drat recover /dev/disk2s2 0 /Users/john/Desktop/file.txt > recovered-file.txt
Hi, i ended up using libfsapfs
to get the data from a ubuntu live usb stick. thanks for your support and for this great tool.
@jammer99 , thanks for feeding back. If you are able to provide any info on how you used libfsapfs
to your advantage, such as some blog post or article that helped you, that would be much appreciated!
Hi, i ended up using
libfsapfs
to get the data from a ubuntu live usb stick. thanks for your support and for this great tool.
Hey, do you have any info on how to recover the data with libfsapfs? I tried libfsapfs first and ended up here, because that didn't work for me. Problem is, that drat isn't working for me so far either.. I have a few issues, and reading block 0x0... is one of them.
@jivanpal sorry, I'm not sure if I'm allowed to open a new issue and if you have time for that or not..
@Innoriam If your Drat problem/output differs from that in the OP (FAILED: read_blocks: An unknown error occurred whilst reading from the stream. ABORT: Failed to successfully read block 0x0.
), please create a new issue. I have no experience with libfsapfs, so can't help you there.
Hi, My APFS container fails to mount and running first aid gives the following output.
When i run
drat inspect /dev/disk5s1
i get the following outputOutput of
diskutil list
anddiskutil apfs list
is attached belowIs there any way i can recover data from this drive?