Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how can i recover a directory #7

Closed
lornally opened this issue Dec 24, 2020 · 13 comments
Closed

how can i recover a directory #7

lornally opened this issue Dec 24, 2020 · 13 comments

Comments

@lornally
Copy link

sorry i am foolish, i have read doc:

@jivanpal
Copy link
Owner

jivanpal commented Dec 24, 2020

Depends on the state of the partition. Use fsck_apfs and apfs-inspect to see if there's anything obviously wrong with your partition which will prevent you from doing this.

We don't currently have automated recovery/undelete for entire directories, but you can use apfs-list to explore directories view file metadata, and then apfs-recover to recover a specific file. We have a simple shell script, pull.sh which allows you to automate this over a list of filepaths that you want to try to recover; you will need to create this list yourself somehow. @memecode's fork has a Python script, recover.py, which does this for you; you'll need to customise that Python script to search through the directories you're interested in (e.g. /Users/lornally).

@lornally
Copy link
Author

thank you very much, i try it. :)

> sudo fsck_apfs /dev/disk4
** Checking the container superblock.
** Checking the EFI jumpstart record.
** Checking the space manager.
** Checking the space manager free queue trees.
** Checking the object map.
** Checking volume.
** Checking the APFS volume superblock.
** The volume black_apple_back was formatted by hfs_convert (748.1.47) and last modified by apfs_kext (1677.60.23).
** Checking the object map.
error: (oid 0x2660a8) om: btn: invalid o_subtype (0xf, expected 0xb)
   Object map is invalid.
** The volume /dev/disk4 could not be verified completely.

@lornally
Copy link
Author

> sudo ./bin/apfs-inspect /dev/disk4

Opening file at `/dev/disk4` in read-only mode ... OK.
Simulating a mount of the APFS container.
Validating checksum of block 0x0 ... OK.

Details of block 0x0:
--------------------------------------------------------------------------------
Stored checksum:    0x78d8e2aefbc4e3bc
OID:                0x1
XID:                0x337d
Storage type:       Ephemeral
Type flags:         (none)
Type:               Container superblock
Subtype:            (none/invalid)
Keybag location: starts at 0, spans 0 blocks
Magic string:       NXSB
Block size:         4096 bytes
Block count:        488286454
Supported features:
- No feature flags are set.
Supported read-only compatible features:
- No read-only compatible feature flags are set.
Backward-incompatible features:
- No backward-incompatible feature flags are set.
UUID:       0x341872ad72e461aead44d38a60513f78
Next OID:                       0x57bdf
Next XID:                       0x337e
Space manager Ephemeral OID:    0x400
Object map Physical OID:        0x2ef218
Reaper Ephemeral OID:           0x401
Other flags:
- No other flags are set.
--------------------------------------------------------------------------------

Locating the checkpoint descriptor area:
- Its length is 280 blocks.
- It is contiguous.
- The address of its first block is 0x8ea38.
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 16 within the checkpoint descriptor area.

Details of this container superblock:
--------------------------------------------------------------------------------
Stored checksum:    0x78d8d990fbc4ecdd
OID:                0x1
XID:                0x337d
Storage type:       Ephemeral
Type flags:         (none)
Type:               Container superblock
Subtype:            (none/invalid)
Keybag location: starts at 0, spans 0 blocks
Magic string:       NXSB
Block size:         4096 bytes
Block count:        488286454
Supported features:
- No feature flags are set.
Supported read-only compatible features:
- No read-only compatible feature flags are set.
Backward-incompatible features:
- No backward-incompatible feature flags are set.
UUID:       0x341872ad72e461aead44d38a60513f78
Next OID:                       0x57bdf
Next XID:                       0x337e
Space manager Ephemeral OID:    0x400
Object map Physical OID:        0x2ef218
Reaper Ephemeral OID:           0x401
Other flags:
- No other flags are set.
--------------------------------------------------------------------------------
- The corresponding checkpoint starts at index 15 within the checkpoint descriptor area, and spans 2 blocks.

Loading the corresponding checkpoint ... OK.

