fsdb8
Ffs debugging/editing tool
Usage
fsdb [-d]
-f
fsname
Overview
fsdb opens fsname (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 X)> where X 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 options are as follows:
-
-d -
Enables additional debugging output (which comes primarily from fsck(8)-derived code).
-
-f fsname -
Open file system fsname.
Besides the built-in editline(3) commands, fsdb supports these commands:
help-
Print out the list of accepted commands.
inodei-number-
Select inode i-number as the new current inode.
back-
Revert to the previously current inode.
clrii-number-
Clear the inode i-number.
lookupname,cdname-
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.
active,print-
Print out the active inode.
uplink-
Increment the active inode's link count.
downlink-
Decrement the active inode's link count.
linkcountnumber-
Set the active inode's link count to number.
ls-
List the current inode's directory entries. This command is valid only if the current inode is a directory.
rmname,delname-
Remove the entry name from the current directory inode. This command is valid only if the current inode is a directory.
lnino name-
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 directory.
chinumdirslot inum-
Change the i-number in directory entry dirslot to inum.
chnamedirslot name-
Change the name in directory entry dirslot to name. This command cannot expand a directory entry. You can only rename an entry if the name will fit into the existing directory slot.
chtypetype-
Change the type of the current inode to type. type may be one of: file, dir, socket, or fifo.
chmodmode-
Change the mode bits of the current inode to mode. You cannot change the file type with this subcommand; use
chtypeto do that. chflagsflags-
Change the file flags of the current inode to flags.
chownuid-
Change the owner of the current inode to uid.
chlenlength-
Change the length of the current inode to length.
chgrpgid-
Change the group of the current inode to gid.
chgengen-
Change the generation number of the current inode to gen.
mtimetime,-
ctimetime,atimetime Change the modification, change, or access time (respectively) on the current inode to time. Time should be in the format YYYYMMDDHHMMSS[.nsec] where nsec is an optional nanosecond specification. If no nanoseconds are specified, the mtimensec, ctimensec, or atimensec field will be set to zero. quit,q,exit, <EOF>-
Exit the program.
Warning
Use this tool with extreme caution – you can damage an FFS file system beyond what fsck(8) can repair.
Releases
61 releases since OpenBSD 2.1; the text changed 11 times.
-d since OpenBSD 2.7;
-f since OpenBSD 4.1.