FSDB(1M) INTERACTIVE UNIX System FSDB(1M)
NAME
fsdb - file system debugger
SYNOPSIS
/etc/fsdb special [ - ]
DESCRIPTION
The fsdb command can be used to patch up a damaged file sys-
tem after a crash. It has conversions to translate block
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.
The fsdb command contains several error-checking routines to
verify inode and block addresses. These can be disabled if
necessary by invoking fsdb with the optional - argument or
by the use of the O symbol. (fsdb reads the i-size and f-
size entries from the super block of the file system as the
basis for these checks.)
Numbers are considered decimal by default. Octal numbers
must be prefixed with a zero. During any assignment opera-
tion, numbers are checked for a possible truncation error
due to a size mismatch between source and destination.
The fsdb command reads a block at a time and will therefore
work with raw as well as block I/O. A buffer management rou-
tine is used to retain commonly used blocks of data in order
to reduce the number of read system calls. All assignment
operations result in an immediate write-through of the
corresponding block.
The symbols recognized by fsdb are:
# absolute address
i convert from i-number to inode address
b convert to block address
d directory slot offset
+,- address arithmetic
q quit
>,< save, restore an address
= numerical assignment
=+ incremental assignment
=- decremental assignment
=" character string assignment
O error checking flip flop
p general print facilities
f file print facility
B byte mode
W word mode
D double word mode
! escape to shell
Rev. Base System Page 1
FSDB(1M) INTERACTIVE UNIX System FSDB(1M)
The print facilities generate a formatted output in various
styles. 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 delete character. If a number follows the p symbol,
that many entries are printed. A check is made to detect
block 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 block are
printed. The print options available are:
i print as inodes
d print as directories
o print as octal words
e print as decimal words
c print as characters
b print as octal bytes
The f symbol is used to print data blocks associated with
the current inode. If followed by a number, that block of
the file is printed. (Blocks are numbered from zero.) The
desired print option letter follows the block number, if
present, or the f symbol. This print facility works for
small as well as large files. It checks for special devices
and checks that the block pointers used to find the data are
not zero.
Dots, tabs, and spaces may be used as function delimiters
but are not necessary. A line with just a new-line charac-
ter will increment 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. Bytes, words, and double words are displayed with the
octal address followed by the value in octal and decimal. A
.B or .D is appended to the address for byte and double word
values, respectively. Directories are printed as a direc-
tory 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 following mnemonics are used for inode examination and
refer to the current working inode:
md mode
ln link count
uid user ID number
gid group ID number
sz file size
a# data block numbers (0 - 12)
at access time
mt modification time
maj major device number
Rev. Base System Page 2
FSDB(1M) INTERACTIVE UNIX System FSDB(1M)
min minor device number
EXAMPLES
386i prints i-number 386 in an inode format.
This now becomes the current working inode.
ln=4 changes the link count for the working inode
to 4.
ln=+1 increments the link count by 1.
fc prints, in ASCII, block zero of the file
associated with the working inode.
2i.fd prints the first 32 directory entries for
the root inode of this file system.
d5i.fc changes the current inode to that associated
with the 5th directory entry (numbered from
zero) found from the above command. The
first logical block of the file is then
printed in ASCII.
512B.p0o prints the super block of this file system
in octal.
2i.a0b.d7=3 changes the i-number for the seventh direc-
tory slot in the root directory to 3. This
example also shows how several operations
can be combined on one command line.
d7.nm="name" changes the name field in the directory slot
to the given string. Quotes are optional
when used with nm if the first character is
alphabetic.
a2b.p0d prints the third block of the current inode
as directory entries.
SEE ALSO
fsck(1M).
dir(4), fs(4) in the INTERACTIVE SDS Guide and Programmer's
Reference Manual.
Rev. Base System Page 3