]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sbin/fsdb/fsdb.8
This commit was generated by cvs2svn to compensate for changes in r53799,
[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
93 Clear the current inode.
94 .Pp
95 .It Cm lookup Ar name
96 .It Cm cd Ar name
97 Find
98 .Ar name
99 in the current directory and make its inode the current inode.
100 .Ar Name
101 may be a multi-component name or may begin with slash to indicate that
102 the root inode should be used to start the lookup.  If some component
103 along the pathname is not found, the last valid directory encountered is
104 left as the active inode.
105 .br
106 This command is valid only if the starting inode is a directory.
107 .Pp
108 .It Cm active
109 .It Cm print
110 Print out the active inode.
111 .Pp
112 .It Cm uplink
113 Increment the active inode's link count.
114 .Pp
115 .It Cm downlink
116 Decrement the active inode's link count.
117 .Pp
118 .It Cm linkcount Ar number
119 Set the active inode's link count to
120 .Ar number .
121 .Pp
122 .It Cm ls
123 List the current inode's directory entries.  This command is valid only
124 if the current inode is a directory. 
125 .Pp
126 .It Cm rm Ar name
127 .It Cm del Ar name
128 Remove the entry
129 .Ar name
130 from the current directory inode.  This command is valid only
131 if the current inode is a directory.
132 .Pp
133 .It Cm ln Ar ino Ar name
134 Create a link to inode
135 .Ar ino
136 under the name
137 .Ar name
138 in the current directory inode.  This command is valid only
139 if the current inode is a directory.
140 .Pp
141 .It Cm chinum Ar dirslot Ar inum
142 Change the i-number in directory entry
143 .Ar dirslot
144 to
145 .Ar inum .
146 .Pp
147 .It Cm chname Ar dirslot Ar name
148 Change the name in directory entry
149 .Ar dirslot
150 to
151 .Ar name .
152 This command cannot expand a directory entry.  You can only rename an
153 entry if the name will fit into the existing directory slot.
154 .Pp
155 .It Cm chtype Ar type
156 Change the type of the current inode to
157 .Ar type .
158 .Ar Type
159 may be one of:
160 .Em file ,
161 .Em dir ,
162 .Em socket ,
163 or
164 .Em fifo .
165 .Pp
166 .It Cm chmod Ar mode
167 Change the mode bits of the current inode to
168 .Ar mode .
169 You cannot change the file type with this subcommand; use
170 .Ic chtype
171 to do that.
172 .Pp
173 .It Cm chflags Ar flags
174 Change the file flags of the current inode to
175 .Ar flags .
176 .Pp
177 .It Cm chown Ar uid
178 Change the owner of the current inode to
179 .Ar uid .
180 .Pp
181 .It Cm chgrp Ar gid
182 Change the group of the current inode to
183 .Ar gid .
184 .Pp
185 .It Cm chgen Ar gen
186 Change the generation number of the current inode to
187 .Ar gen .
188 .Pp
189 .It Cm mtime Ar time
190 .It Cm ctime Ar time
191 .It Cm atime Ar time
192 Change the modification, change, or access time (respectively) on the
193 current inode to 
194 .Ar time .
195 .Ar Time
196 should be in the format
197 .Em YYYYMMDDHHMMSS[.nsec]
198 where
199 .Em nsec
200 is an optional nanosecond specification.  If no nanoseconds are specified, the
201 .Va mtimensec ,
202 .Va ctimensec ,
203 or
204 .Va atimensec 
205 field will be set to zero.
206 .Pp
207 .It Cm quit, Cm q, Cm exit, Em <EOF>
208 Exit the program.
209 .El
210 .Sh SEE ALSO
211 .Xr editline 3 ,
212 .Xr fs 5 ,
213 .Xr clri 8 ,
214 .Xr fsck 8
215 .Sh BUGS
216 Manipulation of ``short'' symlinks doesn't work (in particular, don't
217 try changing a symlink's type).
218 .br
219 You must specify modes as numbers rather than symbolic names.
220 .br
221 There are a bunch of other things that you might want to do which
222 .Nm
223 doesn't implement.
224 .Sh HISTORY
225 .Nm Fsdb
226 uses the source code for
227 .Xr fsck 8
228 to implement most of the file system manipulation code.  The remainder of
229 .Nm
230 first appeared in
231 .Bx Net ,
232 written by
233 .An John T. Kohl .
234 .br
235 .An Peter Wemm
236 ported it to
237 .Bx Free .
238 .Sh WARNING
239 Use this tool with extreme caution--you can damage an FFS file system
240 beyond what
241 .Xr fsck 8
242 can repair.