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.
5 .TH DEBUGFS 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
7 debugfs \- ext2 file system debugger
46 program is an interactive file system debugger. It can be used to
47 examine and change the state of an ext2 file system.
50 is the special file corresponding to the device containing the ext2
51 file system (e.g /dev/hdXX).
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.
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.
67 represents an ext2 image file created by the
69 program. Since the ext2 image file only contains the superblock, block
70 group descriptor, block and inode allocation bitmaps, and
73 commands will not function properly.
75 no safety checks are in place, and
77 may fail in interesting ways if commands such as
81 is a debugging tool. It has rough edges!
84 Forces the use of the given block size for the file system, rather than
85 detecting the correct block size as normal.
88 Causes the file system superblock to be read from the given block number,
89 rather than the default (1). If you give a
91 option, you must also give a
98 to read in commands from
100 and execute them. When
102 is finished executing those commands, it will exit.
107 to execute the single command
112 print the version number of
120 as an argument to specify an inode (as opposed to a pathname)
121 in the filesystem which is currently opened by
125 argument may be specified in two forms. The first form is an inode
126 number surrounded by angle brackets, e.g.,
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
132 If not, the pathname is
133 interpreted relative to the current working directory as maintained by
135 This may be modified by using the
143 This is a list of the commands which
148 Dump the contents of the inode
153 Change the current working directory to
157 Change the root directory to be the directory
161 Close the currently open file system.
164 Clear the contents of the inode
167 .I dump [-p] filspec out_file
168 Dump the contents of the inode
174 option is given set the owner, group and permissions information on
179 .I expand_dir filespec
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.
188 .I find_free_block [count [goal]]
191 free blocks, starting from
195 .I find_free_inode [dir [mode]]
196 Find a free inode and allocate it. If present,
198 specifies the inode number of the directory
199 which the inode is to be located. The second
202 specifies the permissions of the new inode. (If the directory bit is set
203 on the mode, the allocation routine will function differently.)
205 .I freeb block [count]
206 Mark the block number
209 If the optional argument
213 blocks starting at block number
215 will be marked as not allocated.
218 Free the inode specified by
222 Print a list of commands understood by
226 Print a listing of the inodes which use the one or more blocks specified
229 .I initialize device blocksize
230 Create an ext2 file system on
234 Note that this does not fully initialize all of the data structures;
237 program. This is just a call to the low-level library, which sets up
238 the superblock and block descriptors.
240 .I kill_file filespec
243 and its blocks. Note that this does not remove any directory
244 entries (if any) to this inode. See the
246 command if you wish to unlink a file.
249 Change the current working directory of the
253 on the native filesystem.
255 .I ln filespec dest_file
260 Note this does not adjust the inode reference counts.
262 .I logdump [-ac] [-b<block>] [-i<inode>] [-f<journal_file>] [output_file]
263 Dump the contents of the ext3 journal.
265 .I ls [-l] [-d] filespec
266 Print a listing of the files in the directory
270 flag will list files using a more verbose format.
273 flag will list deleted entries in the directory.
275 .I modify_inode filespec
276 Modify the contents of the inode structure in the inode
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
288 device numbers must be specified.
290 .I ncheck inode_num ...
291 Take the requested list of inode numbers, and print a listing of pathnames
294 .I open [-w] [-f] [-i] [-c] [-b blocksize] [-s superblock] device
295 Open a filesystem for editing. The
297 flag causes the filesystem to be opened for writing. The
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
308 Print the current working directory.
314 .I rdump directory destination
317 and all its contents (including regular files, symbolic links, and other
318 directories) into the named
320 which should be an existing directory on the native filesystem.
325 If this causes the inode pointed to by
327 to have no other references, deallocate the file. This command functions
328 as the unlink() system call.
335 .I setb block [count]
336 Mark the block number
339 If the optional argument
343 blocks starting at block number
345 will be marked as allocated.
350 as in use in the inode bitmap.
352 .I set_super_value field value
353 Set the superblock field
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
361 .I show_super_stats [-h]
362 List the contents of the super block and the block group descriptors. If the
364 flag is given, only print out the superblock contents.
367 Display the contents of the inode structure of the inode
370 .I testb block [count]
371 Test if the block number
373 is marked as allocated in the block bitmap.
374 If the optional argument
378 blocks starting at block number
385 is marked as allocated in the inode bitmap.
388 Remove the link specified by
390 to an inode. Note this does not adjust the inode reference counts.
392 .I write source_file out_file
393 Create a file in the filesystem named
395 and copy the contents of
397 into the destination file.
400 was written by Theodore Ts'o <tytso@mit.edu>.