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
147 .I bmap filespec logical_block
148 Print the physical block number corresponding to the logical block number
154 Dump the contents of the inode
159 Change the current working directory to
163 Change the root directory to be the directory
167 Close the currently open file system.
170 Clear the contents of the inode
173 .I dump [-p] filspec out_file
174 Dump the contents of the inode
180 option is given set the owner, group and permissions information on
185 .I expand_dir filespec
189 .I feature [fs_feature] [-fs_feature] ...
190 Set or clear various filesystem features in the superblock. After setting
191 or clearing any filesystem features that were requested, print the current
192 state of the filesystem feature set.
194 .I find_free_block [count [goal]]
197 free blocks, starting from
201 .I find_free_inode [dir [mode]]
202 Find a free inode and allocate it. If present,
204 specifies the inode number of the directory
205 which the inode is to be located. The second
208 specifies the permissions of the new inode. (If the directory bit is set
209 on the mode, the allocation routine will function differently.)
211 .I freeb block [count]
212 Mark the block number
215 If the optional argument
219 blocks starting at block number
221 will be marked as not allocated.
224 Free the inode specified by
228 Print a list of commands understood by
232 Print a listing of the inodes which use the one or more blocks specified
236 Print the location of the inode data structure (in the inode table)
240 .I initialize device blocksize
241 Create an ext2 file system on
245 Note that this does not fully initialize all of the data structures;
248 program. This is just a call to the low-level library, which sets up
249 the superblock and block descriptors.
251 .I kill_file filespec
254 and its blocks. Note that this does not remove any directory
255 entries (if any) to this inode. See the
257 command if you wish to unlink a file.
260 Change the current working directory of the
264 on the native filesystem.
266 .I ln filespec dest_file
271 Note this does not adjust the inode reference counts.
273 .I logdump [-acs] [-b<block>] [-i<filespec>] [-f<journal_file>] [output_file]
274 Dump the contents of the ext3 journal. By default, the journal inode as
275 specified in the superblock. However, this can be overridden with the
277 option, which uses an inode specifier to specify the journal to be
278 used. A file containing journal data can be specified using the
282 option utilizes the backup information in the superblock to locate the
289 program to print the contents of all of the descriptor blocks.
294 to print all journal records that are refer to the specified block.
297 option will print out the contents of all of the data blocks selected by
304 .I ls [-l] [-d] filespec
305 Print a listing of the files in the directory
309 flag will list files using a more verbose format.
312 flag will list deleted entries in the directory.
314 .I modify_inode filespec
315 Modify the contents of the inode structure in the inode
321 .I mknod filespec [p|[[c|b] major minor]]
322 Create a special device file (a named pipe, character or block device).
323 If a character or block device is to be made, the
327 device numbers must be specified.
329 .I ncheck inode_num ...
330 Take the requested list of inode numbers, and print a listing of pathnames
333 .I open [-w] [-f] [-i] [-c] [-b blocksize] [-s superblock] device
334 Open a filesystem for editing. The
336 flag causes the filesystem to be opened for writing. The
338 flag forces the filesystem to be opened even if there are some unknown
339 or incompatible filesystem features which would normally
340 prevent the filesystem from being opened. The
341 .IR -c ", " -b ", " -i ", " and " -s
342 options behave the same as those to
347 Print the current working directory.
353 .I rdump directory destination
356 and all its contents (including regular files, symbolic links, and other
357 directories) into the named
359 which should be an existing directory on the native filesystem.
364 If this causes the inode pointed to by
366 to have no other references, deallocate the file. This command functions
367 as the unlink() system call.
374 .I setb block [count]
375 Mark the block number
378 If the optional argument
382 blocks starting at block number
384 will be marked as allocated.
389 as in use in the inode bitmap.
391 .I set_super_value field value
392 Set the superblock field
396 The list of valid superblock fields which can be set via this command
397 can be displayed by using the command:
398 .B set_super_value -l
400 .I show_super_stats [-h]
401 List the contents of the super block and the block group descriptors. If the
403 flag is given, only print out the superblock contents.
406 Display the contents of the inode structure of the inode
409 .I testb block [count]
410 Test if the block number
412 is marked as allocated in the block bitmap.
413 If the optional argument
417 blocks starting at block number
424 is marked as allocated in the inode bitmap.
427 Remove the link specified by
429 to an inode. Note this does not adjust the inode reference counts.
431 .I write source_file out_file
432 Create a file in the filesystem named
434 and copy the contents of
436 into the destination file.
439 was written by Theodore Ts'o <tytso@mit.edu>.