Details of each block in this checkpoint:
--------------------------------------------------------------------------------
Stored checksum:    0x41ed83e0fcb15e30
OID:                0x8ea47
XID:                0x337d
Storage type:       Physical
Type flags:         (none)
Type:               Checkpoint map
Subtype:            (none/invalid)
Flags:
- Last checkpoint-mapping block in the correspondng checkpoint.
Number of mappings: 25
--------------------------------------------------------------------------------
Stored checksum:    0x78d8d990fbc4ecdd
OID:                0x1
XID:                0x337d
Storage type:       Ephemeral
Type flags:         (none)
Type:               Container superblock
Subtype:            (none/invalid)
Keybag location: starts at 0, spans 0 blocks
Magic string:       NXSB
Block size:         4096 bytes
Block count:        488286454
Supported features:
- No feature flags are set.
Supported read-only compatible features:
- No read-only compatible feature flags are set.
Backward-incompatible features:
- No backward-incompatible feature flags are set.
UUID:       0x341872ad72e461aead44d38a60513f78
Next OID:                       0x57bdf
Next XID:                       0x337e
Space manager Ephemeral OID:    0x400
Object map Physical OID:        0x2ef218
Reaper Ephemeral OID:           0x401
Other flags:
- No other flags are set.
--------------------------------------------------------------------------------

