]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sbin/fsdb/fsdb.8
This commit was generated by cvs2svn to compensate for changes in r56173,
[FreeBSD/FreeBSD.git] / sbin / fsdb / fsdb.8
1 .\"     $NetBSD: fsdb.8,v 1.2 1995/10/08 23:18:08 thorpej Exp $
2 .\"
3 .\" Copyright (c) 1995 John T. Kohl
4 .\" All rights reserved.
5 .\"
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
8 .\" are met:
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.
16 .\"
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.
28 .\"
29 .\" $FreeBSD$
30 .\"
31 .Dd September 14, 1995
32 .Dt FSDB 8
33 .Os FreeBSD
34 .Sh NAME
35 .Nm fsdb
36 .Nd FFS debugging/editing tool
37 .Sh SYNOPSIS
38 .Nm fsdb
39 .Op Fl d
40 .Op Fl f 
41 .Op Fl r
42 .Ar fsname
43 .Sh DESCRIPTION
44 .Nm Fsdb
45 opens 
46 .Ar fsname
47 (usually a raw disk partition) and runs a command loop
48 allowing manipulation of the file system's inode data.  You are prompted
49 to enter a command with
50 .Ic "fsdb (inum X)>"
51 where
52 .Va X
53 is the currently selected i-number.  The initial selected inode is the
54 root of the filesystem (i-number 2).
55 The command processor uses the
56 .Xr editline 3
57 library, so you can use command line editing to reduce typing if desired.
58 When you exit the command loop, the file system superblock is marked
59 dirty and any buffered blocks are written to the file system.
60 .Pp
61 The following options are available:
62 .Bl -tag -width indent
63 .It Fl d
64 Enable additional debugging output (which comes primarily from
65 .Xr fsck 8 -derived
66 code).
67 .It Fl f
68 Left for historical reasons and has no meaning.
69 .It Fl r
70 Open the filesystem read/only, and disables all commands that would
71 write to it.
72 .El
73 .Sh COMMANDS
74 Besides the built-in 
75 .Xr editline 3
76 commands,
77 .Nm
78 supports these commands:
79 .Pp
80 .Bl -tag -width indent -compact
81 .It Cm help
82 Print out the list of accepted commands.
83 .Pp
84 .It Cm inode Ar i-number
85 Select inode
86 .Ar i-number
87 as the new current inode.
88 .Pp
89 .It Cm back
90 Revert to the previously current inode.
91 .Pp
92 .It Cm clri Ar i-number
93 Clear 
94 .Ar i-number .
95 .Pp
96 .It Cm lookup Ar name
97 .It Cm cd Ar name
98 Find
99 .Ar name
100 in the current directory and make its inode the current inode.
101 .Ar Name
102 may be a multi-component name or may begin with slash to indicate that
103 the root inode should be used to start the lookup.  If some component
104 along the pathname is not found, the last valid directory encountered is
105 left as the active inode.
106 .br
107 This command is valid only if the starting inode is a directory.
108 .Pp
109 .It Cm active
110 .It Cm print
111 Print out the active inode.
112 .Pp
113 .It Cm uplink
114 Increment the active inode's link count.
115 .Pp
116 .It Cm downlink
117 Decrement the active inode's link count.
118 .Pp
119 .It Cm linkcount Ar number
120 Set the active inode's link count to
121 .Ar number .
122 .Pp
123 .It Cm ls
124 List the current inode's directory entries.  This command is valid only
125 if the current inode is a directory. 
126 .Pp
127 .It Cm rm Ar name
128 .It Cm del Ar name
129 Remove the entry
130 .Ar name
131 from the current directory inode.  This command is valid only
132 if the current inode is a directory.
133 .Pp
134 .It Cm ln Ar ino Ar name
135 Create a link to inode
136 .Ar ino
137 under the name
138 .Ar name
139 in the current directory inode.  This command is valid only
140 if the current inode is a directory.
141 .Pp
142 .It Cm chinum Ar dirslot Ar inum
143 Change the i-number in directory entry
144 .Ar dirslot
145 to
146 .Ar inum .
147 .Pp
148 .It Cm chname Ar dirslot Ar name
149 Change the name in directory entry
150 .Ar dirslot
151 to
152 .Ar name .
153 This command cannot expand a directory entry.  You can only rename an
154 entry if the name will fit into the existing directory slot.
155 .Pp
156 .It Cm chtype Ar type
157 Change the type of the current inode to
158 .Ar type .
159 .Ar Type
160 may be one of:
161 .Em file ,
162 .Em dir ,
163 .Em socket ,
164 or
165 .Em fifo .
166 .Pp
167 .It Cm chmod Ar mode
168 Change the mode bits of the current inode to
169 .Ar mode .
170 You cannot change the file type with this subcommand; use
171 .Ic chtype
172 to do that.
173 .Pp
174 .It Cm chflags Ar flags
175 Change the file flags of the current inode to
176 .Ar flags .
177 .Pp
178 .It Cm chown Ar uid
179 Change the owner of the current inode to
180 .Ar uid .
181 .Pp
182 .It Cm chgrp Ar gid
183 Change the group of the current inode to
184 .Ar gid .
185 .Pp
186 .It Cm chgen Ar gen
187 Change the generation number of the current inode to
188 .Ar gen .
189 .Pp
190 .It Cm mtime Ar time
191 .It Cm ctime Ar time
192 .It Cm atime Ar time
193 Change the modification, change, or access time (respectively) on the
194 current inode to 
195 .Ar time .
196 .Ar Time
197 should be in the format
198 .Em YYYYMMDDHHMMSS[.nsec]
199 where
200 .Em nsec
201 is an optional nanosecond specification.  If no nanoseconds are specified, the
202 .Va mtimensec ,
203 .Va ctimensec ,
204 or
205 .Va atimensec 
206 field will be set to zero.
207 .Pp
208 .It Cm quit, Cm q, Cm exit, Em <EOF>
209 Exit the program.
210 .El
211 .Sh SEE ALSO
212 .Xr editline 3 ,
213 .Xr fs 5 ,
214 .Xr clri 8 ,
215 .Xr fsck 8
216 .Sh BUGS
217 Manipulation of ``short'' symlinks doesn't work (in particular, don't
218 try changing a symlink's type).
219 .br
220 You must specify modes as numbers rather than symbolic names.
221 .br
222 There are a bunch of other things that you might want to do which
223 .Nm
224 doesn't implement.
225 .Sh HISTORY
226 .Nm Fsdb
227 uses the source code for
228 .Xr fsck 8
229 to implement most of the file system manipulation code.  The remainder of
230 .Nm
231 first appeared in
232 .Bx Net ,
233 written by
234 .An John T. Kohl .
235 .br
236 .An Peter Wemm
237 ported it to
238 .Bx Free .
239 .Sh WARNING
240 Use this tool with extreme caution--you can damage an FFS file system
241 beyond what
242 .Xr fsck 8
243 can repair.