|HP-UX Reference > F
HP-UX 11i Version 3: February 2007
fsdb_hfs: fsdb — HFS file system debugger
/usr/sbin/fsdb [-F hfs] [-V] special [-b blocknum] [-]
Always execute the fsck command (see fsck(1M)) after running fsdb.
The fsdb command can be used to patch up a damaged file system after a crash.
Options and Arguments
fsdb recognizes the following options and arguments.
fsdb normally uses the first superblock for the file system, located at the beginning of the disk section, as the effective superblock. An alternate superblock can always be found at block ((SBSIZE+BBSIZE)/DEV_BSIZE), typically block 16. The -b option can be used to specify the superblock location.
fsdb 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. fsdb 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.
fsdb contains several error-checking routines to verify inode and fragment addresses. These can be disabled if necessary by invoking fsdb with the optional - argument, or by using the O symbol.
Numbers are considered decimal by default. Octal numbers must be prefixed with a zero. Hexadecimal numbers must be prefixed with 0x. During any assignment operation, numbers are checked for a possible truncation error due to a size mismatch between source and destination.
fsdb 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 fsdb:
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 X toggle is off, bytes, words, and double words are printed in the form:
octal-address : octal-value (decimal-value)
If the X toggle is on, bytes, words, and double words are printed in the form:
hex-address : hex-value
If the B (byte) or D (double-word) mode is in effect, the colon (:) shown above is preceded by .B or .D, respectively.
Directories are printed as a directory slot offset followed by the decimal 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 prefixed with 0x. 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 p symbol, that many entries are printed. A check is made to detect fragment 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 available are:
The f 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 f 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:
The following mnemonics are used for directory examination:
Only experienced users should use fsdb. The failure to fully understand the usage of fsdb and the file system's internal organization can lead to complete destruction of the file system and total loss of data.