Details of each checkpoint-mapping in this checkpoint:
--------------------------------------------------------------------------------
Ephemeral OID:                      0x400
Logical block address on disk:      0x93907
Object type:                        Space manager
Object subtype:                     (none/invalid)
Object size:                        4096 bytes
Associated volume OID (virtual):    0x0
--------------------------------------------------------------------------------
Ephemeral OID:                      0x402
Logical block address on disk:      0x93908
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:      0x93909
Object type:                        B-tree (root node)
Object subtype:                     Space manager free-space queue
Object size:                        4096 bytes
Associated volume OID (virtual):    0x0
--------------------------------------------------------------------------------
Ephemeral OID:                      0x21fbe
Logical block address on disk:      0x9390a
Object type:                        B-tree (non-root) node
Object subtype:                     Space manager free-space queue
Object size:                        4096 bytes
Associated volume OID (virtual):    0x0
--------------------------------------------------------------------------------
Ephemeral OID:                      0x401
Logical block address on disk:      0x9390b
Object type:                        Container reaper
Object subtype:                     (none/invalid)
Object size:                        4096 bytes
Associated volume OID (virtual):    0x0
--------------------------------------------------------------------------------
Ephemeral OID:                      0x57b88
Logical block address on disk:      0x9390c
Object type:                        B-tree (non-root) node
Object subtype:                     Space manager free-space queue
Object size:                        4096 bytes
Associated volume OID (virtual):    0x0
--------------------------------------------------------------------------------
Ephemeral OID:                      0x57bad
Logical block address on disk:      0x9390d
Object type:                        B-tree (non-root) node
Object subtype:                     Space manager free-space queue
Object size:                        4096 bytes
Associated volume OID (virtual):    0x0
--------------------------------------------------------------------------------
Ephemeral OID:                      0x57bc4
Logical block address on disk:      0x9390e
Object type:                        B-tree (non-root) node
Object subtype:                     Space manager free-space queue
Object size:                        4096 bytes
Associated volume OID (virtual):    0x0
--------------------------------------------------------------------------------
Ephemeral OID:                      0x57bce
Logical block address on disk:      0x9390f
Object type:                        B-tree (non-root) node
Object subtype:                     Space manager free-space queue
Object size:                        4096 bytes
Associated volume OID (virtual):    0x0
--------------------------------------------------------------------------------
Ephemeral OID:                      0x57bcf
Logical block address on disk:      0x93910
Object type:                        B-tree (non-root) node
Object subtype:                     Space manager free-space queue
Object size:                        4096 bytes
Associated volume OID (virtual):    0x0
--------------------------------------------------------------------------------
Ephemeral OID:                      0x57bd0
Logical block address on disk:      0x93911
Object type:                        B-tree (non-root) node
Object subtype:                     Space manager free-space queue
Object size:                        4096 bytes
Associated volume OID (virtual):    0x0
--------------------------------------------------------------------------------
Ephemeral OID:                      0x57bd1
Logical block address on disk:      0x93912
Object type:                        B-tree (non-root) node
Object subtype:                     Space manager free-space queue
Object size:                        4096 bytes
Associated volume OID (virtual):    0x0
--------------------------------------------------------------------------------
Ephemeral OID:                      0x57bd2
Logical block address on disk:      0x93913
Object type:                        B-tree (non-root) node
Object subtype:                     Space manager free-space queue
Object size:                        4096 bytes
Associated volume OID (virtual):    0x0
--------------------------------------------------------------------------------
Ephemeral OID:                      0x57bd3
Logical block address on disk:      0x93914
Object type:                        B-tree (non-root) node
Object subtype:                     Space manager free-space queue
Object size:                        4096 bytes
Associated volume OID (virtual):    0x0
--------------------------------------------------------------------------------
Ephemeral OID:                      0x57bd4
Logical block address on disk:      0x93915
Object type:                        B-tree (non-root) node
Object subtype:                     Space manager free-space queue
Object size:                        4096 bytes
Associated volume OID (virtual):    0x0
--------------------------------------------------------------------------------
Ephemeral OID:                      0x57bd5
Logical block address on disk:      0x93916
Object type:                        B-tree (non-root) node
Object subtype:                     Space manager free-space queue
Object size:                        4096 bytes
Associated volume OID (virtual):    0x0
--------------------------------------------------------------------------------
Ephemeral OID:                      0x57bd6
Logical block address on disk:      0x93917
Object type:                        B-tree (non-root) node
Object subtype:                     Space manager free-space queue
Object size:                        4096 bytes
Associated volume OID (virtual):    0x0
--------------------------------------------------------------------------------
Ephemeral OID:                      0x57bd7
Logical block address on disk:      0x93918
Object type:                        B-tree (non-root) node
Object subtype:                     Space manager free-space queue
Object size:                        4096 bytes
Associated volume OID (virtual):    0x0
--------------------------------------------------------------------------------
Ephemeral OID:                      0x57bd8
Logical block address on disk:      0x93919
Object type:                        B-tree (non-root) node
Object subtype:                     Space manager free-space queue
Object size:                        4096 bytes
Associated volume OID (virtual):    0x0
--------------------------------------------------------------------------------
Ephemeral OID:                      0x57bd9
Logical block address on disk:      0x9391a
Object type:                        B-tree (non-root) node
Object subtype:                     Space manager free-space queue
Object size:                        4096 bytes
Associated volume OID (virtual):    0x0
--------------------------------------------------------------------------------
Ephemeral OID:                      0x57bda
Logical block address on disk:      0x9391b
Object type:                        B-tree (non-root) node
Object subtype:                     Space manager free-space queue
Object size:                        4096 bytes
Associated volume OID (virtual):    0x0
--------------------------------------------------------------------------------
Ephemeral OID:                      0x57bdb
Logical block address on disk:      0x9391c
Object type:                        B-tree (non-root) node
Object subtype:                     Space manager free-space queue
Object size:                        4096 bytes
Associated volume OID (virtual):    0x0
--------------------------------------------------------------------------------
Ephemeral OID:                      0x57bdc
Logical block address on disk:      0x9391d
Object type:                        B-tree (non-root) node
Object subtype:                     Space manager free-space queue
Object size:                        4096 bytes
Associated volume OID (virtual):    0x0
--------------------------------------------------------------------------------
Ephemeral OID:                      0x57bdd
Logical block address on disk:      0x9391e
Object type:                        B-tree (non-root) node
Object subtype:                     Space manager free-space queue
Object size:                        4096 bytes
Associated volume OID (virtual):    0x0
--------------------------------------------------------------------------------
Ephemeral OID:                      0x57bde
Logical block address on disk:      0x9391f
Object type:                        B-tree (non-root) node
Object subtype:                     Space manager free-space queue
Object size:                        4096 bytes
Associated volume OID (virtual):    0x0
--------------------------------------------------------------------------------
- There are 25 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:    0x79b9ee1adb445f44
OID:                0x400
XID:                0x337d
Storage type:       Ephemeral
Type flags:         (none)
Type:               Space manager
Subtype:            (none/invalid)
--------------------------------------------------------------------------------
Stored checksum:    0xe55169a18af5f694
OID:                0x402
XID:                0x337d
Storage type:       Ephemeral
Type flags:         (none)
Type:               B-tree (root node)
Subtype:            Space manager free-space queue
--------------------------------------------------------------------------------
Stored checksum:    0xee8525accca6f9ce
OID:                0x405
XID:                0x337d
Storage type:       Ephemeral
Type flags:         (none)
Type:               B-tree (root node)
Subtype:            Space manager free-space queue
--------------------------------------------------------------------------------
Stored checksum:    0xbd76914658131e9b
OID:                0x21fbe
XID:                0x337d
Storage type:       Ephemeral
Type flags:         (none)
Type:               B-tree (non-root) node
Subtype:            Space manager free-space queue
--------------------------------------------------------------------------------
Stored checksum:    0x011a0b597ee5ad85
OID:                0x401
XID:                0x337d
Storage type:       Ephemeral
Type flags:         (none)
Type:               Container reaper
Subtype:            (none/invalid)
--------------------------------------------------------------------------------
Stored checksum:    0x0c52427f328ec574
OID:                0x57b88
XID:                0x337d
Storage type:       Ephemeral
Type flags:         (none)
Type:               B-tree (non-root) node
Subtype:            Space manager free-space queue
--------------------------------------------------------------------------------
Stored checksum:    0x54af51afcd28c088
OID:                0x57bad
XID:                0x337d
Storage type:       Ephemeral
Type flags:         (none)
Type:               B-tree (non-root) node
Subtype:            Space manager free-space queue
--------------------------------------------------------------------------------
Stored checksum:    0xe5d11bab634023a0
OID:                0x57bc4
XID:                0x337d
Storage type:       Ephemeral
Type flags:         (none)
Type:               B-tree (non-root) node
Subtype:            Space manager free-space queue
--------------------------------------------------------------------------------
Stored checksum:    0x33932eba400790c6
OID:                0x57bce
XID:                0x337d
Storage type:       Ephemeral
Type flags:         (none)
Type:               B-tree (non-root) node
Subtype:            Space manager free-space queue
--------------------------------------------------------------------------------
Stored checksum:    0x32eac47b5fe2d7b2
OID:                0x57bcf
XID:                0x337d
Storage type:       Ephemeral
Type flags:         (none)
Type:               B-tree (non-root) node
Subtype:            Space manager free-space queue
--------------------------------------------------------------------------------
Stored checksum:    0x2c5a585f6b6996e0
OID:                0x57bd0
XID:                0x337d
Storage type:       Ephemeral
Type flags:         (none)
Type:               B-tree (non-root) node
Subtype:            Space manager free-space queue
--------------------------------------------------------------------------------
Stored checksum:    0x02134ed5bf854209
OID:                0x57bd1
XID:                0x337d
Storage type:       Ephemeral
Type flags:         (none)
Type:               B-tree (non-root) node
Subtype:            Space manager free-space queue
--------------------------------------------------------------------------------
Stored checksum:    0x30edfcff34fef2af
OID:                0x57bd2
XID:                0x337d
Storage type:       Ephemeral
Type flags:         (none)
Type:               B-tree (non-root) node
Subtype:            Space manager free-space queue
--------------------------------------------------------------------------------
Stored checksum:    0x3f764afc24f05a9e
OID:                0x57bd3
XID:                0x337d
Storage type:       Ephemeral
Type flags:         (none)
Type:               B-tree (non-root) node
Subtype:            Space manager free-space queue
--------------------------------------------------------------------------------
Stored checksum:    0x767c7e920c9f057a
OID:                0x57bd4
XID:                0x337d
Storage type:       Ephemeral
Type flags:         (none)
Type:               B-tree (non-root) node
Subtype:            Space manager free-space queue
--------------------------------------------------------------------------------
Stored checksum:    0xb9771776e0665987
OID:                0x57bd5
XID:                0x337d
Storage type:       Ephemeral
Type flags:         (none)
Type:               B-tree (non-root) node
Subtype:            Space manager free-space queue
--------------------------------------------------------------------------------
Stored checksum:    0xea367cdaddb505e3
OID:                0x57bd6
XID:                0x337d
Storage type:       Ephemeral
Type flags:         (none)
Type:               B-tree (non-root) node
Subtype:            Space manager free-space queue
--------------------------------------------------------------------------------
Stored checksum:    0x1b8831204f64611e
OID:                0x57bd7
XID:                0x337d
Storage type:       Ephemeral
Type flags:         (none)
Type:               B-tree (non-root) node
Subtype:            Space manager free-space queue
--------------------------------------------------------------------------------
Stored checksum:    0x8dea8d71ccb8e93d
OID:                0x57bd8
XID:                0x337d
Storage type:       Ephemeral
Type flags:         (none)
Type:               B-tree (non-root) node
Subtype:            Space manager free-space queue
--------------------------------------------------------------------------------
Stored checksum:    0x136141e2708a8d8e
OID:                0x57bd9
XID:                0x337d
Storage type:       Ephemeral
Type flags:         (none)
Type:               B-tree (non-root) node
Subtype:            Space manager free-space queue
--------------------------------------------------------------------------------
Stored checksum:    0x576529bab4138a67
OID:                0x57bda
XID:                0x337d
Storage type:       Ephemeral
Type flags:         (none)
Type:               B-tree (non-root) node
Subtype:            Space manager free-space queue
--------------------------------------------------------------------------------
Stored checksum:    0x36b17827e4a08449
OID:                0x57bdb
XID:                0x337d
Storage type:       Ephemeral
Type flags:         (none)
Type:               B-tree (non-root) node
Subtype:            Space manager free-space queue
--------------------------------------------------------------------------------
Stored checksum:    0xd1c2caf9502a21f7
OID:                0x57bdc
XID:                0x337d
Storage type:       Ephemeral
Type flags:         (none)
Type:               B-tree (non-root) node
Subtype:            Space manager free-space queue
--------------------------------------------------------------------------------
Stored checksum:    0xdf157103edb20d9f
OID:                0x57bdd
XID:                0x337d
Storage type:       Ephemeral
Type flags:         (none)
Type:               B-tree (non-root) node
Subtype:            Space manager free-space queue
--------------------------------------------------------------------------------
Stored checksum:    0xc54f3ba07eb299b0
OID:                0x57bde
XID:                0x337d
Storage type:       Ephemeral
Type flags:         (none)
Type:               B-tree (non-root) node
Subtype:            Space manager free-space queue
--------------------------------------------------------------------------------

