FSDB(8,C) AIX Commands Reference FSDB(8,C)
-------------------------------------------------------------------------------
fsdb
PURPOSE
Debugs file systems.
SYNTAX
+-----+ +------+
fsdb --- filesystem ---| |---| |---|
+- - -+ +- -a -+
DESCRIPTION
Warning: You should have a thorough working knowledge of the file system
structure if you want to use the fsdb command. Uninformed use of this command
can lead to serious, unrecoverable damage to the file system resulting in
extensive data loss. (You must have read and write permission on the device
being examined.)
You can use the fsdb command to examine and patch a damaged file system after a
system crash. It allows you to access blocks and i-numbers and to examine
various parts of an inode. You can reference components of the inode
symbolically. These features simplify procedures for correcting control-block
entries or for descending the file system tree.
The file system to be examined can be specified by a block device name or a raw
device name.
Any numbers you enter are considered decimal by default, unless you prefix them
with a 0 (zero) to indicate an octal number.
Because the fsdb command reads and writes one block at a time, it works with
raw as well as with block I/O. It uses a buffer management routine to retain
commonly used blocks of data in order to reduce the number of read system
calls. All assignment operations write the corresponding block immediately.
FLAGS
- Disables the error checking routines used to verify inode and block
addresses. The O subcommand toggles these routines on and off. When these
routines are running, the fsdb command reads the i-size and f-size entries
from the superblock of the file system.
-a Always execute for the file system specified, even if the magic number in
the superblock is invalid. Normally, the fsdb command does not work if the
superblock magic number is invalid.
Processed November 8, 1990 FSDB(8,C) 1
FSDB(8,C) AIX Commands Reference FSDB(8,C)
PARAMETERS
The fsdb subcommands allow you to display or modify information. A display
subcommand is a block address optionally followed by a display format
specification. A field modification subcommand is similar to the display
subcommand but may include a subfield specification, an operator, and a value.
An address specification is a number optionally followed by a type specifier
and subfield specification.
The display subcommands are:
CL Displays the commit list if the file system is replicated.
num Displays data at absolute address num.
i-numberi Displays data at i-number.
block-addressb Displays data at block-address, specified in 4096-byte
units.
ddirectory-slot-offset
Displays data at directory-slot-offset.
S Displays the superblock.
q Quits.
A Aborts and causes a core dump.
? Prints a synopsis of the fsdb subcommands.
! Escapes to the shell.
The display formats are:
p General display facilities.
f File display facility.
You can step through the inode information examining each byte, word, or double
word. Select the desired display mode by entering one of the following
subcommands:
B Begins displaying in byte mode.
D Begins displaying in double word mode.
W Begins displaying in word mode.
O Toggles error checking on or off.
Moving forward or backward through the inode data is done with the following
symbols:
+num Moves forward the specified number of units currently in
effect.
-num Moves backward the specified number of units currently in
effect.
The following symbols allow you to store the current address and return to it
conveniently:
> Stores current address for later reference.
< Returns to the previously stored address.
Processed November 8, 1990 FSDB(8,C) 2
FSDB(8,C) AIX Commands Reference FSDB(8,C)
The display format applied to the information at the selected address is the
one currently in effect. You may receive an error message indicating improper
alignment if the address you specify does not fall on an even boundary.
The display facilities display a formatted output in various styles. The
current address is normalized to an appropriate boundary before display begins.
It advances with the displaying and is left at the address of the last item
displayed. The output can be ended at any time by pressing INTERRUPT (Ctrl-C).
If you enter a number after the p symbol, the fsdb command displays that number
of entries. A check is made to detect block boundary overflows because
logically sequential blocks are generally not physically sequential. If you
enter a count of zero, the fsdb command displays all entries to the end of the
current block.
The display formats available are:
i Displays as inodes.
d Displays as directories.
o Displays as octal words.
e Displays as decimal words.
c Displays as characters.
b Displays as octal bytes.
r Displays as small-block directory.
x Displays as hex words.
y Displays as hex bytes.
Use the f symbol to display data blocks associated with the current inode. If
you enter a number after f, the fsdb command displays that block of the file.
Block numbering begins at zero. The desired display subcommand follows the
block number, if present, or the f symbol. The display facility works for
large as well as small files. It checks for special devices and also checks
the data are not zero.
You can use . (dots), tabs, and spaces as subcommand delimiters, but they are
not necessary. Pressing just the Enter key (entering a blank line) increments
the current address by the size of the data type last displayed. That is, the
address is set to the next byte, word, double word, directory entry or inode,
allowing you to step through a region of a file system. The fsdb command
displays information in a format appropriate to the data type. Bytes, words
and double words are displayed as an octal address followed by the octal
representation of the data at that address and the decimal equivalent enclosed
in parentheses. The fsdb adds a .B or .D to the end of the address to indicate
a display of byte or double word values. It displays directories as a
directory slot offset followed by the decimal i-number and the character
representation of the entry name. The command displays inodes with labeled
fields describing each element. The environment variables LANG and LC_TIME
control the formats of the date and time.
The following mnemonics are used for the names of the fields of an inode and
refer to the current working inode:
Processed November 8, 1990 FSDB(8,C) 3
FSDB(8,C) AIX Commands Reference FSDB(8,C)
md Permission mode
ln Link count
uid User number
gid Group number
sz File size
nm Directory name
cc Commit count
fs fstore value
qid Unique creation ID
v Version
sb Small-block flag
an Data block numbers (0 - 12)
at Access time
mt Modification time
maj Major device number
min Minor device number
df Inode dflags
site Device site number
The following mnemonics are used to modify super-block information:
M Magic number (valid only if -a option is used)
fsz File system size
gfs Global file system number
gp gfs pack number
isz Inode table size
t Modification time
V File system version
Fs fstore value
I Free inode list in superblock
SF Free block list in superblock
H High-water mark
L Low-water mark
P Read-only flag
C Free-block list offset
CL Commit list for replicated file system
The following mnemonics are used for small-block examination:
zf Small-block flag
zd Small-block data area
zr Small-block directory slot
The general form for assigning new values is:
mnemonic operator new-value
The fsdb command modifies the value of the field specified by mnemonic
according to the operator and new-value.
Valid operators include:
Processed November 8, 1990 FSDB(8,C) 4
FSDB(8,C) AIX Commands Reference FSDB(8,C)
= Assign new-value to the specified mnemonic.
=+ Increment the mnemonic by the specified new-value. The default new-value
is 1.
=- Decrease the mnemonic by the specified new-value. The default new-value is
1.
=" Assign character string new-value to the specified mnemonic.
EXAMPLES
The following examples show subcommands that you can use after starting the
fsdb command.
1. To display an inode:
386i
This command displays i-number "386" in inode format. It now becomes the
current inode.
2. To change the link count for the current inode to "4":
ln=4
3. To increase the link count of the current inode by "1":
ln=+1
4. To display part of the file associated with the current inode:
fc
This displays as ASCII text block zero of the file associated with the
current inode.
5. To display entries of a directory:
2ifd
This changes the current inode to the root inode (inode "2"), then displays
the directory entries in the first block associated with that inode.
6. To go down a level of the directory tree:
d5ifc
This changes the current inode to the one associated with directory entry
"5". Then it displays the first block of the file as ASCII text ("fc").
Directory entries are numbered starting from 0 (zero).
7. To display a block when you know its block number:
Processed November 8, 1990 FSDB(8,C) 5
FSDB(8,C) AIX Commands Reference FSDB(8,C)
1bp0o
This displays the superblock (block "1") of file system in octal.
8. To change the i-number of a directory entry:
2.a0b.d7=3
This changes the i-number of directory entry "7" in the root directory
("2i") to "3". This example also shows how several operations can be
combined on one line.
9. To change the file name of a directory entry:
d7nm="chap1.rec"
This changes the name field of directory entry "7" to "chap1.rec".
10. To display a given block of the file associated with the current inode:
a2bp0d
This displays block "2" of the current inode as directory entries.
11. To display the superblock:
S
This displays the fields of the superblock for this file system.
12. To display the commit list:
CL
This displays the commit list if the file system is replicated.
13. To display directory entries in a small-block file:
zdp0r
This displays the small-block area of the current inode as directory
entries.
14. To display the data in a small-block file:
zdp200c
This displays the first 200 characters of the small-block file for the
current inode.
15. To change a directory entry in a small-block file:
Processed November 8, 1990 FSDB(8,C) 6
FSDB(8,C) AIX Commands Reference FSDB(8,C)
zr7=100
This changes the i-number of the seventh directory slot in the current
small-block file to 100.
16. To change the name field in a small-block directory entry:
zr5nm="new.name"
This changes the name field of small-block directory entry five to
new.name.
17. To go down a level in a small-block directory tree:
zr8i
This changes the current inode to be the inode corresponding to the
directory entry number 8 in the small-block file.
RELATED INFORMATION
See the following commands: "fsck, dfsck."
See the fs and dir files and the environment miscellaneous facility in AIX
Operating System Technical Reference.
See the "Introduction to International Character Support" in Managing the AIX
Operating System.
Processed November 8, 1990 FSDB(8,C) 7