.\" Copyright (c) 1988 Regents of the University of California.
.\" This code is derived from software contributed to Berkeley by
.\" Computer Consoles Inc.
.\" %sccs.include.redist.man%
.\" @(#)fsdb.8 6.3 (Berkeley) %G%
fsdb \- file system debugger
override some error conditions
it is able to circumvent normal
Extreme caution is advised
in determining its availability
Suggested permissions are 600
to translate block and i-numbers
into their corresponding disk addresses.
Also included are mnemonic offsets
to access different parts
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 block addresses.
These can be disabled if necessary
and will therefore work with raw as well as block
A buffer management routine
is used to retain commonly used
in order to reduce the number of read system calls.
All assignment operations result
in an immediate write-through
of the corresponding block.
Note that in order to modify
Numbers are considered hexadecimal by default.
However, the user has control over how data is
or set the input/output base.
all input will default to this base
and all output will be shown in this base.
The base can be overriden temporarily for input by
preceding hexadecimal numbers with '0x', preceding
decimal numbers with '0t', or
Hexadecimal numbers beginning with a-f or A-F must
to distinguish them from commands.
offers many commands to convert
a desired inode, directory entry,
block, superblock etc. to a
Once the address has been calculated,
will record the result in
Several global values are maintained by
the current base (referred to as
the current address (referred to as
the current inode (referred to as
the current count (referred to as
and the current type (referred to as
Most commands use the preset value of
will first set the value of
to 2, ':' will alert the start of a command,
A count is specified after a ','.
will remain at this value
until a new command is encountered
which will then reset the value back to 1 (the default).
will be 2000 + 400 * sizeof (long).
If a carriage-return is then typed,
the output routine will use the
and display 400 more hex longs.
A '*' will cause the entire block to
End of fragment, block and file are maintained by
When displaying data as fragments or blocks,
an error message will be displayed when the end of fragment
When displaying data using the
commands an error message is displayed if the
end of a directory or file
and getting unknown and unwanted results.
An example showing several commands and
the use of carriage-return would be:
The two examples are synonymous for getting to the first
directory entry of the root of the file system.
subsequent carriage-returns (or +, -) will advance to subsequent
The symbols recognized by
and display using the current value of
numeric expressions may be composed of +, -, *, and % operators
(evaluated left to right) and may use parentheses. Once evaluated,
count indicator. The global value of
will remain until a new command is run.
A count specifier of '*' will attempt to show a
display in structured style with format
(see FORMATTED OUTPUT section).
display in unstructured style with format
(see FORMATTED OUTPUT section).
The amount actually incremented is dependent
dot = dot + e * sizeof (type)
Multiplication and division don't
In the above calculation of
restore an address saved in register
must be a single letter or digit.
save an address in register
must be a single letter or digit.
is a legitimate format specifier
The address pointed to by
has its contents changed to the value of the
This may be useful for changing
The address pointed to by
has its contents incremented by expression
The address pointed to by
has its contents decremented by expression
A command must be prefixed by a ':' character.
Only enough letters of the command
distinguish it are needed.
Multiple commands may be entered
on one line by separating
them by a space, tab or ';'.
In order to view a potentially
unmounted disk in a reasonable
The functionality of these
commands substantially matches those of
(see individual command for details).
The '*', '?', and '[-]' wild card
characters are available.
display or set base. As stated above,
all input and output is governed by
Note that this is interpreted
so to ensure correctness use the '0', '0t', or '0x'
change the current directory
then change directories to
is converted to a directory
slot offset in that directory
a relative block count from the
is updated to the first byte
.BI find " dir [-name n] [-inum i]\^"
find files by name or i-number.
and below for filenames whose
Note that only one of the two options
Also, the -print is not needed or
fill an area of disk with pattern
The only difference between the
command is the amount that
will be updated as well as
As a convenient shorthand,
if ':inode' appears at the
and that inode is displayed
.BI ls " [-R] [-l] pat1 pat2 ...\^"
list directories or files.
the current directory is assumed.
options may be used (but, if used,
The long listing shows only
the i-number and the name;
toggle the value of override.
Some error conditions may be
if override is toggled on.
change the fsdb prompt to
must be surrounded by (")s.
display the current working directory.
is taken as a cylinder group
number and then converted to
the address of the superblock
superblock and display it
In addition to the above commands,
there are several commands that deal with inode
fields and operate directly on the current
(they still require the ':').
They may be used to more easily display
or change the particular fields.
is only used by the ':db'
Upon completion of the command,
increment the link count of the current
to the address of the link
where direct blocks number from
In order to display the block
itself, you need to 'pipe' this
would get the contents of
data block field 1 from the inode and
convert it to a block address.
20 longs are then displayed in hexadecimal
(see FORMATTED OUTPUT section).
as an indirect block index
where indirect blocks number from
This will only get the indirect block itself
(the block containing the pointers to the actual blocks).
command and start at block 12 to get to the actual
operates on the directory
Once poised at the desired
directory entry (using the
will get the 7th directory
and change its name to foo.
cannot be made larger than the
the string is truncated to fit
and a warning message to this
The two styles are structured and
Structured output is used to display
inodes, directories, superblocks and the
Unstructured just displays
The following table shows the
different ways of displaying:
display as cylinder groups
display as octal shorts or longs
display as decimal shorts or longs
display as hexadecimal shorts or longs
The format specifier immediately follows
the '/' or '?' character.
The values displayed by '/b' and all '?'
formats are displayed in the current
will display 2010 in decimal (use of
display i-number 386 in an inode format.
This now becomes the current
changes the link count for the
increments the link count by 1.
display the creation time as a hexadecimal long.
display the modification time in time format.
block zero of the file associated
displays the first blocks worth of directory entries for
the root inode of this file system.
It will stop prematurely if the eof is reached.
> 5:dir:inode; 0:file,*/c
changes the current inode to that
associated with the 5th directory entry
The first logical block of the file
displays the superblock of this file system.
displays cylinder group information and summary
changes the i-number for the
seventh directory slot in the root directory to 3.
displays the third block of the current
> 3c3:fragment,20:fill=0x20
get fragment 3c3 and fill 20
set the contents of address 2050 to 0xffffffff.
0xffffffff may be truncated depending on the current
> 1c92434="this is some text"
Extreme caution is advised in
determining the availability
Suggested permissions are 600 and