The container superblock states that the container object map has Physical OID 0x2ef218.
Loading the container object map ... OK.
Validating the container object map ... OK.

Details of the container object map:
--------------------------------------------------------------------------------
Stored checksum:    0xb5ccef3689d4f90a
OID:                0x2ef218
XID:                0x337d
Storage type:       Physical
Type flags:         (none)
Type:               Object map
Subtype:            (none/invalid)
Flags:
- No snapshot support
Object mappings tree:
- Storage type:         Physical
- Type flags:           (none)
- Type:                 B-tree (root node)
- Object ID:            0x2ef219
Snapshots tree:
- Storage type:         Physical
- Type flags:           (none)
- 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:    0xd2d3bbaddcbc9edd
OID:                0x2ef219
XID:                0x337d
Storage type:       Physical
Type flags:         (none)
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:    1
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:       0x20 = 32
- Length (bytes):                       0xda0 = 3488

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:           1
- Number of nodes:          1
--------------------------------------------------------------------------------

The container superblock lists 1 APFS volumes, whose superblocks have the following Virtual OIDs:
- 0x403

Reading the APFS volume superblocks ... OK.
Validating the APFS volume superblocks ... OK.

Details of these volume superblocks:
--------------------------------------------------------------------------------
Stored checksum:    0x134bb8cd3a234623
OID:                0x403
XID:                0x337d
Storage type:       Virtual
Type flags:         (none)
Type:               APFS volume
Subtype:            (none/invalid)

