1 .\" $NetBSD: fsdb.8,v 1.2 1995/10/08 23:18:08 thorpej Exp $
3 .\" Copyright (c) 1995 John T. Kohl
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
14 .\" 3. The name of the author may not be used to endorse or promote products
15 .\" derived from this software without specific prior written permission.
17 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR
18 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 .\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
21 .\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 .\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23 .\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
25 .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26 .\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 .\" POSSIBILITY OF SUCH DAMAGE.
36 .Nd FFS debugging/editing tool
48 (usually a raw disk partition) and runs a command loop
49 allowing manipulation of the file system's inode data.
51 to enter a command with
55 is the currently selected i-number.
56 The initial selected inode is the
57 root of the file system (i-number 2).
58 The command processor uses the
60 library, so you can use command line editing to reduce typing if desired.
61 When you exit the command loop, the file system superblock is marked
62 dirty and any buffered blocks are written to the file system.
64 The following options are available:
65 .Bl -tag -width indent
67 Enable additional debugging output (which comes primarily from
68 .Xr fsck 8 Ns -derived
71 Left for historical reasons and has no meaning.
73 Open the file system read/only, and disables all commands that would
81 supports these commands:
83 .Bl -tag -width indent -compact
85 Print out the list of accepted commands.
87 .It Cm inode Ar i-number
90 as the new current inode.
93 Revert to the previously current inode.
95 .It Cm clri Ar i-number
103 in the current directory and make its inode the current inode.
105 may be a multi-component name or may begin with slash to indicate that
106 the root inode should be used to start the lookup.
108 along the pathname is not found, the last valid directory encountered is
109 left as the active inode.
110 This command is valid only if the starting inode is a directory.
114 Print out the active inode.
117 Print out the block list of the active inode.
118 Note that the printout can become long for large files, since all
119 indirect block pointers will also be printed.
121 .It Cm findblk Ar disk_block_number ...
122 Find the inode(s) owning the specified disk block(s) number(s).
123 Note that these are not absolute disk blocks numbers, but offsets from the
124 start of the partition.
127 Increment the active inode's link count.
130 Decrement the active inode's link count.
132 .It Cm linkcount Ar number
133 Set the active inode's link count to
137 List the current inode's directory entries.
138 This command is valid only
139 if the current inode is a directory.
145 from the current directory inode.
146 This command is valid only
147 if the current inode is a directory.
149 .It Cm ln Ar ino Ar name
150 Create a link to inode
154 in the current directory inode.
155 This command is valid only
156 if the current inode is a directory.
158 .It Cm chinum Ar dirslot Ar inum
159 Change the i-number in directory entry
164 .It Cm chname Ar dirslot Ar name
165 Change the name in directory entry
169 This command cannot expand a directory entry.
170 You can only rename an
171 entry if the name will fit into the existing directory slot.
173 .It Cm chtype Ar type
174 Change the type of the current inode to
185 Change the mode bits of the current inode to
187 You cannot change the file type with this subcommand; use
191 .It Cm chflags Ar flags
192 Change the file flags of the current inode to
196 Change the owner of the current inode to
200 Change the group of the current inode to
204 Change the generation number of the current inode to
211 Change the creation (birth), modification, change, or access
212 time (respectively) on the current inode to
215 should be in the format
216 .Em YYYYMMDDHHMMSS[.nsec]
219 is an optional nanosecond specification.
220 If no nanoseconds are specified, the
226 field will be set to zero.
229 is available on UFS2 file systems only.
231 .It Cm quit , q , exit , Em <EOF>
242 utility uses the source code for
244 to implement most of the file system manipulation code.
256 Manipulation of ``short'' symlinks has no effect.
257 In particular, one should not
258 try changing a symlink's type.
260 You must specify modes as numbers rather than symbolic names.
262 There are a bunch of other things that you might want to do which
266 Use this tool with extreme caution--you can damage an FFS file system