1 .\" $NetBSD: fsdb.8,v 1.21 2005/05/25 10:01:34 wiz Exp $
3 .\" Copyright (c) 1996 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
35 .Nd FFS debugging/editing tool
44 (usually a raw disk partition) and runs a command loop
45 allowing manipulation of the file system's inode data.
46 You are prompted to enter a command with
47 .Dq "fsdb (inum X)\*[Gt]"
50 is the currently selected i-number.
51 The initial selected inode is the root of the filesystem (i-number 2).
52 The command processor uses the
54 library, so you can use command line editing to reduce typing if desired.
55 When you exit the command loop, the file system superblock is marked
56 dirty and any buffered blocks are written to the file system.
60 option enables additional debugging output (which comes primarily from
61 .Xr fsck 8 Ns -derived
68 is a file system image, rather than a raw character device.
71 and no attempts will be made to read a disklabel.
75 option disables writing to the device, preventing any changes from being made
82 supports these commands:
84 .Bl -tag -width indent -compact
86 Print out the list of accepted commands.
88 .It Cm inode Ar i-number
91 as the new current inode.
94 Revert to the previously current inode.
97 Clear the current inode.
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.
107 If some component along the pathname is not found,
108 the last valid directory encountered is 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 Increment the active inode's link count.
120 Decrement the active inode's link count.
122 .It Cm linkcount Ar number
123 Set the active inode's link count to
127 List the current inode's directory entries.
128 This command is valid only if the current inode is a directory.
131 List the current inode's blocks numbers.
133 .It Cm findblk Ar disk block number ...
134 Find the inode(s) owning the specified disk block(s) number(s).
135 Note that these are not absolute disk blocks numbers, but offsets from the
136 start of the partition.
142 from the current directory inode.
143 This command is valid only if the current inode is a directory.
145 .It Cm ln Ar ino Ar name
146 Create a link to inode
150 in the current directory inode.
151 This command is valid only if the current inode is a directory.
153 .It Cm chinum Ar dirslot Ar inum
154 Change the i-number in directory entry
159 .It Cm chname Ar dirslot Ar name
160 Change the name in directory entry
164 This command cannot expand a directory entry.
165 You can only rename an entry if the name will fit into
166 the existing directory slot.
168 .It Cm chtype Ar type
169 Change the type of the current inode to
180 Change the mode bits of the current inode to
182 You cannot change the file type with this subcommand; use
186 .It Cm chflags Ar flags
187 Change the file flags of the current inode to
191 Change the owner of the current inode to
195 Change the group of the current inode to
199 Change the generation number of the current inode to
205 Change the modification, change, or access time (respectively) on the
209 should be in the format
210 .Em YYYYMMDDHHMMSS[.nsec]
213 is an optional nanosecond specification.
214 If no nanoseconds are specified, the
219 field will be set to zero.
221 .It Cm quit, Cm q, Cm exit, Aq Em EOF
231 uses the source code for
233 to implement most of the file system manipulation code.
239 Use this tool with extreme caution -- you can damage an FFS file system
246 symlinks doesn't work (in particular, don't
247 try changing a symlink's type).
249 You must specify modes as numbers rather than symbolic names.
251 There are a bunch of other things that you might want to do which