Magic string:                           APSB
Index within container volume array:    0

Volume name:        ### black_apple_back ###

Flags:
- Volume is unencrypted.
Supported features:
- This volume has hardlink map records.
Supported read-only compatible features:
- No read-only compatible volume feature flags are set.
Backward-incompatible features:
- Filenames on this volume are case-insensitive.
Roles:
- This volume has no defined roles

Last unmount time:                  Tue Dec 22 16:40:19 2020
Last modification time:             Tue Dec 22 16:40:19 2020

Reserved blocks:                    0 blocks
Block quota:                        0 blocks
Allocated blocks:                   345613759 blocks

Volume object map Physical OID:     0x2ef20e

Root tree info:
- OID:              0x404
- Storage type:     Virtual
- Type flags:       (none)
- Object type:      B-tree (root node)

Extent-reference tree info:
- OID:              0x2ef175
- Storage type:     Physical
- Type flags:       (none)
- Object type:      B-tree (root node)

Snapshot metadata tree info:
- OID:              0xa08b2
- Storage type:     Physical
- Type flags:       (none)
- 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:   0x2002a9e4d
Next document ID that will be assigned:             0x4

Number of:

- regular files:                1566572
- directories:                  266027
- symbolic links:               8689
- other file-system objects:    0

- snapshots:                    0
- block allocations ever made:  546054716
- block liberations ever made:  200810973

UUID:   0x079f37e6c4e37bb7c033ab6c172f0e51
--------------------------------------------------------------------------------


