Debugs file systems.
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.
If the file system specified is a JFS2 snapshot, the fsdb command enables examination and modification of the snapshot superblock, snapshot map, block map xtree copy, and segment headers. See JFS2 Snapshot Subcommands for information about JFS2 snapshot 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.
- | 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 }
OR
f[Number]{ i | d | o | e | c | b | y | M | I | x | s | D }
The display facilities are:
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[map] [<block number>] | Displays block allocation map. |
dir[ectory] <inode number> [<fileset>] [R] | Displays directory entries. |
d[isplay] [<block> [<offset> [<format> [<count>]]]] | Displays data. |
dt[ree] {<block number> |<inode number>{a | f } } | Displays dtree nodes. |
h[elp] [<command>] | Provides help on subcommands. |
ia[g] [<IAG number>] [a | <fileset>] | Displays IAG pages. |
im[ap] [a | <fileset>] | Displays inode allocation map. |
i[node] [<inode number>] [a | <fileset>] | Displays inodes. |
q[uit] | Exits fsdb. |
su[perblock] [p | s] | Displays superblock. |
x[tree] {<block number> | <inode number>{a | f}} | Displays xtree nodes. |
<block> | block number (decimal) |
<offset> | offset within block (hex) |
<hex string> | string of hex digits |
m | modify current node |
u | visit upper level bmap page |
l | visit left sibling |
r | visit right sibling |
w | display wmap |
p | display pmap |
s | display stree |
x | exit subcommand mode |
<inode number> | inode number of directory (decimal) |
<fileset> | number, currently must be zero |
R | recursively lists all subdirectories |
<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> | block number containing a dtree page |
<inode number> | inode number of directory (decimal) |
{a | f} | 'a' indicates inode number is an aggregate inode. 'f' indicates inode number is a fileset inode. |
m | Modifies current node |
f | Walks freelist entries |
s | Displays specified slot entry |
[0-9]+ | Displays specified stbl entry |
t | Displays formatted stbl |
u | Visits parent node (not parent directory) |
d | Visits 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 |
a | use aggragate inode table |
<fileset> | fileset number (currently must be zero) |
e | Displays/modifies inode extents map |
m | Modifies iag |
p | Displays/modifies persistent map |
<inode number> | Inode number (decimal) |
a | Use aggregate inode table |
fileset | Fileset number (currently must be zero) |
m | Modifies inode |
t | Displays/modifies inode's b-tree |
e | display/modify inode's EAs |
p | Displays primary superblock |
s | Displays secondary superblock |
<block number> | block number (decimal) |
<inode number> | inode number |
{a | f} | 'a' indicates inode number is an aggregate inode. 'f' indicates inode number is a fileset inode. |
m | Modifies current node |
u | Visits parent node |
d | Visits child node |
n | Visits right sibling |
p | Visits left sibling |
s | Selects xad entry to view |
x | Exits subcommand mode |
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[map] | Displays block map xtree copy. |
d[isplay] [<block> [<offset> [<format> [<count>]]]] | Displays data. |
h[elp] [<command>] | Provides help on subcommands. |
q[uit] | Exits fsdb. |
st[able] [<block number>] | Displays summary snapshot table. |
s[map] <block number> | Displays snapshot bit map. |
su[perblock] | 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) |
<format> | format in which to display data (see below) |
<count> | number of objects to display (decimal) |
a | ascii | |
s | snapshot segment header | |
t | snapshot table page | |
x | xtree page |
<command> | command name |
<block number> | block number (decimal) |
<block number> | block number (decimal) |
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 in AIX 5L Version 5.2 System Management Concepts: Operating System and Devices explains file system types, management, structure, and maintenance.
The Files Overview in AIX 5L Version 5.2 System User's Guide: Operating System and Devices provides information on working with files.