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.
34 .Nd FFS debugging/editing tool
46 (usually a raw disk partition) and runs a command loop
47 allowing manipulation of the file system's inode data.
49 to enter a command with
53 is the currently selected i-number.
54 The initial selected inode is the
55 root of the file system (i-number 2).
56 The command processor uses the
58 library, so you can use command line editing to reduce typing if desired.
59 When you exit the command loop, the file system superblock is marked
60 dirty and any buffered blocks are written to the file system.
62 The following options are available:
63 .Bl -tag -width indent
65 Enable additional debugging output (which comes primarily from
66 .Xr fsck 8 Ns -derived
69 Left for historical reasons and has no meaning.
71 Open the file system read/only, and disables all commands that would
79 supports these commands:
81 .Bl -tag -width indent -compact
83 Print out the list of accepted commands.
85 .It Cm inode Ar i-number
88 as the new current inode.
91 Revert to the previously current inode.
93 .It Cm clri Ar i-number
101 in the current directory and make its inode the current inode.
103 may be a multi-component name or may begin with slash to indicate that
104 the root inode should be used to start the lookup.
106 along the pathname is not found, the last valid directory encountered is
107 left as the active inode.
108 This command is valid only if the starting inode is a directory.
112 Print out the active inode.
115 Print out the block list of the active inode.
116 Note that the printout can become long for large files, since all
117 indirect block pointers will also be printed.
119 .It Cm findblk Ar disk_block_number ...
120 Find the inode(s) owning the specified disk block(s) number(s).
121 Note that these are not absolute disk blocks numbers, but offsets from the
122 start of the partition.
125 Increment the active inode's link count.
128 Decrement the active inode's link count.
130 .It Cm linkcount Ar number
131 Set the active inode's link count to
135 List the current inode's directory entries.
136 This command is valid only
137 if the current inode is a directory.
143 from the current directory inode.
144 This command is valid only
145 if the current inode is a directory.
147 .It Cm ln Ar ino Ar name
148 Create a link to inode
152 in the current directory inode.
153 This command is valid only
154 if the current inode is a directory.
156 .It Cm chinum Ar dirslot Ar inum
157 Change the i-number in directory entry
162 .It Cm chname Ar dirslot Ar name
163 Change the name in directory entry
167 This command cannot expand a directory entry.
168 You can only rename an
169 entry if the name will fit into the existing directory slot.
171 .It Cm chtype Ar type
172 Change the type of the current inode to
183 Change the mode bits of the current inode to
185 You cannot change the file type with this subcommand; use
189 .It Cm chflags Ar flags
190 Change the file flags of the current inode to
194 Change the owner of the current inode to
198 Change the group of the current inode to
202 Change the generation number of the current inode to
209 Change the creation (birth), modification, change, or access
210 time (respectively) on the current inode to
213 should be in the format
214 .Em YYYYMMDDHHMMSS[.nsec]
217 is an optional nanosecond specification.
218 If no nanoseconds are specified, the
224 field will be set to zero.
227 is available on UFS2 file systems only.
229 .It Cm quit , q , exit , Em <EOF>
242 It used the source code for
244 to implement most of the file system manipulation code.
253 ported by Peter Wemm.
255 Manipulation of ``short'' symlinks has no effect.
256 In particular, one should not
257 try changing a symlink's type.
259 You must specify modes as numbers rather than symbolic names.
261 There are a bunch of other things that you might want to do which
265 Use this tool with extreme caution--you can damage an FFS file system