fsdb FileSystem [ - ]
The fsdb command enables you to examine, alter, and debug a file system, specified by the FileSystem parameter. The command provides access to file system objects, such as blocks, i-nodes, or directories. You can use the fsdb command to examine and patch damaged file systems. Key components of a file system can be referenced symbolically. This feature simplifies the procedures for correcting control-block entries and for descending the file system tree.
To examine a file system, specify it by a block device name, a raw device name, or a mounted file system name. In the last case, the fsdb command determines the associated file system name by reading the /etc/filesystems file. Mounted file systems cannot be modified.
The fsdb command has a different interface for a JFS file system and a JFS2 file system. The following explains how to use fsdb with a JFS file system. See JFS2 Subcommands for information about JFS2 subcommands.
The subcommands for the fsbd command allow you to access, view, or change the information in a file system. Any number you enter in the subcommand is considered decimal by default, unless you prefix it with either 0 to indicate an octal number or 0x to indicate a hexadecimal number. All addresses are printed in hexadecimal.
Because the fsdb command reads and writes one block at a time, it works with raw as well as with block I/O.
JFS is POWER-based platform only, and JFS2 is common to both platforms.
- | Disables the error checking routines used to verify i-nodes and block addresses. The O subcommand switches these routines on and off. When these routines are running, the fsdb command reads critical file system data from the superblock. The obtained information allows the fsdb command to access the various file system objects successfully and to perform various error checks. |
The fsdb subcommands
are requests to locate and display or modify information in the file
system. The main categories of subcommands are:
Category | Function |
Location | Access the information in the file system. |
Display | View the information in the file system. |
Modification | Change the information in the file system. |
In addition, there are a few miscellaneous subcommands.
There are two types of location subcommands:
Number[ I | M | i | b ]
OR
dDirectorySlot
The first type consists of a
number, optionally followed by an address specification. The address
specification defines how the preceding number is to be interpreted.
There are four address specifications corresponding to four different
interpretations of the Number variable:
I | I-node map block number |
M | Disk map block number |
i | I-node number |
b | Fragment number |
Depending on the address
specification (or absence of it), this type of location subcommand accesses
information as follows:
The second type of location subcommand is used to access directory entries. The subcommand consists of the character d followed by a directory-slot number. Directory-slot numbers start at 0 for each block of the associated i-node.
This type of location subcommand
accesses information as follows:
dDirectorySlot | Accesses the directory entry indexed by the DirectorySlot variable for the current i-node. Only allocated directory entries can be manipulated using this location subcommand. |
To view information relative to the address specification, use a display subcommand comprised of one of the display facilities in conjunction with one of the display formats, as follows:
p[Number]{ i | d | o | e | c | b | y | M | I | x | s | D }
f[Number]{ i | d | o | e | c | b | y | M | I | x | s | D }
The display formats for either
facility are:
The chosen display facility and display format remain in effect during the processing of the fsdb command until explicitly changed. You may receive an error message indicating improper alignment if the address you specify does not fall on an appropriate boundary.
If you use the Number,
MapBlockNumberI, or
FragmentNumberb location subcommands to access i-node
information, you can step through the data, 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. |
You can move forward or backward
through the information. The boundary advances with the display screen
and is left at the address of the last item displayed. The output can
be ended at any time by pressing the INTERRUPT key. The following
symbols allow movement through the information:
+ Number | Moves forward the specified number of units currently in effect. |
-Number | 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 the current address. |
< | Returns to the previously stored address. |
You can use dots, tabs, and spaces as subcommand delimiters, but they are only necessary to delimit a hexadecimal number from a subcommand that could be interpreted as a hexadecimal digit. Pressing 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 i-node, 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 a hexadecimal address followed by the hexadecimal representation of the data at that address and the decimal equivalent enclosed in parentheses. The fsdb command adds a .B or .D suffix 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-node number and the character representation of the entry name. It displays i-nodes with labeled fields describing each element. The environment variables control the formats of the date and time fields.
You can modify information relative to the address specification by using a field specification (for fields in the i-node and fields in the directory). The general form for assigning new values is: mnemonic operator new-value, where the mnemonic parameter represents one of the fields described in the following list:
The following mnemonics are used
for the names of the fields of an i-node and refer to the current working
i-node:
The following mnemonics refer to
the i-node and disk maps:
mf | Map free count |
ms | Map size |
mp | Permanent allocation bit map |
mw | Working allocation bit map |
The following mnemonics are used
for the names of the fields in directories:
rl | Length of directory entry record |
nl | Length of directory name |
nm | Directory name |
Valid values of the Operator parameter include:
Note: A file system must be unmounted before attempting to modify it.
= | Assigns the New-Value parameter to the specified Mnemonic parameter. |
=+ | Increment the Mnemonic parameter by the specified New-Value parameter. The default New-Value parameter is a value of one. |
=- | Decrease the Mnemonic by the specified New-Value. The default New-Value is a value of one. |
=" | Assigns the character string specified by the New-Value parameter to the specified Mnemonic parameter. If the current display format is the d address specification for directory and a mnemonic is not specified, the directory name is changed. The new directory name cannot be longer than the previous directory name. |
Miscellaneous subcommands
are:
q | Quits. |
xn | Expands a directory by n bytes where n plus the current size of the directory is not greater than the current directory's fragment in bytes. |
! | Escapes to the shell. |
O | Toggles error checking. |
These subcommands can be entered by their entire name or by using a subset
of the name. At least the bold letters must be entered.
a[lter] <block> <offset> <hex string> | Alters disk data. |
b[tree] <block> [<offset>] | Displays btree nodes. |
dir[ectory] <inode number> [<fileset>] | Displays directory entries. |
d[isplay] [<block> [<offset> [<format> [<count>]]]] | Displays data. |
dm[ap] [<block number>] | Displays dmap pages. |
dt[ree] <inode number> [<fileset>] | Displays dtree nodes. |
h[elp] [<command>] | Provides help on subcommands. |
ia[g] [<IAG number>] [a | <fileset>] | Displays IAG pages. |
i[node] [<inode number>] [a | <fileset>] | Displays inodes. |
q[uit] | Exits fsdb. |
su[perblock] [p | s] | Displays superblock. |
<block> | block number (decimal) |
<offset> | offset within block (hex) |
<hex string> | string of hex digits |
<block> | block number (decimal) |
<offset> | offset within block (hex) |
l | Visits left sibling |
m | Modifies current node |
p | Visits parent node |
r | Visits right sibling |
[0-9] | Visits the nth child node |
x | Exits subcommand mode |
<inode number> | inode number of directory (decimal) |
<fileset> | number, currently must be zero |
<block> | block number (decimal) |
<offset> | offset within block (hex) |
<format> | format in which to display data (see below) |
<count> | number of objects to display (decimal) |
a | ascii | |
i | inode | struct dinode |
I | inode allocation map | iag_t |
s | superblock | struct superblock |
x | hexadecimal |
<block number> | Displays dmap page which describes this block number. |
m | Modifies current node |
u | Visits upper level dmap page |
l | Visits left sibling |
r | Visits right sibling |
w | Displays wmap |
p | Displays pmap |
s | Displays stree |
x | Exits subcommand mode |
<inode number> | inode number of directory (decimal) |
<fileset> | fileset number, currently must be zero |
l | Visits left sibling |
m | Modifies current node |
p | Visits parent node (not parent directory) |
r | Visits right sibling |
[0-9] | Visits the nth child node |
x | Exits subcommand mode |
<command> | command name |
<IAG number> | IAG number (decimal) |
a | use aggregate inode table |
<fileset> | fileset number (currently must be zero) |
e | Displays/modifies inode extents map |
m | Modifies iag |
p | Displays/modifies persistent map |
w | Displays/modifies working map |
<inode number> | inode number (decimal) |
a | use aggregate inode table |
fileset | fileset number (currently must be zero) |
e | Displays/modifies inode's extended attributes. |
m | Modifies inode |
t | Displays/modifies inode's b-tree |
p | Displays primary superblock |
s | Displays secondary superblock |
The following examples show subcommands you can use after starting the fsdb command on a JFS file system.
386i
This command displays i-node 386 in i-node format. It now becomes the current i-node.
ln=4
ln=+1
fc
This command displays block 0 of the file associated with the current i-node in ASCII bytes.
2i.fd
This changes the current i-node to the root i-node (i-node 2) and then displays the directory entries in the first block associated with that i-node. One or more of the last entries displayed may have an i-node number of 0 (zero). These are unused directory blocks; such entries cannot be manipulated as in the next example.
d5i.fc
This command changes the current i-node 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.
1b.p0o
This command displays the superblock (block 1) of file system in octal.
2i.a0b.d7=3
This command changes the i-node of directory entry 7 in the root directory (2i) to 3. This example also shows how several operations can be combined on one line.
d7.nm="chap1.rec"
This command changes the name field of directory entry 7 to chap1.rec.
a2b.p0d
This command displays block 2 of the current i-node as directory entries.
7b. p0S
This command displays the block numbers allocated to the i-node that has a single indirect block at block 7.
OM
mp1.p10x
This command shows the allocation bit map at the current address; for example, at 0M.
/usr/sbin | Contains the fsdb command. |
/etc/filesystems | Contains information on the file systems. |
The dfsck command, fsck command.
The environment miscellaneous facility.
The read subroutine.
The File Systems Overview for System Management in AIX 5L Version 5.1 System Management Concepts: Operating System and Devices explains file system types, management, structure, and maintenance.
The Files Overview in AIX 5L Version 5.1 System User's Guide: Operating System and Devices provides information on working with files.