(usually a raw disk partition) and
runs a command loop allowing manipulation of the file system's inode data. You
are prompted to enter a command with fsdb (inum
is the currently selected
i-number. The initial selected inode is the root of the file system (i-number
2). The command processor uses the editline(3)
library, so you can use command line editing to reduce typing if desired. When
you exit the command loop, the file system superblock is marked dirty and any
buffered blocks are written to the file system.
The following options are available:
- Enable additional debugging output (which comes primarily
from fsck(8)-derived code).
- Left for historical reasons and has no meaning.
- Open the file system read/only, and disables all commands
that would write to it.
Besides the built-in editline(3)
supports these commands:
- Print out the list of accepted commands.
- Select inode i-number as
the new current inode.
- Revert to the previously current inode.
- Clear i-number.
- Find name in the current
directory and make its inode the current inode.
Name may be a multi-component name or may
begin with slash to indicate that the root inode should be used to start
the lookup. If some component along the pathname is not found, the last
valid directory encountered is left as the active inode. This command is
valid only if the starting inode is a directory.
- Print out the active inode.
- Print out the block list of the active inode. Note that the
printout can become long for large files, since all indirect block
pointers will also be printed.
- Find the inode(s) owning the specified disk block(s)
number(s). Note that these are not absolute disk blocks numbers, but
offsets from the start of the partition.
- Increment the active inode's link count.
- Decrement the active inode's link count.
- Set the active inode's link count to
- List the current inode's directory entries. This command is
valid only if the current inode is a directory.
- Remove the entry name from
the current directory inode. This command is valid only if the current
inode is a directory.
- Create a link to inode ino
under the name name in the current
directory inode. This command is valid only if the current inode is a
- Change the i-number in directory entry
- Change the name in directory entry
name. This command cannot expand a
directory entry. You can only rename an entry if the name will fit into
the existing directory slot.
- Change the type of the current inode to
Type may be one of:
socket, or fifo.
- Change the mode bits of the current inode to
mode. You cannot change the file type
with this subcommand; use chtype to do that.
- Change the file flags of the current inode to
- Change the owner of the current inode to
- Change the group of the current inode to
- Change the generation number of the current inode to
- Change the creation (birth), modification, change, or
access time (respectively) on the current inode to
Time should be in the format
nsec is an optional nanosecond specification.
If no nanoseconds are specified, the
atimensec field will be set to zero. Note
that btime is available on UFS2 file systems
- Exit the program.
utility uses the source code for
to implement most of the file system
manipulation code. The remainder of fsdb
appeared in NetBSD
, written by
John T. Kohl
ported it to
Manipulation of ``short'' symlinks has no effect. In particular, one should not
try changing a symlink's type.
You must specify modes as numbers rather than symbolic names.
There are a bunch of other things that you might want to do which
does not implement.
Use this tool with extreme caution--you can damage an FFS file system beyond