fsdb_hfs: fsdb - HFS file system debugger
Always execute the command (see fsck(1M)) after running
The command can be used to patch up a damaged file system after a
Options and Arguments
recognizes the following options and arguments.
special The file name of the special file containing the
Initially disable the error-checking routines
that are used to verify the inode and fragment
addresses. See the symbol. If used, this option
must follow special on the command line.
Use blocknum as the superblock for the file system.
If used, this option must follow special on the
Specify the HFS file system type.
Echo the completed command line, but perform no other action.
The command line is generated by incorporating
the user-specified options and other information
derived from the file. This option allows the
user to verify the command line.
normally uses the first superblock for the file system, located at the
beginning of the disk section, as the effective superblock. An alter‐
nate superblock can always be found at block typically block 16. The
option can be used to specify the superblock location.
deals with the file system in terms of block fragments, which are the
unit of addressing in the file system and the minimum unit of space
allocation. To avoid possible confusion, fragment is used to mean
that, and block is reserved for the larger true block. has conversions
to translate fragment numbers and i-numbers into their corresponding
disk addresses. Also included are mnemonic offsets to access different
parts of an inode. These greatly simplify the process of correcting
control block entries or descending the file system tree.
contains several error-checking routines to verify inode and fragment
addresses. These can be disabled if necessary by invoking with the
optional argument, or by using the symbol.
Numbers are considered decimal by default. Octal numbers must be pre‐
fixed with a zero. Hexadecimal numbers must be prefixed with During
any assignment operation, numbers are checked for a possible truncation
error due to a size mismatch between source and destination.
reads a fragment at a time. A buffer management routine is used to
retain commonly used fragments of data in order to reduce the number of
read system calls. All assignment operations result in an immediate
write-through of the corresponding fragment.
The following symbols are recognized by
Escape to shell
Restore an address
Save an address
Character string assignment
Convert from fragment number to disk address (historically
Directory slot offset
File print facility
Convert from i-number to inode address;
for continuation inodes as well as primary inodes
General print facility
Error checking flip-flop
Dots, tabs, and spaces can be used as function delimiters, but are not
necessary. A line with just a newline character increments the current
address by the size of the data type last printed. That is, the
address is set to the next byte, word, double word, directory entry, or
inode, allowing the user to step through a region of a file system.
Information is printed in a format appropriate to the data type. If
the toggle is off, bytes, words, and double words are printed in the
If the toggle is on, bytes, words, and double words are printed in the
If the (byte) or (double-word) mode is in effect, the colon shown above
is preceded by or respectively.
Directories are printed as a directory slot offset followed by the dec‐
imal i-number and the character representation of the entry name.
Inodes are printed with labeled fields describing each element.
The print facilities generate a formatted output in various styles.
Octal numbers are prefixed with a zero. Hexadecimal numbers are pre‐
fixed with The current address is normalized to an appropriate boundary
before printing begins. It advances with the printing and is left at
the address of the last item printed. The output can be terminated at
any time by typing the interrupt character. If a number follows the
symbol, that many entries are printed. A check is made to detect frag‐
ment boundary overflows since logically sequential blocks are generally
not physically sequential. If a count of zero is used, all entries to
the end of the current fragment are printed. The print options avail‐
Print as octal bytes
Print as characters
Print as directories
Print as decimal words
Print as inodes (primary or continuation)
Print as octal words
Print as hexadecimal words
The symbol prints data fragments associated with the current inode. If
followed by a number, that fragment of the file is printed. (Fragments
are numbered from zero). The desired print option letter follows the
fragment number, if present, or the symbol. This print facility works
for small as well as large files except for special files such as
FIFOs, and device special files.
Inode and Directory Mnemonics
The following mnemonics are used for inode examination and refer to the
current working inode:
Data block numbers
(num is in the range 0 − 14)
Time last accessed
Continuation inode number
Last time inode changed
Group ID number
Major device number
Minor device number
Time last modified
File size in byte unit
User ID number
The following mnemonics are used for directory examination:
I-number of the associated directory entry
Name of the associated directory entry
Print i-number 386 in an inode format.
This now becomes the current working inode.
Change the link count for the working inode to 4.
Increment the link count by 1.
Print in ASCII fragment zero of the file associated with the working
Print the first fragment-size piece of directory entries
for the root inode of this file system.
Change the current inode to that associated with the
fifth directory entry (numbered from zero) found from
the above command. The first fragment's worth of bytes
of the file are then printed in ASCII.
Print the first fragment of the superblock of this file system
Change the i-number for the seventh directory slot
in the root directory to 3. This example also shows how
several operations can be combined on one command line.
Change the name field in the directory slot to the given string.
Quotes are optional if the first character of the name
field is alphabetic.
Print the third fragment of the current inode as directory entries.
Only experienced users should use The failure to fully understand the
usage of and the file system's internal organization can lead to com‐
plete destruction of the file system and total loss of data.
was developed by HP and AT&T.
Static information about the file systems
SEE ALSOdumpfs(1M), fsck(1M), fsdb(1M), stat(2), dir(4).