--------------------------------------------------------------------------------
--------------------------------------------------------------------------------

Simulating a mount of volume 0 (black_apple_back).

The volume object map has Physical OID 0x2ef20e.
Reading the volume object map ... OK.
Validating the volume object map ... OK.

Details of the volume object map:
--------------------------------------------------------------------------------
Stored checksum:    0xb5cc9bc289d54c93
OID:                0x2ef20e
XID:                0x337c
Storage type:       Physical
Type flags:         (none)
Type:               Object map
Subtype:            (none/invalid)
Flags:
- No flags are set.
Object mappings tree:
- Storage type:         Physical
- Type flags:           (none)
- Type:                 B-tree (root node)
- Object ID:            0x2ef210
Snapshots tree:
- Storage type:         Physical
- Type flags:           (none)
- 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 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:    0x8c118c4eeddf3a8b
OID:                0x2ef210
XID:                0x337c
Storage type:       Physical
Type flags:         (none)
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:    25
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:       0x230 = 560
- Length (bytes):                       0xa18 = 2584

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:           186762
- Number of nodes:          2498
--------------------------------------------------------------------------------

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 0x2ef1f1.
Reading ... validating ... OK.

Details of the file-system B-tree root node:
--------------------------------------------------------------------------------
Stored checksum:    0xbfab69621f80c104
OID:                0x404
XID:                0x337a
Storage type:       Virtual
Type flags:         (none)
Type:               B-tree (root node)
Subtype:            File-system records tree
Flags:                          Root node
Number of child levels:         3
Number of keys in this node:    25
Location of table of contents:
- Offset from start of node data area:  0x0 = 0
- Length (bytes):                       0x100 = 256
Location of key–value shared free space:
- Offset from start of keys area:       0x8b9 = 2233
- Length (bytes):                       0x4af = 1199

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:  3806 bytes
- Number of keys:           7377509
- Number of nodes:          186762
--------------------------------------------------------------------------------


0xa64b2:

get_fs_records: File-system root B-trees don't have fixed size keys and values ... do they?

@lornally
Copy link
Author

lornally commented Dec 25, 2020

sorry, the output is so long, and i am not good at it:(
if that is so hard to analysis it , i will try the python or pull.sh

@jivanpal
Copy link
Owner

jivanpal commented Dec 27, 2020

Looks like your partition is fine at least until you reach the filesystem tree. fsck_apfs complaining about the object map suggests that maybe some filepaths cannot be resolved to file data. Looks like my filesystem B-tree implementation is missing a case that I thought would not occur in practice (filesystem B-tree with keys and values of fixed size), so we cannot resolve filesystem objects IDs to virtual object IDs. I'll aim to add this functionality and update here if/when done.

@lornally
Copy link
Author

lornally commented Dec 28, 2020

thank you very much, and i try to write a coffeescript to deal the directory. because the python can not run as my expect, and i am not good at python.

@lornally
Copy link
Author

hello, i want to make sure with that:
apfs-list will return stdout or stderr, that will not return them both? is that right?
thank you:)

@lornally
Copy link
Author

i have write a script for copy file in directory, so can i create a PR for this project?

@jivanpal
Copy link
Owner

@lornally, for all programs, only errors and warnings are output on stderr. Everything else is on stdout. The only exception is apfs-recover, which only outputs the retrieved file data on stdout, and everything else on stderr. Please feel free to create a PR, I should be properly resuming work on this very soon!

@lornally
Copy link
Author

i have create a pr, but, i don't know how to connect the pr: [Dir backup is enable] and this issue. i think pr and issue connect is very conveniently in github before, but this time, it is seem tough then before.:(

@lornally
Copy link
Author

and one question, do you know chinese? if you don't, i will translate the guide to english.

@lornally
Copy link
Author

lornally commented Jan 13, 2021

and one more suggest: for effect, we need a pool for apfs-recover, because, we call it times and times, so this is a performance problem.

@jivanpal
Copy link
Owner

@lornally, you can mention PRs and issues by number (#9). I plan on adding recursive recover/undelete directly into the app, which will certainly solve the performance issue. Your PR is very much appreciated! I shall be working regularly on this project again starting tomorrow. I do not know Chinese, but it all seems to translate fine in Google Translate (in particular, I skimmed 脚本操作目录.md), so don't worry about it.

Repository owner locked and limited conversation to collaborators Jan 24, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants