Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 1 | .\" -*- nroff -*- |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 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 | .\" |
Theodore Ts'o | 74becf3 | 1997-04-26 14:37:06 +0000 | [diff] [blame] | 5 | .TH DEBUGFS 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@" |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 6 | .SH NAME |
Theodore Ts'o | 4f85854 | 2009-05-30 12:34:28 -0400 | [diff] [blame] | 7 | debugfs \- ext2/ext3/ext4 file system debugger |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 8 | .SH SYNOPSIS |
| 9 | .B debugfs |
| 10 | [ |
Theodore Ts'o | 0fd68e0 | 2010-09-24 10:12:54 -0400 | [diff] [blame] | 11 | .B \-DVwci |
Theodore Ts'o | 1ad54a9 | 2004-07-28 21:11:48 -0400 | [diff] [blame] | 12 | ] |
| 13 | [ |
Theodore Ts'o | 2e8d40d | 2000-05-27 15:15:40 +0000 | [diff] [blame] | 14 | .B \-b |
| 15 | blocksize |
| 16 | ] |
| 17 | [ |
| 18 | .B \-s |
| 19 | superblock |
| 20 | ] |
| 21 | [ |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 22 | .B \-f |
| 23 | cmd_file |
| 24 | ] |
| 25 | [ |
| 26 | .B \-R |
| 27 | request |
| 28 | ] |
| 29 | [ |
Theodore Ts'o | 1ad54a9 | 2004-07-28 21:11:48 -0400 | [diff] [blame] | 30 | .B \-d |
| 31 | data_source_device |
Theodore Ts'o | 59cf7e0 | 2001-05-03 15:05:55 +0000 | [diff] [blame] | 32 | ] |
| 33 | [ |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 34 | device |
| 35 | ] |
| 36 | .SH DESCRIPTION |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 37 | The |
| 38 | .B debugfs |
Theodore Ts'o | 6e96adc | 2001-11-24 16:10:52 -0500 | [diff] [blame] | 39 | program is an interactive file system debugger. It can be used to |
Theodore Ts'o | 4f85854 | 2009-05-30 12:34:28 -0400 | [diff] [blame] | 40 | examine and change the state of an ext2, ext3, or ext4 file system. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 41 | .br |
| 42 | .I device |
Theodore Ts'o | 4f85854 | 2009-05-30 12:34:28 -0400 | [diff] [blame] | 43 | is the special file corresponding to the device containing the |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 44 | file system (e.g /dev/hdXX). |
| 45 | .SH OPTIONS |
| 46 | .TP |
Theodore Ts'o | 59cf7e0 | 2001-05-03 15:05:55 +0000 | [diff] [blame] | 47 | .I \-w |
Theodore Ts'o | 583ccdc | 1997-05-09 03:06:31 +0000 | [diff] [blame] | 48 | Specifies that the file system should be opened in read-write mode. |
| 49 | Without this option, the file system is opened in read-only mode. |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 50 | .TP |
Theodore Ts'o | 59cf7e0 | 2001-05-03 15:05:55 +0000 | [diff] [blame] | 51 | .I \-c |
Theodore Ts'o | 2e8d40d | 2000-05-27 15:15:40 +0000 | [diff] [blame] | 52 | Specifies that the file system should be opened in catastrophic mode, in |
| 53 | which the inode and group bitmaps are not read initially. This can be |
| 54 | useful for filesystems with significant corruption, but because of this, |
| 55 | catastrophic mode forces the filesystem to be opened read-only. |
| 56 | .TP |
Theodore Ts'o | 59cf7e0 | 2001-05-03 15:05:55 +0000 | [diff] [blame] | 57 | .I \-i |
| 58 | Specifies that |
| 59 | .I device |
| 60 | represents an ext2 image file created by the |
| 61 | .B e2image |
| 62 | program. Since the ext2 image file only contains the superblock, block |
| 63 | group descriptor, block and inode allocation bitmaps, and |
| 64 | the inode table, many |
| 65 | .B debugfs |
| 66 | commands will not function properly. |
| 67 | .B Warning: |
| 68 | no safety checks are in place, and |
| 69 | .B debugfs |
| 70 | may fail in interesting ways if commands such as |
| 71 | .IR ls ", " dump ", " |
Theodore Ts'o | 1ad54a9 | 2004-07-28 21:11:48 -0400 | [diff] [blame] | 72 | etc. are tried without specifying the |
| 73 | .I data_source_device |
| 74 | using the |
| 75 | .I \-d |
| 76 | option. |
Theodore Ts'o | 59cf7e0 | 2001-05-03 15:05:55 +0000 | [diff] [blame] | 77 | .B debugfs |
| 78 | is a debugging tool. It has rough edges! |
| 79 | .TP |
Theodore Ts'o | 1ad54a9 | 2004-07-28 21:11:48 -0400 | [diff] [blame] | 80 | .I -d data_source_device |
| 81 | Used with the |
| 82 | .I \-i |
| 83 | option, specifies that |
| 84 | .I data_source_device |
| 85 | should be used when reading blocks not found in the ext2 image file. |
| 86 | This includes data, directory, and indirect blocks. |
| 87 | .TP |
Theodore Ts'o | 2e8d40d | 2000-05-27 15:15:40 +0000 | [diff] [blame] | 88 | .I -b blocksize |
| 89 | Forces the use of the given block size for the file system, rather than |
| 90 | detecting the correct block size as normal. |
| 91 | .TP |
| 92 | .I -s superblock |
Theodore Ts'o | 054cd1f | 2008-06-17 21:55:38 -0400 | [diff] [blame] | 93 | Causes the file system superblock to be read from the given block |
| 94 | number, instead of using the primary superblock (located at an offset of |
| 95 | 1024 bytes from the beginning of the filesystem). If you specify the |
Theodore Ts'o | 2e8d40d | 2000-05-27 15:15:40 +0000 | [diff] [blame] | 96 | .I -s |
Theodore Ts'o | 054cd1f | 2008-06-17 21:55:38 -0400 | [diff] [blame] | 97 | option, you must also provide the blocksize of the filesystem via the |
Theodore Ts'o | 2e8d40d | 2000-05-27 15:15:40 +0000 | [diff] [blame] | 98 | .I -b |
| 99 | option. |
| 100 | .TP |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 101 | .I -f cmd_file |
| 102 | Causes |
| 103 | .B debugfs |
| 104 | to read in commands from |
| 105 | .IR cmd_file , |
| 106 | and execute them. When |
| 107 | .B debugfs |
Theodore Ts'o | 583ccdc | 1997-05-09 03:06:31 +0000 | [diff] [blame] | 108 | is finished executing those commands, it will exit. |
Theodore Ts'o | 0fd68e0 | 2010-09-24 10:12:54 -0400 | [diff] [blame] | 109 | .TP |
| 110 | .I -D |
| 111 | Causes |
| 112 | .B debugfs |
| 113 | to open the device using Direct I/O, bypassing the buffer cache. Note |
| 114 | that some Linux devices, notably device mapper as of this writing, do |
| 115 | not support Direct I/O. |
| 116 | .TP |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 117 | .I -R request |
| 118 | Causes |
| 119 | .B debugfs |
| 120 | to execute the single command |
| 121 | .IR request , |
| 122 | and then exit. |
Theodore Ts'o | 818180c | 1998-06-27 05:11:14 +0000 | [diff] [blame] | 123 | .TP |
| 124 | .I -V |
| 125 | print the version number of |
| 126 | .B debugfs |
| 127 | and exit. |
Theodore Ts'o | 6e96adc | 2001-11-24 16:10:52 -0500 | [diff] [blame] | 128 | .SH SPECIFYING FILES |
| 129 | Many |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 130 | .B debugfs |
Theodore Ts'o | 6e96adc | 2001-11-24 16:10:52 -0500 | [diff] [blame] | 131 | commands take a |
| 132 | .I filespec |
| 133 | as an argument to specify an inode (as opposed to a pathname) |
| 134 | in the filesystem which is currently opened by |
| 135 | .BR debugfs . |
| 136 | The |
| 137 | .I filespec |
| 138 | argument may be specified in two forms. The first form is an inode |
| 139 | number surrounded by angle brackets, e.g., |
| 140 | .IR <2> . |
| 141 | The second form is a pathname; if the pathname is prefixed by a forward slash |
| 142 | ('/'), then it is interpreted relative to the root of the filesystem |
| 143 | which is currently opened by |
| 144 | .BR debugfs . |
| 145 | If not, the pathname is |
| 146 | interpreted relative to the current working directory as maintained by |
| 147 | .BR debugfs . |
| 148 | This may be modified by using the |
| 149 | .B debugfs |
| 150 | command |
| 151 | .IR cd . |
| 152 | .\" |
| 153 | .\" |
| 154 | .\" |
| 155 | .SH COMMANDS |
| 156 | This is a list of the commands which |
| 157 | .B debugfs |
| 158 | supports. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 159 | .TP |
Theodore Ts'o | becf36f | 2003-05-05 11:35:04 -0400 | [diff] [blame] | 160 | .I bmap filespec logical_block |
| 161 | Print the physical block number corresponding to the logical block number |
| 162 | .I logical_block |
| 163 | in the inode |
| 164 | .IR filespec . |
| 165 | .TP |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 166 | .I cat filespec |
| 167 | Dump the contents of the inode |
| 168 | .I filespec |
| 169 | to stdout. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 170 | .TP |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 171 | .I cd filespec |
| 172 | Change the current working directory to |
| 173 | .IR filespec . |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 174 | .TP |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 175 | .I chroot filespec |
| 176 | Change the root directory to be the directory |
| 177 | .IR filespec . |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 178 | .TP |
Theodore Ts'o | 6dce532 | 2009-05-28 22:03:33 -0400 | [diff] [blame] | 179 | .I close [-a] |
| 180 | Close the currently open file system. If the |
| 181 | .I -a |
| 182 | option is specified, write out any changes to the superblock and block |
| 183 | group descriptors to all of the backup superblocks, not just to the |
| 184 | master superblock. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 185 | .TP |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 186 | .I clri file |
| 187 | Clear the contents of the inode |
| 188 | .IR file . |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 189 | .TP |
Theodore Ts'o | 711d384 | 2008-09-07 14:08:40 -0400 | [diff] [blame] | 190 | .I dump [-p] filespec out_file |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 191 | Dump the contents of the inode |
| 192 | .I filespec |
| 193 | to the output file |
| 194 | .IR out_file . |
| 195 | If the |
| 196 | .I -p |
| 197 | option is given set the owner, group and permissions information on |
| 198 | .I out_file |
| 199 | to match |
| 200 | .IR filespec . |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 201 | .TP |
Theodore Ts'o | 187cb62 | 2009-07-26 22:29:47 -0400 | [diff] [blame] | 202 | .I dump_extents [-n] [-l] filespec |
| 203 | Dump the the extent tree of the inode |
| 204 | .IR filespec . |
| 205 | The |
| 206 | .I -n |
| 207 | flag will cause |
| 208 | .I dump_extents |
| 209 | to only display the interior nodes in the extent tree. The |
| 210 | .I -l |
| 211 | flag cause |
| 212 | .I dump_extents |
| 213 | to only display the leaf nodes in the extent tree. |
| 214 | .IP |
| 215 | (Please note that the length and range of blocks for the last extent in |
| 216 | an interior node is an estimate by the extents library functions, and is |
| 217 | not stored in file esystem data structures. Hence, the values displayed |
| 218 | may not necessarily by accurate and does not indicate a problem or |
| 219 | corruption in the file system.) |
| 220 | .TP |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 221 | .I expand_dir filespec |
| 222 | Expand the directory |
| 223 | .IR filespec . |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 224 | .TP |
Theodore Ts'o | d3aea7d | 1999-09-14 20:55:37 +0000 | [diff] [blame] | 225 | .I feature [fs_feature] [-fs_feature] ... |
| 226 | Set or clear various filesystem features in the superblock. After setting |
| 227 | or clearing any filesystem features that were requested, print the current |
| 228 | state of the filesystem feature set. |
| 229 | .TP |
Theodore Ts'o | e1018ee | 2002-01-03 04:55:25 -0500 | [diff] [blame] | 230 | .I find_free_block [count [goal]] |
| 231 | Find the first |
| 232 | .I count |
| 233 | free blocks, starting from |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 234 | .I goal |
Theodore Ts'o | 583ccdc | 1997-05-09 03:06:31 +0000 | [diff] [blame] | 235 | and allocate it. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 236 | .TP |
| 237 | .I find_free_inode [dir [mode]] |
Theodore Ts'o | 583ccdc | 1997-05-09 03:06:31 +0000 | [diff] [blame] | 238 | Find a free inode and allocate it. If present, |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 239 | .I dir |
| 240 | specifies the inode number of the directory |
| 241 | which the inode is to be located. The second |
| 242 | optional argument |
| 243 | .I mode |
| 244 | specifies the permissions of the new inode. (If the directory bit is set |
| 245 | on the mode, the allocation routine will function differently.) |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 246 | .TP |
Theodore Ts'o | e1018ee | 2002-01-03 04:55:25 -0500 | [diff] [blame] | 247 | .I freeb block [count] |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 248 | Mark the block number |
| 249 | .I block |
| 250 | as not allocated. |
Theodore Ts'o | e1018ee | 2002-01-03 04:55:25 -0500 | [diff] [blame] | 251 | If the optional argument |
| 252 | .I count |
| 253 | is present, then |
| 254 | .I count |
| 255 | blocks starting at block number |
| 256 | .I block |
| 257 | will be marked as not allocated. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 258 | .TP |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 259 | .I freei filespec |
| 260 | Free the inode specified by |
Theodore Ts'o | 583ccdc | 1997-05-09 03:06:31 +0000 | [diff] [blame] | 261 | .IR filespec . |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 262 | .TP |
| 263 | .I help |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 264 | Print a list of commands understood by |
Theodore Ts'o | 0fd68e0 | 2010-09-24 10:12:54 -0400 | [diff] [blame] | 265 | .BR debugfs . |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 266 | .TP |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 267 | .I icheck block ... |
Theodore Ts'o | 583ccdc | 1997-05-09 03:06:31 +0000 | [diff] [blame] | 268 | Print a listing of the inodes which use the one or more blocks specified |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 269 | on the command line. |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 270 | .TP |
Theodore Ts'o | becf36f | 2003-05-05 11:35:04 -0400 | [diff] [blame] | 271 | .I imap filespec |
| 272 | Print the location of the inode data structure (in the inode table) |
| 273 | of the inode |
| 274 | .IR filespec . |
| 275 | .TP |
Theodore Ts'o | 90252ca | 2004-02-21 22:20:01 -0500 | [diff] [blame] | 276 | .I init_filesys device blocksize |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 277 | Create an ext2 file system on |
| 278 | .I device |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 279 | with device size |
| 280 | .IR blocksize . |
| 281 | Note that this does not fully initialize all of the data structures; |
| 282 | to do this, use the |
| 283 | .BR mke2fs (8) |
| 284 | program. This is just a call to the low-level library, which sets up |
| 285 | the superblock and block descriptors. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 286 | .TP |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 287 | .I kill_file filespec |
Theodore Ts'o | 583ccdc | 1997-05-09 03:06:31 +0000 | [diff] [blame] | 288 | Deallocate the inode |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 289 | .I filespec |
| 290 | and its blocks. Note that this does not remove any directory |
| 291 | entries (if any) to this inode. See the |
Theodore Ts'o | 583ccdc | 1997-05-09 03:06:31 +0000 | [diff] [blame] | 292 | .BR rm (1) |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 293 | command if you wish to unlink a file. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 294 | .TP |
Theodore Ts'o | 6e96adc | 2001-11-24 16:10:52 -0500 | [diff] [blame] | 295 | .I lcd directory |
| 296 | Change the current working directory of the |
| 297 | .B debugfs |
| 298 | process to |
| 299 | .I directory |
| 300 | on the native filesystem. |
| 301 | .TP |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 302 | .I ln filespec dest_file |
| 303 | Create a link named |
| 304 | .I dest_file |
| 305 | which is a link to |
| 306 | .IR filespec . |
| 307 | Note this does not adjust the inode reference counts. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 308 | .TP |
Theodore Ts'o | a435ec3 | 2003-08-21 00:40:26 -0400 | [diff] [blame] | 309 | .I logdump [-acs] [-b<block>] [-i<filespec>] [-f<journal_file>] [output_file] |
| 310 | Dump the contents of the ext3 journal. By default, the journal inode as |
| 311 | specified in the superblock. However, this can be overridden with the |
| 312 | .I \-i |
| 313 | option, which uses an inode specifier to specify the journal to be |
| 314 | used. A file containing journal data can be specified using the |
| 315 | .I \-f |
| 316 | option. Finally, the |
| 317 | .I \-s |
| 318 | option utilizes the backup information in the superblock to locate the |
| 319 | journal. |
| 320 | .IP |
| 321 | The |
| 322 | .I \-a |
| 323 | option causes the |
| 324 | .I logdump |
| 325 | program to print the contents of all of the descriptor blocks. |
| 326 | The |
| 327 | .I \-b |
| 328 | option causes |
| 329 | .I logdump |
| 330 | to print all journal records that are refer to the specified block. |
| 331 | The |
| 332 | .I \-c |
| 333 | option will print out the contents of all of the data blocks selected by |
| 334 | the |
| 335 | .I \-a |
| 336 | and |
| 337 | .I \-b |
| 338 | options. |
Theodore Ts'o | 6e96adc | 2001-11-24 16:10:52 -0500 | [diff] [blame] | 339 | .TP |
Theodore Ts'o | d056b99 | 2008-01-04 15:28:51 -0500 | [diff] [blame] | 340 | .I ls [-l] [-d] [-p] filespec |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 341 | Print a listing of the files in the directory |
| 342 | .IR filespec . |
Theodore Ts'o | e1018ee | 2002-01-03 04:55:25 -0500 | [diff] [blame] | 343 | The |
| 344 | .I \-l |
| 345 | flag will list files using a more verbose format. |
| 346 | The |
| 347 | .I \-d |
| 348 | flag will list deleted entries in the directory. |
Theodore Ts'o | d056b99 | 2008-01-04 15:28:51 -0500 | [diff] [blame] | 349 | The |
| 350 | .I \-p |
| 351 | flag will list the files in a format which is more easily parsable by |
| 352 | scripts, as well as making it more clear when there are spaces or other |
Theodore Ts'o | 711d384 | 2008-09-07 14:08:40 -0400 | [diff] [blame] | 353 | non-printing characters at the end of filenames. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 354 | .TP |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 355 | .I modify_inode filespec |
| 356 | Modify the contents of the inode structure in the inode |
| 357 | .IR filespec . |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 358 | .TP |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 359 | .I mkdir filespec |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 360 | Make a directory. |
| 361 | .TP |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 362 | .I mknod filespec [p|[[c|b] major minor]] |
| 363 | Create a special device file (a named pipe, character or block device). |
| 364 | If a character or block device is to be made, the |
| 365 | .I major |
| 366 | and |
| 367 | .I minor |
| 368 | device numbers must be specified. |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 369 | .TP |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 370 | .I ncheck inode_num ... |
Theodore Ts'o | 583ccdc | 1997-05-09 03:06:31 +0000 | [diff] [blame] | 371 | Take the requested list of inode numbers, and print a listing of pathnames |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 372 | to those inodes. |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 373 | .TP |
Theodore Ts'o | 0fd68e0 | 2010-09-24 10:12:54 -0400 | [diff] [blame] | 374 | .I open [-w] [-e] [-f] [-i] [-c] [-D] [-b blocksize] [-s superblock] device |
Theodore Ts'o | d3aea7d | 1999-09-14 20:55:37 +0000 | [diff] [blame] | 375 | Open a filesystem for editing. The |
Theodore Ts'o | d3aea7d | 1999-09-14 20:55:37 +0000 | [diff] [blame] | 376 | .I -f |
| 377 | flag forces the filesystem to be opened even if there are some unknown |
| 378 | or incompatible filesystem features which would normally |
Theodore Ts'o | 2e8d40d | 2000-05-27 15:15:40 +0000 | [diff] [blame] | 379 | prevent the filesystem from being opened. The |
Theodore Ts'o | 98eb44b | 2006-03-18 19:58:13 -0500 | [diff] [blame] | 380 | .I -e |
| 381 | flag causes the filesystem to be opened in exclusive mode. The |
Theodore Ts'o | 0fd68e0 | 2010-09-24 10:12:54 -0400 | [diff] [blame] | 382 | .IR -b ", " -c ", " -i ", " -s ", " -w ", and " -D |
Theodore Ts'o | 98eb44b | 2006-03-18 19:58:13 -0500 | [diff] [blame] | 383 | options behave the same as the command-line options to |
| 384 | .BR debugfs . |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 385 | .TP |
| 386 | .I pwd |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 387 | Print the current working directory. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 388 | .TP |
| 389 | .I quit |
| 390 | Quit |
| 391 | .B debugfs |
| 392 | .TP |
Theodore Ts'o | 6e96adc | 2001-11-24 16:10:52 -0500 | [diff] [blame] | 393 | .I rdump directory destination |
| 394 | Recursively dump |
| 395 | .I directory |
| 396 | and all its contents (including regular files, symbolic links, and other |
| 397 | directories) into the named |
| 398 | .I destination |
| 399 | which should be an existing directory on the native filesystem. |
| 400 | .TP |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 401 | .I rm pathname |
| 402 | Unlink |
| 403 | .IR pathname . |
Theodore Ts'o | 583ccdc | 1997-05-09 03:06:31 +0000 | [diff] [blame] | 404 | If this causes the inode pointed to by |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 405 | .I pathname |
| 406 | to have no other references, deallocate the file. This command functions |
| 407 | as the unlink() system call. |
| 408 | .I |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 409 | .TP |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 410 | .I rmdir filespec |
| 411 | Remove the directory |
| 412 | .IR filespec . |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 413 | .TP |
Theodore Ts'o | e1018ee | 2002-01-03 04:55:25 -0500 | [diff] [blame] | 414 | .I setb block [count] |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 415 | Mark the block number |
| 416 | .I block |
| 417 | as allocated. |
Theodore Ts'o | e1018ee | 2002-01-03 04:55:25 -0500 | [diff] [blame] | 418 | If the optional argument |
| 419 | .I count |
| 420 | is present, then |
| 421 | .I count |
| 422 | blocks starting at block number |
| 423 | .I block |
| 424 | will be marked as allocated. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 425 | .TP |
Theodore Ts'o | c7c1209 | 2007-04-13 15:56:00 -0400 | [diff] [blame] | 426 | .I set_block_group bgnum field value |
| 427 | Modify the block group descriptor specified by |
| 428 | .I bgnum |
| 429 | so that the block group descriptor field |
| 430 | .I field |
| 431 | has value |
| 432 | .I value. |
| 433 | .TP |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 434 | .I seti filespec |
| 435 | Mark inode |
| 436 | .I filespec |
| 437 | as in use in the inode bitmap. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 438 | .TP |
Theodore Ts'o | 1d3a951 | 2005-01-07 21:14:12 -0500 | [diff] [blame] | 439 | .I set_inode_field filespec field value |
Theodore Ts'o | 7dec050 | 2004-12-21 20:37:36 -0500 | [diff] [blame] | 440 | Modify the inode specified by |
| 441 | .I filespec |
| 442 | so that the inode field |
| 443 | .I field |
| 444 | has value |
| 445 | .I value. |
| 446 | The list of valid inode fields which can be set via this command |
| 447 | can be displayed by using the command: |
Theodore Ts'o | 1d3a951 | 2005-01-07 21:14:12 -0500 | [diff] [blame] | 448 | .B set_inode_field -l |
Theodore Ts'o | 7dec050 | 2004-12-21 20:37:36 -0500 | [diff] [blame] | 449 | .TP |
Theodore Ts'o | 6e96adc | 2001-11-24 16:10:52 -0500 | [diff] [blame] | 450 | .I set_super_value field value |
| 451 | Set the superblock field |
| 452 | .I field |
| 453 | to |
| 454 | .I value. |
| 455 | The list of valid superblock fields which can be set via this command |
| 456 | can be displayed by using the command: |
| 457 | .B set_super_value -l |
| 458 | .TP |
Theodore Ts'o | d3aea7d | 1999-09-14 20:55:37 +0000 | [diff] [blame] | 459 | .I show_super_stats [-h] |
| 460 | List the contents of the super block and the block group descriptors. If the |
| 461 | .I -h |
| 462 | flag is given, only print out the superblock contents. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 463 | .TP |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 464 | .I stat filespec |
| 465 | Display the contents of the inode structure of the inode |
| 466 | .IR filespec . |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 467 | .TP |
Theodore Ts'o | e1018ee | 2002-01-03 04:55:25 -0500 | [diff] [blame] | 468 | .I testb block [count] |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 469 | Test if the block number |
| 470 | .I block |
| 471 | is marked as allocated in the block bitmap. |
Theodore Ts'o | e1018ee | 2002-01-03 04:55:25 -0500 | [diff] [blame] | 472 | If the optional argument |
| 473 | .I count |
| 474 | is present, then |
| 475 | .I count |
| 476 | blocks starting at block number |
| 477 | .I block |
| 478 | will be tested. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 479 | .TP |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 480 | .I testi filespec |
| 481 | Test if the inode |
| 482 | .I filespec |
| 483 | is marked as allocated in the inode bitmap. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 484 | .TP |
Theodore Ts'o | b026d53 | 2008-01-01 11:37:20 -0500 | [diff] [blame] | 485 | .I undel <inode num> [pathname] |
| 486 | Undelete the specified inode number (which must be surrounded by angle |
| 487 | brackets) so that it and its blocks are marked in use, and optionally |
| 488 | link the recovered inode to the specified pathname. The |
| 489 | .B e2fsck |
| 490 | command should always be run after using the |
| 491 | .B undel |
| 492 | command to recover deleted files. |
| 493 | .IP |
| 494 | Note that if you are recovering a large number of deleted files, linking |
| 495 | the inode to a directory may require the directory to be expanded, which |
| 496 | could allocate a block that had been used by one of the |
| 497 | yet-to-be-undeleted files. So it is safer to undelete all of the |
| 498 | inodes without specifying a destination pathname, and then in a separate |
| 499 | pass, use the debugfs |
| 500 | .B link |
| 501 | command to link the inode to the destination pathname, or use |
| 502 | .B e2fsck |
| 503 | to check the filesystem and link all of the recovered inodes to the |
Theodore Ts'o | 711d384 | 2008-09-07 14:08:40 -0400 | [diff] [blame] | 504 | lost+found directory. |
Theodore Ts'o | b026d53 | 2008-01-01 11:37:20 -0500 | [diff] [blame] | 505 | .TP |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 506 | .I unlink pathname |
| 507 | Remove the link specified by |
| 508 | .I pathname |
| 509 | to an inode. Note this does not adjust the inode reference counts. |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 510 | .TP |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 511 | .I write source_file out_file |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 512 | Create a file in the filesystem named |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 513 | .IR out_file , |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 514 | and copy the contents of |
| 515 | .I source_file |
| 516 | into the destination file. |
Theodore Ts'o | 2b5ddd7 | 2004-01-24 18:54:41 -0500 | [diff] [blame] | 517 | .SH ENVIRONMENT VARIABLES |
| 518 | .TP |
| 519 | .B DEBUGFS_PAGER, PAGER |
| 520 | The |
Theodore Ts'o | 0fd68e0 | 2010-09-24 10:12:54 -0400 | [diff] [blame] | 521 | .B debugfs |
Theodore Ts'o | 2b5ddd7 | 2004-01-24 18:54:41 -0500 | [diff] [blame] | 522 | program always pipes the output of the some commands through a |
| 523 | pager program. These commands include: |
| 524 | .IR show_super_stats , |
| 525 | .IR list_directory , |
| 526 | .IR show_inode_info , |
| 527 | .IR list_deleted_inodes , |
| 528 | and |
| 529 | .IR htree_dump . |
| 530 | The specific pager can explicitly specified by the |
| 531 | .B DEBUGFS_PAGER |
| 532 | environment variable, and if it is not set, by the |
| 533 | .B PAGER |
| 534 | environment variable. |
| 535 | .IP |
| 536 | Note that since a pager is always used, the |
| 537 | .BR less (1) |
| 538 | pager is not particularly appropriate, since it clears the screen before |
| 539 | displaying the output of the command and clears the output the screen |
| 540 | when the pager is exited. Many users prefer to use the |
| 541 | .BR less (1) |
| 542 | pager for most purposes, which is why the |
| 543 | .B DEBUGFS_PAGER |
| 544 | environment variable is available to override the more general |
| 545 | .B PAGER |
| 546 | environment variable. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 547 | .SH AUTHOR |
| 548 | .B debugfs |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 549 | was written by Theodore Ts'o <tytso@mit.edu>. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 550 | .SH SEE ALSO |
| 551 | .BR dumpe2fs (8), |
Andreas Mohr | 0fd2f90 | 2008-02-28 20:50:05 -0500 | [diff] [blame] | 552 | .BR tune2fs (8), |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 553 | .BR e2fsck (8), |
| 554 | .BR mke2fs (8) |