Whamcloud - gitweb
ChangeLog, debugfs.8.in, debugfs.c:
[tools/e2fsprogs.git] / debugfs / debugfs.8.in
1 .\" -*- nroff -*-
2 .\" Copyright 1993, 1994, 1995 by Theodore Ts'o.  All Rights Reserved.
3 .\" This file may be copied under the terms of the GNU Public License.
4 .\" 
5 .TH DEBUGFS 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
6 .SH NAME
7 debugfs \- ext2 file system debugger
8 .SH SYNOPSIS
9 .B debugfs
10 [
11 .B \-b
12 blocksize
13 ]
14 [
15 .B \-s
16 superblock
17 ]
18 [
19 .B \-f 
20 cmd_file
21 ]
22 [
23 .B \-R
24 request
25 ]
26 [
27 .B \-V
28 ]
29 [
30 [
31 .B \-w
32 ]
33 [
34 .B \-c
35 ]
36 [
37 .B \-i
38 ]
39 [
40 device
41 ]
42 ]
43 .SH DESCRIPTION
44 The 
45 .B debugfs 
46 program
47 is a file system debugger. It can be used to examine and change the
48 state of an ext2 file system.
49 .br
50 .I device
51 is the special file corresponding to the device containing the ext2
52 file system (e.g /dev/hdXX).
53 .SH OPTIONS
54 .TP
55 .I \-w
56 Specifies that the file system should be opened in read-write mode.
57 Without this option, the file system is opened in read-only mode.
58 .TP
59 .I \-c
60 Specifies that the file system should be opened in catastrophic mode, in
61 which the inode and group bitmaps are not read initially.  This can be
62 useful for filesystems with significant corruption, but because of this,
63 catastrophic mode forces the filesystem to be opened read-only.
64 .TP
65 .I \-i
66 Specifies that 
67 .I device
68 represents an ext2 image file created by the
69 .B e2image
70 program.  Since the ext2 image file only contains the superblock, block
71 group descriptor, block and inode allocation bitmaps, and 
72 the inode table, many
73 .B debugfs
74 commands will not function properly.  
75 .B Warning:
76 no safety checks are in place, and 
77 .B debugfs 
78 may fail in interesting ways if commands such as
79 .IR ls ", " dump ", " 
80 etc. are tried.  
81 .B debugfs 
82 is a debugging tool.  It has rough edges!
83 .TP
84 .I -b blocksize
85 Forces the use of the given block size for the file system, rather than
86 detecting the correct block size as normal.
87 .TP
88 .I -s superblock
89 Causes the file system superblock to be read from the given block number,
90 rather than the default (1).  If you give a
91 .I -s
92 option, you must also give a
93 .I -b
94 option.
95 .TP
96 .I -f cmd_file
97 Causes 
98 .B debugfs
99 to read in commands from 
100 .IR cmd_file , 
101 and execute them.  When 
102 .B debugfs
103 is finished executing those commands, it will exit.
104 .TP 
105 .I -R request
106 Causes 
107 .B debugfs
108 to execute the single command 
109 .IR request ,
110 and then exit.
111 .TP
112 .I -V
113 print the version number of 
114 .B debugfs
115 and exit.
116 .SH COMMANDS
117 .B debugfs
118 is an interactive debugger. It understands a number of commands.
119 .TP
120 .I cat filespec
121 Dump the contents of the inode 
122 .I filespec
123 to stdout.
124 .TP
125 .I cd filespec
126 Change the current working directory to 
127 .IR filespec .
128 .TP
129 .I chroot filespec
130 Change the root directory to be the directory 
131 .IR filespec .
132 .TP
133 .I close
134 Close the currently open file system.
135 .TP
136 .I clri file
137 Clear the contents of the inode 
138 .IR file .
139 .TP
140 .I dump [-p] filspec out_file
141 Dump the contents of the inode 
142 .I filespec
143 to the output file 
144 .IR out_file .  
145 If the 
146 .I -p 
147 option is given set the owner, group and permissions information on 
148 .I out_file 
149 to match 
150 .IR filespec .
151 .TP
152 .I expand_dir filespec
153 Expand the directory
154 .IR filespec .
155 .TP
156 .I feature [fs_feature] [-fs_feature] ...
157 Set or clear various filesystem features in the superblock.  After setting
158 or clearing any filesystem features that were requested, print the current
159 state of the filesystem feature set.
160 .TP
161 .I find_free_block [goal]
162 Find the first free block, starting from
163 .I goal
164 and allocate it.
165 .TP
166 .I find_free_inode [dir [mode]]
167 Find a free inode and allocate it.  If present, 
168 .I dir
169 specifies the inode number of the directory 
170 which the inode is to be located.  The second 
171 optional argument
172 .I mode
173 specifies the permissions of the new inode.  (If the directory bit is set
174 on the mode, the allocation routine will function differently.)
175 .TP
176 .I freeb block
177 Mark the block number
178 .I block
179 as not allocated.
180 .TP
181 .I freei filespec
182 Free the inode specified by 
183 .IR filespec .
184 .TP
185 .I help
186 Print a list of commands understood by 
187 .BR debugfs (8).
188 .TP
189 .I icheck block ...
190 Print a listing of the inodes which use the one or more blocks specified
191 on the command line.
192 .TP
193 .I initialize device blocksize
194 Create an ext2 file system on
195 .I device
196 with device size
197 .IR blocksize .
198 Note that this does not fully initialize all of the data structures; 
199 to do this, use the 
200 .BR mke2fs (8)
201 program.  This is just a call to the low-level library, which sets up
202 the superblock and block descriptors.
203 .TP
204 .I kill_file filespec
205 Deallocate the inode 
206 .I filespec
207 and its blocks.  Note that this does not remove any directory
208 entries (if any) to this inode.  See the 
209 .BR rm (1)
210 command if you wish to unlink a file.
211 .TP
212 .I ln filespec dest_file
213 Create a link named 
214 .I dest_file
215 which is a link to 
216 .IR filespec .
217 Note this does not adjust the inode reference counts.
218 .TP
219 .I ls [-l] filespec
220 Print a listing of the files in the directory
221 .IR filespec .
222 .TP
223 .I modify_inode filespec
224 Modify the contents of the inode structure in the inode
225 .IR filespec .
226 .TP
227 .I mkdir filespec
228 Make a directory.
229 .TP
230 .I mknod filespec [p|[[c|b] major minor]]
231 Create a special device file (a named pipe, character or block device).
232 If a character or block device is to be made, the 
233 .I major
234 and
235 .I minor
236 device numbers must be specified.
237 .TP
238 .I ncheck inode_num ...
239 Take the requested list of inode numbers, and print a listing of pathnames
240 to those inodes.
241 .TP
242 .I open [-w] [-f] [-i] [-c] [-b blocksize] [-s superblock] device
243 Open a filesystem for editing.  The 
244 .I -w 
245 flag causes the filesystem to be opened for writing.  The 
246 .I -f 
247 flag forces the filesystem to be opened even if there are some unknown 
248 or incompatible filesystem features which would normally 
249 prevent the filesystem from being opened.  The
250 .IR -c ", " -b ", " -i ", " and " -s
251 options behave the same as those to
252 .B debugfs
253 itself.
254 .TP
255 .I pwd
256 Print the current working directory.
257 .TP
258 .I quit
259 Quit
260 .B debugfs
261 .TP
262 .I rm pathname
263 Unlink 
264 .IR pathname .
265 If this causes the inode pointed to by 
266 .I pathname
267 to have no other references, deallocate the file.  This command functions
268 as the unlink() system call.
269 .I 
270 .TP
271 .I rmdir filespec
272 Remove the directory
273 .IR filespec .
274 This function is currently not implemented.
275 .TP
276 .I setb block
277 Mark the block number
278 .I block
279 as allocated.
280 .TP
281 .I seti filespec
282 Mark inode 
283 .I filespec
284 as in use in the inode bitmap.
285 .TP
286 .I show_super_stats [-h]
287 List the contents of the super block and the block group descriptors.  If the
288 .I -h
289 flag is given, only print out the superblock contents.
290 .TP
291 .I stat filespec
292 Display the contents of the inode structure of the inode
293 .IR filespec .
294 .TP
295 .I testb block
296 Test if the block number
297 .I block
298 is marked as allocated in the block bitmap.
299 .TP
300 .I testi filespec
301 Test if the inode 
302 .I filespec
303 is marked as allocated in the inode bitmap.
304 .TP
305 .I unlink pathname
306 Remove the link specified by 
307 .I pathname 
308 to an inode.  Note this does not adjust the inode reference counts.
309 .TP
310 .I write source_file out_file
311 Create a file in the filesystem named
312 .IR out_file ,
313 and copy the contents of
314 .I source_file
315 into the destination file.
316 .TP
317 .I lcd directory
318 Change the current working directory of the
319 .B debugfs
320 process to
321 .I directory
322 on the native filesystem.
323 .TP
324 .I rdump directory destination
325 Recursively dump
326 .I directory
327 and all its contents (including regular files, symbolic links, and other
328 directories) into the named
329 .I destination
330 which should be an existing directory on the native filesystem.
331 .SH SPECIFYING FILES
332 Many
333 .B debugfs
334 commands take a
335 .I filespec
336 as an argument to specify an inode (as opposed to a pathname) 
337 in the filesystem which is currently opened by 
338 .BR debugfs . 
339 The
340 .I filespec
341 argument may be specified in two forms.  The first form is an inode 
342 number surrounded by angle brackets, e.g., 
343 .IR <2> .
344 The second form is a pathname; if the pathname is prefixed by a forward slash
345 ('/'), then it is interpreted relative to the root of the filesystem 
346 which is currently opened by 
347 .BR debugfs .
348 If not, the pathname is 
349 interpreted relative to the current working directory as maintained by 
350 .BR debugfs .  
351 This may be modified by using the 
352 .B debugfs
353 command
354 .IR cd .
355 .SH AUTHOR
356 .B debugfs
357 was written by Theodore Ts'o <tytso@mit.edu>.
358 .SH SEE ALSO
359 .BR dumpe2fs (8),
360 .BR e2fsck (8),
361 .BR mke2fs (8)