Symantec logo

fsdb_vxfs

NAME

fsdb_vxfs - VxFS file system debugger

SYNOPSIS

fsdb [ -F vxfs ] [ generic_options ] special

AVAILABILITY

VRTSvxfs

DESCRIPTION

fsdb provides the functionality to analyze file system problems or repair a damaged VxFS file system after a crash. A special device special specifies the file system to debug. fsdb is intended for experienced users only.

fsdb can convert block and inode numbers into their corresponding disk addresses. There are also mnemonic offsets to access different parts of an inode. These greatly simplify the process of correcting control block entries or descending the file system tree.

By default, numbers are in decimal. You must prefix octal numbers with 0, and prefix hexadecimal numbers with 0x. When using hexadecimal numbers, it is preferable to follow the number with a space because several commands are letters that are also hexadecimal digits. A pound sign ( # ) indicates that a number is specified.

fsdb reads a block at a time and works with raw and block I/O. All I/O is unbuffered, so changes made to the file system are immediate and changes made by other processes or by the kernel are immediately seen by the command.

Cluster File System Issues

Although there are no specific cluster file system issues with this command, fsdb is meant for knowledgeable VxFS file system users and should be used very carefully to avoid losing data.

OPTIONS

generic_options

Supported by the generic fsdb command. See fsdb(1M).

-F vxfs

Specifies the VxFS file system type.

The following symbols are recognized by fsdb:

h [ mod | print ]

Print summary of commands that display [modify|format] the file system.

? [ mod | print ]

Print summary of commands that display [modify|format] the file system.

help [ mod | print ]

Print summary of commands that display [modify|format] the file system.

!

Escape to shell.

|

Pipe output of fsdb command to a shell command.

q

Quit.

"string"

A character string. Inside a character string, a NULL character may be specified with ''\e0''; a double quote can be specified with ''\e"''; and a backslash can be specified with ''\e\e''.

+ - * / %

Add, subtract, multiply, divide, and modulus.

=

Assignment.

i

An inode in the primary inode list.

ai

An inode in the attribute inode list.

au

An allocation unit.

b

A block.

im

The immediate data area of an inode. Small directories and symbolic link files (96 bytes or less) are stored directly in the inode itself, in the area normally occupied by data block numbers and extent sizes.

attr

An attribute inode.

cdb

Current directory block.

d

A directory entry.

a

An inode address entry.

B

A byte.

H

A half-word (2 bytes).

W

A word (4 bytes).

D

A double-word (8 bytes).

p

General print facility.

calc

Simple calculator and base converter.

find

Find a matching pattern in the file system.

fset

A fileset.

iau

An inode allocation unit in the primary inode list.

aiau

An inode allocation unit in the attribute inode list.

cut

The current usage table.

olt

The object location table.

mapi

Map logical file offset to an inode extent.

reset

Reset device.

The print facility recognizes the following print formats:

c

Print as characters.

db

Print as a directory block.

dent

Print as directory entries.

dh

Print as a directory header.

e

Print as decimal words.

eB eH eW eD

Print as decimal bytes, half-words, words, or double-words.

o

Print as octal words.

oB oH oW oD

Print as octal bytes, half-words, words, or double-words.

u

Print as unsigned words.

uB uH uW uD

Print as unsigned bytes, half-words, words, or double-words.

x

Print as hexadecimal words.

xB xH xW xD

Print as hexadecimal bytes, half-words, words, or double-words.

oltext

Print as an object location table extent.

A

Print as an allocation-unit header.

AS

Print as an auxiliary super-block.

C

Print as current usage table entries.

DV

Print as a device record.

F

Print as fileset headers.

I

Print as inodes.

IA

Print as an inode allocation unit header.

L

Print as intent-log records.

Q

Print as a quota record.

S

Print as a super-block.

ST

List state table blocks.

T

Print as typed extent descriptors.

Changes to inode fields can be made symbolically. The following symbols represent inode fields:

md

Inode mode field.

ln

Inode link count field.

uid

Inode user. ID Number field.

gid

Inode group. ID Number field.

szlo

Low-order word of inode file size field.

szhi

High-order word of inode file size field.

sz

Inode file size field.

de#

Inode direct extent data block numbers (0 - 9).

des#

Inode direct extent sizes (0 - 9).

ie#

Inode indirect extent data block numbers (0 - 1).

ies

Inode indirect extent size.

at

Inode access time field (seconds).

ats

Inode access time field (microseconds).

ct

Inode change time field (seconds).

cts

Inode change time field (microseconds).

mt

Inode modification time field (seconds).

mts

Inode modification time field (microseconds).

af

Inode allocation flags field.

gen

Inode generation count field.

org

Inode mapping type field.

fe

Inode fixed extent size field.

bl

Inode blocks held field.

eopflg

Inode extended operation flag field.

eopdat

Inode extended operation data field.

rdev

If device, inode device number.

maj

If device, inode major number.

min

If device, inode minor number.

pd

If directory, inode parent directory.

res

If regular file, inode reservation.

verhi

Inode high-order word of serial number.

verlo

Inode low-order word of serial number.

fsindex

Referencing fileset ID.

matching

Inode number of matching inode.

iano

Indirect attribute inode.

Changes to directory block fields can be made symbolically. The following symbols represent directory block fields:

tfree

Total free space (only if in a data block).

hash#

Hash chain start (0 through 31, only if in a data block).

d#

Directory entry (variable number of entries).

nhash

Number of hash chains.

Changes to directory entry fields can be made symbolically. The following symbols represent directory entry fields:

ino

Inode number

nm

Entry name

nmlen

NAME length

reclen

Record length (only if in a data block)

hnext

NAME hash next (only if in a data block)

It is best to separate each token on a command line with a space. Although the command parser does not require element separation, there is no ambiguity in the command language if each token is separated by a space. For example, the command 0x23b b sets the current position to block 0x23b hexadecimal. The command 0x23bb is invalid because the command is parsed as a hexadecimal number. The command 23b positions to block 23 (decimal) because the command is not ambiguous.

You can separate commands with newlines. You can put multiple commands on one line and separate them with a dot (.) or a semicolon (;). If multiple commands are placed on one line, generally only the last command displays results. This allows positioning commands to be followed by printing commands or change commands without intermediate printing.

fsdb maintains several positions in the file system:

These are used by various fsdb commands. (The au positions are not supported on Version 2 disk layouts and above).

The following commands are supported:

# B|H|W|D

Set the current position in the file system to the specified offset in bytes, half-words, words, or double-words. If it is the last command on a line, print the byte, half-word, word, or double-words in hexadecimal.

+|- # B|H|W|D

Set the current position to specified relative offset in bytes, half-words, words, or double-words. If it is the last command on a line, print the byte, half-word, word, or double-words in hexadecimal.

# au

Set the current position in the file system to the specified allocation unit (au) position. Set the current allocation unit position to the resulting offset. If it is the last command on a line, print the allocation unit header.

+|- # au

Set the current position in the file system to the specified position relative to the current allocation unit (au) position. Set the current allocation unit position to the resulting offset. If it is the last command on a line, print the allocation unit header.

au

Set the current position in the file system to the current allocation unit position. If it is the last command on a line, print the allocation unit header.

# b

Set the current position in the file system to the specified offset in blocks. Set the current block position to the resulting offset. The block size is the block size of the file system. If it is the last command on a line, print the first word in the block in hexadecimal.

+|- # b

Set the current position to specified relative offset in blocks. Set the current block position to the resulting offset. If it is the last command on a line, print the first word in the block in hexadecimal.

b

Set the current position to current block position (the block specified by the last [+|-] # b operation). If it is the last command on a line, print the first word in the block in hexadecimal.

cut

Set the current position to the current usage table (cut). If it is the last command on a line, print the first current usage table entry.

dev

Set the current position to the primary device's configuration record. If it is the last command on a line, print the device-configuration record.

# fset

Set the current position in the file system to the fileset header entry for the specified fileset index. Set the current fileset position to the resulting offset. If it is the last command on a line, print the specified fileset header.

+|- # fset

Set the current position in the file system to the fileset header entry for the specified position relative to the current fileset position. Set the current fileset position to resulting offset. If the last command on a line, print the specified fileset header.

fset

Set the current position in the file system to the current fileset position. If it is the last command on a line, print the fileset header for the current fileset.

# aiau

Set the current position in the file system to the specified attribute inode allocation unit (aiau) in a fileset. Set the current attribute inode allocation unit position to the resulting offset. If it is the last command on a line, print the attribute inode allocation unit header.

+|- # aiau

Set the current position in the file system to the specified position relative to the current attribute inode allocation unit (aiau) position. Set the current attribute inode allocation unit position to the resulting offset. If it is the last command on a line, print the attribute inode allocation unit header.

aiau

Set the current position in the file system to the current attribute inode allocation unit (aiau) position. If it is the last command on a line, print the attribute inode allocation unit header.

# iau

Set the current position in the file system to the specified inode allocation unit (iau) in a fileset. Set the current inode allocation unit position to the resulting offset. If it is the last command on a line, print the inode allocation unit header.

+|- # iau

Set the current position in the file system to the specified position relative to the current inode allocation unit (iau) position. Set the current inode allocation unit position to the resulting offset. If it is the last command on a line, print the inode allocation unit header.

iau

Set the current position in the file system to the current inode allocation unit (iau) position. If it is the last command on a line, print the inode allocation unit header.

# ai

Set the current position in the current fileset to the ilist entry for the specified attribute inode. Set the current attribute inode position to the resulting offset. If it is the last command on a line, print the ilist entry for the inode.

+|- # ai

Set the current position in the current fileset to the ilist entry for the specified relative attribute inode. Set the current attribute inode position to the resulting offset. If it is the last command on a line, print the ilist entry for the inode.

ai

Set the current position in the current fileset to the current attribute inode position. If it is the last command on a line, print the ilist entry for the inode.

# i

Set the current position in the current fileset to the ilist entry for the specified inode. Set the current inode position to the resulting offset. If it is the last command on a line, print the ilist entry for the inode.

+|- # i

Set the current position in the current fileset to the ilist entry for the specified relative inode. Set the current inode position to the resulting offset. If it is the last command on a line, print the ilist entry for the inode.

i

Set the current position in the current fileset to the current inode position. If it is the last command on a line, print the ilist entry for the inode.

a#

Set the current position to specified offset in blocks specified by the inode address #. Addresses 0 through 9 are for direct extents ( de ). Addresses 10-11 are for indirect extents ( ie ). The addresses are displayed when printing an ilist entry. Set the current block position to the resulting offset. If it is the last command on a line, print the first word in the block in hexadecimal.

im

Set the current position to immediate data area of the current inode. Set the current block position to the resulting offset. If it is the last command on a line, print the first word of the area in hexadecimal.

attr

Set the current position to attribute data area of the current inode. Set the current block position to the resulting offset. If it is the last command on a line, print the first word in the block in hexadecimal.

# B|H|W|D =# [#]

Set the current position and change the number at the specified offset to the given number. If a double-word offset is specified, then two numbers separated by a space are required. The resulting value is printed in hexadecimal.

+|-# B|H|W|D =# [#]

Set the current position and change the number at the specified relative offset to the given number. If a double-word offset is specified, then two numbers separated by a space are required. The resulting value is printed in hexadecimal.

# B|H|W|D = "string"

Set the current position and change the characters at the specified offset to the given string. The resulting value is printed as a character string.

+|- # B|H|W|D = "string"

Set the current position and change the characters at the specified relative offset to the given string. The resulting value is printed as a character string.

olt

Set the current position to the object location table (olt). If the last command on a line, print the object location table.

p [#] format

Print the contents of the file system at the current offset as the specified number of entries of a given format. The allowable print formats are specified above. If a number of entries to print is not specified, one entry is printed.

inode_field = #

Set the contents of the given inode field to the specified number. The current inode specifies the inode list entry to be modified. The symbols representing inode fields are previously listed.

directory_block_field = #

Set the contents of the given directory block field to the specified number. The current block is treated as a directory block and the offset in that block which is represented by the given field is changed. The symbols representing directory block fields are listed above.

d#

Set the current directory entry to the specified number. The current block is treated as a directory block. If the current block is an immediate data area for an inode, the block is treated as containing immediate directory entries. If it is the last command on a line, the directory entry at the resulting offset is printed.

directory_entry_field = #

Set the contents of the given directory field to the specified number. The current directory entry specifies where the directory entry is located. The resulting value is printed in hexadecimal.

nm = "string"

Set the directory name field of the current directory entry to the specified string. The resulting value is printed as a character string.

calc # [+|-|*|/ #]

Take a number or the sum, difference, product, or dividend of two numbers and print in decimal, octal, hexadecimal and character format.

find # B|H|W|D [#]

Search for the given numeric pattern in the file system. The size of the object to match is specified. If a double-word is specified, two numbers must be specified. The search is performed forward from the current offset. A maximum number of blocks to search can be specified. If found, the location and value are printed in hexadecimal.

find "string" [#]

Search for the given character string in the file system. The search is performed forward from the current offset. A maximum number of blocks to search can be specified. If found the location and string are printed.

fmtlog

Format all intent log entries. A completely formatted intent log can be very long. It is a good idea use the fsdb command as a filter and redirect the output to a file or pager to look at a complete log format.

histlog

Format the contents of the VxFS history log. The history log records structural changes to the file system. This information can be used to determine what structure-altering operations were being performed at the time of a system crash, hang, or other problem experienced by the file system. Each history log record is formatted in ASCII and lists the type and time of the operation, the version of the VxFS kernel that performed the operation, and optional information specific to the type of operation.

listfset

List all filesets by their indexes and names.

listinode

List all free inodes in the current fileset along with their format.

mapi #

Treat the number as a logical offset in the file described by the current inode and print the extent to which it maps.

reset

Equivalent to exiting fsdb and restarting on the same device.

The following help commands are supported:

h | help

Display primary help screen.

h mod

Display modification-commands help screen.

h print

Display print-commands help screen.

EXAMPLES

To print the inumber 386 in an inode format. The number becomes the current working inode.

386i

To change the link count for the working inode to four:

ln=4

To print the super-block of the file system symbolically:

8192B.p S

To change the inumber for the seventh directory slot in the root directory to three (also shows how to combine several operations on one command line):

2i.a0.d7.ino = 3

To change the name field in the directory slot to foo:

d7.nm = "foo"

To print the immediate area of inode 23 as a directory block:

23i.im.p db

To print the sixth directory entry in the immediate area of inode 23.

23i.im.d5

WARNINGS

Always run a file system check after using fsdb to modify a file system (use "fsck -o full, nolog" ).

Some aspects of fsdb apply to a specific VxFS disk layout version.

SEE ALSO

fsck(1M), fsdb(1M)