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 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 }
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. |
The following examples show subcommands you can use after starting the fsdb command.
386iThis command displays i-node 386 in i-node format. It now becomes the current i-node.
ln=4
ln=+1
fcThis command displays block 0 of the file associated with the current i-node in ASCII bytes.
2i.fdThis 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.fcThis 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.p0oThis command displays the superblock (block 1 ) of file system in octal.
2i.a0b.d7=3This 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.p0dThis command displays block 2 of the current i-node as directory entries.
7b. p0SThis command displays the block numbers allocated to the i-node that has a single indirect block at block 7.
OM
mp1.p10xThis 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 Version 4.3 System Management Guide: Operating System and Devices explains file system types, management, structure, and maintenance.
The Files Overview in AIX Version 4.3 System User's Guide: Operating System and Devices provides information on working with files.