search
The search command allows you to scan the filesystem for
particular data, such as blocks of particular types or with particular IDs, or
blocks containing specific data, such as object maps nodes containing particular
mappings, or filesystem records for particular FSOIDs or item names.
Performing a search involves specifying one or more search criteria/parameters,
ecah of which has its own flag — these are detailed in the rest of this page.
Some flags are only defined/make sense in certain contexts, so if that context
is not explicitly specified, it is implied; or if a conflicting contxt is
specified, an error occurs. For example, searching for particular object
mappings only makes sense if we’re looking at blocks that are nodes of an object
map B-tree (omap-tree). Thus, specifying --omap-key-oid 0x123 implies
--type omap-tree. Specifying conflicting contexts, as in
drat search --type fs --omap-key-oid 0x123, results in an error.
The list of values passed to a parameter can be comma-delimited
(e.g. --type omap,fs), which indicates that any of the values must match
(logical OR). When multiple parameters are specified
(e.g. --omap-key-oid 0x123 --omap-key-xid 0x456), all of the values must match
(logical AND).
Drat can create an index of the filesystem in advance in order to make searching
quicker (see create-index). This index is stored in a file, and
you pass it to Drat with --index. If no index is specified or if the
index doesn’t contain required data, Drat will scan through the filesystem
itself to get this data.
Search parameters
Top-level parameters
A list of top-level search parameters follows:
--oid— The object ID. Use--storage-typeto filter to Physical OIDs, Ephemeral OIDs, or Virtual OIDs.--xid— The transaction ID. This value is matched exactly. For a wider search, specify a comma-delimited list of IDs (e.g.--xid 0x1,0x3,0x1b) or a range in the form[min xid]-[max xid](e.g.--xid 0x1b-0x2c), or a combination of these (e.g.--xid 0x1-0x3,0x5,0x1b-0x2c).--storage-type— The object storage type. Valid values arephysical,ephemeral, andvirtual.--type— The object type/subtype. See Object types below for a list of valid keyword values. This can also be a numeric value (decimal or hexadecimal), which can be useful in order to search for reserved types (e.g.0x20,24), or types that this version of Drat is not aware of. Some of the supported keyword values actually reference subtypes, but all of the currently defined subtypes imply a (super-)type ofbtree, so in practice there is no need for a separate search parameter. If, for whatever reason, you want to specify a hexadecimal subtype, you can use a slash/to delimit it from the (super-)type. For example:--type 0x20is an object with (super-)type0x20.--type 0x20/0x30is an object with (super-)type0x20and subtype0x30.--type /0x30is an object with subtype0x30and any (super-)type.
Object types
A table of valid keyword values for the --type parameter follows:
Keyword |
Equivalent value |
Description |
|---|---|---|
|
|
The “invalid” object type |
|
|
The reserved “testing” object type |
|
|
Container superblock |
|
|
Any B-tree node |
|
|
B-tree root node |
|
|
B-tree non-root node |
|
|
B-tree leaf node |
|
|
Spaceman (space manager) block |
|
|
Spaceman chunk-info address block |
|
|
Spaceman chunk-info block |
|
|
Spaceman free-space bitmap |
|
|
Spaceman free-space queue |
|
|
Extents-list tree |
|
|
Omap (object map) |
|
|
Any omap tree node |
|
|
Omap tree leaf node |
|
|
Checkpoint map |
|
|
Volume superblock |
|
|
Any filesystem records tree node |
|
|
Filesystem records tree leaf node |
|
|
Extent reference tree |
|
|
Volume snapshot metadata tree |
|
|
Reaper |
|
|
Reaper list |
|
|
Omap snapshot tree |
|
|
EFI jumpstart block |
|
|
Fusion drive middle-tree (tracks HDD blocks that are cached on SSD) |
|
|
Fusion drive write-back cache state |
|
|
Fusion drive write-back cache list |
|
|
Encryption rolling state |
|
|
General-purpose bitmap |
|
|
B-tree of general-purpose bitmaps |
|
|
Block containing a general-purpose bitmap |
|
|
Encryption-rolling recovery block |
|
|
Additional snapshot metadata |
|
|
Integrity metadata object |
|
|
B-tree of file extents |
|
|
Container keybag |
|
|
Volume keybag |
|
|
Media keybag |
Context-specific parameters
The following sections list search parameters that are only valid in certain contexts.
B-tree nodes (--type btree)
Todo
Describe this
B-tree root nodes (--type btree-root)
Todo
Describe this
Omap tree nodes (--type omap-tree)
The following parameters can be used with --type omap-tree in general, but
it’s usually only useful to use them with --type omap-tree-leaf, since you’re
probably intersted in finding particular object mappings (pointers to objects),
not pointers to other omap tree nodes:
--omap-key-oid— A Virtual OID that makes up an (OID, XID) key-pair.--omap-key-xid— An XID that makes up an (OID, XID) key-pair.
Omap tree leaves (--type omap-tree-leaf)
The following parameters can only be used with --type omap-tree-leaf:
--omap-val-paddr— The block address that some (OID, XID) key-pair maps to.
Filesystem trees (--type fs-tree)
The following parameters can be used with --type fs-tree in general, but it’s
usually only useful to use them with --type fs-tree-leaf, since you’re
probably interested in finding particular filesystem records, not the
Virtual OIDs of other filesystem tree nodes:
--fsoid— Filesystem object ID (a.k.a inode number). The ID of a filesystem object whose records you wish to search for.--fsrt— Filesystem record type. The type of filesystem records that you wish to search for. See Filesystem record types below for a list of valid keyword values.
Filesystem record types
Keyword |
Equivalent value |
Description |
|---|---|---|
|
|
Any type |
|
|
Snapshot metadata |
|
|
Physical extent record |
|
|
Inode |
|
|
Extended attribute |
|
|
Sibling link; a mapping from target inode to source hard links which point to that target |
|
|
Data stream |
|
|
Per-file encryption state |
|
|
File extent record |
|
|
Dentry (directory entry) |
|
|
Directory information/statistics |
|
|
Snapshot name |
|
|
Sibling map; a mapping from hard link to target inode |
|
|
Additional info about file data |
|
|
The “invalid” record type |
Filesystem tree leaves (--type fs-tree-leaf)
This section describes parameters specific to each record type. They can only be
used in conjunction with --type fs-tree-leaf.
Dentries (--fsrt dentry)
The following search parameters can only be used in conjunction with
--fsrt dentry, since they are specific to dentries (directory entry records):
--dentry-name— The name of the item. Be careful to escape any commas in the name with backslash\, else they will be interpreted as logical OR operators. For example, compare--dentry-name 'Martian, The'and--dentry-name 'Martian\, The': the latter will search for items namedMartian, The, whereas the former will search for items namedMartianorThe(note also the leading space inThe, since leading and trailing whitespace is not ignored).--dentry-fsoid— The FSOID (a.k.a. inode number, file ID) of the item.