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