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. |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 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 | [ |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 22 | .B \-f |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 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 |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [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 |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 58 | Specifies that |
Theodore Ts'o | 59cf7e0 | 2001-05-03 15:05:55 +0000 | [diff] [blame] | 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 |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 63 | group descriptor, block and inode allocation bitmaps, and |
Theodore Ts'o | 59cf7e0 | 2001-05-03 15:05:55 +0000 | [diff] [blame] | 64 | the inode table, many |
| 65 | .B debugfs |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 66 | commands will not function properly. |
Theodore Ts'o | 59cf7e0 | 2001-05-03 15:05:55 +0000 | [diff] [blame] | 67 | .B Warning: |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 68 | no safety checks are in place, and |
| 69 | .B debugfs |
Theodore Ts'o | 59cf7e0 | 2001-05-03 15:05:55 +0000 | [diff] [blame] | 70 | may fail in interesting ways if commands such as |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 71 | .IR ls ", " dump ", " |
| 72 | etc. are tried without specifying the |
Theodore Ts'o | 1ad54a9 | 2004-07-28 21:11:48 -0400 | [diff] [blame] | 73 | .I data_source_device |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 74 | using the |
Theodore Ts'o | 1ad54a9 | 2004-07-28 21:11:48 -0400 | [diff] [blame] | 75 | .I \-d |
| 76 | option. |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 77 | .B debugfs |
Theodore Ts'o | 59cf7e0 | 2001-05-03 15:05:55 +0000 | [diff] [blame] | 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 |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 81 | Used with the |
Theodore Ts'o | 1ad54a9 | 2004-07-28 21:11:48 -0400 | [diff] [blame] | 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 |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 102 | Causes |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 103 | .B debugfs |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 104 | to read in commands from |
| 105 | .IR cmd_file , |
| 106 | and execute them. When |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 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 |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 118 | Causes |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 119 | .B debugfs |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 120 | to execute the single command |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 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 |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 125 | print the version number of |
Theodore Ts'o | 818180c | 1998-06-27 05:11:14 +0000 | [diff] [blame] | 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 |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 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 . |
Theodore Ts'o | 6e96adc | 2001-11-24 16:10:52 -0500 | [diff] [blame] | 136 | The |
| 137 | .I filespec |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 138 | argument may be specified in two forms. The first form is an inode |
| 139 | number surrounded by angle brackets, e.g., |
Theodore Ts'o | 6e96adc | 2001-11-24 16:10:52 -0500 | [diff] [blame] | 140 | .IR <2> . |
| 141 | The second form is a pathname; if the pathname is prefixed by a forward slash |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 142 | ('/'), then it is interpreted relative to the root of the filesystem |
| 143 | which is currently opened by |
Theodore Ts'o | 6e96adc | 2001-11-24 16:10:52 -0500 | [diff] [blame] | 144 | .BR debugfs . |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 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 |
Theodore Ts'o | 6e96adc | 2001-11-24 16:10:52 -0500 | [diff] [blame] | 149 | .B debugfs |
| 150 | command |
| 151 | .IR cd . |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 152 | .\" |
Theodore Ts'o | 6e96adc | 2001-11-24 16:10:52 -0500 | [diff] [blame] | 153 | .\" |
| 154 | .\" |
| 155 | .SH COMMANDS |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 156 | This is a list of the commands which |
Theodore Ts'o | 6e96adc | 2001-11-24 16:10:52 -0500 | [diff] [blame] | 157 | .B debugfs |
| 158 | supports. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 159 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 160 | .BI blocks " filespace" |
| 161 | Print the blocks used by the inode |
| 162 | .I filespec |
| 163 | to stdout. |
| 164 | .TP |
| 165 | .BI bmap " filespec logical_block" |
Theodore Ts'o | becf36f | 2003-05-05 11:35:04 -0400 | [diff] [blame] | 166 | Print the physical block number corresponding to the logical block number |
| 167 | .I logical_block |
| 168 | in the inode |
| 169 | .IR filespec . |
| 170 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 171 | .BI block_dump " [-f filespec] block_num" |
| 172 | Dump the filesystem block given by |
| 173 | .I block_num |
| 174 | in hex and ASCII format to the console. If the |
| 175 | .I -f |
| 176 | option is specified, the block number is relative to the start of the given |
| 177 | .BR filespec . |
| 178 | .TP |
| 179 | .BI cat " filespec" |
| 180 | Dump the contents of the inode |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 181 | .I filespec |
| 182 | to stdout. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 183 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 184 | .BI cd " filespec" |
| 185 | Change the current working directory to |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 186 | .IR filespec . |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 187 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 188 | .BI chroot " filespec" |
| 189 | Change the root directory to be the directory |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 190 | .IR filespec . |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 191 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 192 | .BI close " [-a]" |
| 193 | Close the currently open file system. If the |
Theodore Ts'o | 6dce532 | 2009-05-28 22:03:33 -0400 | [diff] [blame] | 194 | .I -a |
| 195 | option is specified, write out any changes to the superblock and block |
| 196 | group descriptors to all of the backup superblocks, not just to the |
| 197 | master superblock. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 198 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 199 | .BI clri " filespec" |
| 200 | Clear the contents of the inode |
Andreas Dilger | dba2bbd | 2013-12-15 22:12:43 -0500 | [diff] [blame] | 201 | .IR filespec . |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 202 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 203 | .BI dirsearch " filespec filename" |
| 204 | Search the directory |
| 205 | .I filespec |
| 206 | for |
| 207 | .IR filename . |
| 208 | .TP |
| 209 | .B dirty |
| 210 | Mark the filesystem as dirty, so that the superblocks will be written on exit. |
| 211 | .TP |
| 212 | .BI dump " [-p] filespec out_file" |
| 213 | Dump the contents of the inode |
| 214 | .I filespec |
| 215 | to the output file |
| 216 | .IR out_file . |
| 217 | If the |
| 218 | .I -p |
| 219 | option is given set the owner, group and permissions information on |
| 220 | .I out_file |
| 221 | to match |
| 222 | .IR filespec . |
| 223 | .TP |
| 224 | .B dump_mmp |
| 225 | Display the multiple-mount protection (mmp) field values. |
| 226 | .TP |
| 227 | .BI dx_hash " [-h hash_alg] [-s hash_seed] filename" |
| 228 | Calculate the directory hash of |
| 229 | .IR filename . |
| 230 | The hash algorithm specified with |
| 231 | .I -h |
| 232 | may be |
| 233 | .BR legacy , " half_md4" ", or " tea . |
| 234 | The hash seed specified with |
| 235 | .I -s |
| 236 | must be in UUID format. |
| 237 | .TP |
| 238 | .BI dump_extents " [-n] [-l] filespec" |
Theodore Ts'o | 187cb62 | 2009-07-26 22:29:47 -0400 | [diff] [blame] | 239 | Dump the the extent tree of the inode |
| 240 | .IR filespec . |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 241 | The |
Theodore Ts'o | 187cb62 | 2009-07-26 22:29:47 -0400 | [diff] [blame] | 242 | .I -n |
| 243 | flag will cause |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 244 | .B dump_extents |
Theodore Ts'o | 187cb62 | 2009-07-26 22:29:47 -0400 | [diff] [blame] | 245 | to only display the interior nodes in the extent tree. The |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 246 | .I -l |
| 247 | flag will cause |
| 248 | .B dump_extents |
Theodore Ts'o | 187cb62 | 2009-07-26 22:29:47 -0400 | [diff] [blame] | 249 | to only display the leaf nodes in the extent tree. |
| 250 | .IP |
| 251 | (Please note that the length and range of blocks for the last extent in |
| 252 | an interior node is an estimate by the extents library functions, and is |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 253 | not stored in filesystem data structures. Hence, the values displayed |
| 254 | may not necessarily by accurate and does not indicate a problem or |
Theodore Ts'o | 187cb62 | 2009-07-26 22:29:47 -0400 | [diff] [blame] | 255 | corruption in the file system.) |
| 256 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 257 | .BI expand_dir " filespec" |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 258 | Expand the directory |
| 259 | .IR filespec . |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 260 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 261 | .BI feature " [fs_feature] [-fs_feature] ..." |
Theodore Ts'o | d3aea7d | 1999-09-14 20:55:37 +0000 | [diff] [blame] | 262 | Set or clear various filesystem features in the superblock. After setting |
| 263 | or clearing any filesystem features that were requested, print the current |
| 264 | state of the filesystem feature set. |
| 265 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 266 | .BI filefrag " [-dvr] filespec" |
| 267 | Print the number of contiguous extents in |
| 268 | .IR filespec . |
| 269 | If |
| 270 | .I filespec |
| 271 | is a directory and the |
| 272 | .I -d |
| 273 | option is not specified, |
| 274 | .I filefrag |
| 275 | will print the number of contiguous extents for each file in |
| 276 | the directory. The |
| 277 | .I -v |
| 278 | option will cause |
| 279 | .I filefrag |
| 280 | print a tabular listing of the contiguous extents in the |
| 281 | file. The |
| 282 | .I -r |
| 283 | option will cause |
| 284 | .I filefrag |
| 285 | to do a recursive listing of the directory. |
| 286 | .TP |
| 287 | .BI find_free_block " [count [goal]]" |
| 288 | Find the first |
Theodore Ts'o | e1018ee | 2002-01-03 04:55:25 -0500 | [diff] [blame] | 289 | .I count |
| 290 | free blocks, starting from |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 291 | .I goal |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 292 | and allocate it. Also available as |
| 293 | .BR ffb . |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 294 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 295 | .BI find_free_inode " [dir [mode]]" |
| 296 | Find a free inode and allocate it. If present, |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 297 | .I dir |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 298 | specifies the inode number of the directory |
| 299 | which the inode is to be located. The second |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 300 | optional argument |
| 301 | .I mode |
| 302 | specifies the permissions of the new inode. (If the directory bit is set |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 303 | on the mode, the allocation routine will function differently.) Also |
| 304 | available as |
| 305 | .BR ffi . |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 306 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 307 | .BI freeb " block [count]" |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 308 | Mark the block number |
| 309 | .I block |
| 310 | as not allocated. |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 311 | If the optional argument |
| 312 | .I count |
| 313 | is present, then |
Theodore Ts'o | e1018ee | 2002-01-03 04:55:25 -0500 | [diff] [blame] | 314 | .I count |
| 315 | blocks starting at block number |
| 316 | .I block |
| 317 | will be marked as not allocated. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 318 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 319 | .BI freefrag " [-c chunk_kb]" |
| 320 | Report free space fragmentation on the currently open file system. |
| 321 | If the |
| 322 | .I \-c |
| 323 | option is specified then the filefrag command will print how many free |
| 324 | chunks of size |
| 325 | .I chunk_kb |
| 326 | can be found in the file system. The chunk size must be a power of two |
| 327 | and be larger than the file system block size. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 328 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 329 | .BI freei " filespec [num]" |
| 330 | Free the inode specified by |
| 331 | .IR filespec . |
| 332 | If |
| 333 | .I num |
| 334 | is specified, also clear num-1 inodes after the specified inode. |
| 335 | .TP |
| 336 | .B help |
| 337 | Print a list of commands understood by |
Theodore Ts'o | 0fd68e0 | 2010-09-24 10:12:54 -0400 | [diff] [blame] | 338 | .BR debugfs . |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 339 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 340 | .BI htree_dump " filespec" |
| 341 | Dump the hash-indexed directory |
| 342 | .IR filespec , |
| 343 | showing its tree structure. |
| 344 | .TP |
| 345 | .BI icheck " block ..." |
Theodore Ts'o | 583ccdc | 1997-05-09 03:06:31 +0000 | [diff] [blame] | 346 | 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] | 347 | on the command line. |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 348 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 349 | .BI imap " filespec" |
| 350 | Print the location of the inode data structure (in the inode table) |
Theodore Ts'o | becf36f | 2003-05-05 11:35:04 -0400 | [diff] [blame] | 351 | of the inode |
| 352 | .IR filespec . |
| 353 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 354 | .BI init_filesys " device blocksize" |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 355 | Create an ext2 file system on |
| 356 | .I device |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 357 | with device size |
| 358 | .IR blocksize . |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 359 | Note that this does not fully initialize all of the data structures; |
| 360 | to do this, use the |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 361 | .BR mke2fs (8) |
| 362 | program. This is just a call to the low-level library, which sets up |
| 363 | the superblock and block descriptors. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 364 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 365 | .BI kill_file " filespec" |
| 366 | Deallocate the inode |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 367 | .I filespec |
| 368 | and its blocks. Note that this does not remove any directory |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 369 | entries (if any) to this inode. See the |
Theodore Ts'o | 583ccdc | 1997-05-09 03:06:31 +0000 | [diff] [blame] | 370 | .BR rm (1) |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 371 | command if you wish to unlink a file. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 372 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 373 | .BI lcd " directory" |
Theodore Ts'o | 6e96adc | 2001-11-24 16:10:52 -0500 | [diff] [blame] | 374 | Change the current working directory of the |
| 375 | .B debugfs |
| 376 | process to |
| 377 | .I directory |
| 378 | on the native filesystem. |
| 379 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 380 | .BI ln " filespec dest_file" |
| 381 | Create a link named |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 382 | .I dest_file |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 383 | which is a hard link to |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 384 | .IR filespec . |
| 385 | Note this does not adjust the inode reference counts. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 386 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 387 | .BI logdump " [-acs] [-b block] [-i filespec] [-f journal_file] [output_file]" |
| 388 | Dump the contents of the ext3 journal. By default, dump the journal inode as |
| 389 | specified in the superblock. However, this can be overridden with the |
Theodore Ts'o | a435ec3 | 2003-08-21 00:40:26 -0400 | [diff] [blame] | 390 | .I \-i |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 391 | option, which dumps the journal from the internal inode given by |
| 392 | .IR filespec . |
| 393 | A regular file containing journal data can be specified using the |
Theodore Ts'o | a435ec3 | 2003-08-21 00:40:26 -0400 | [diff] [blame] | 394 | .I \-f |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 395 | option. Finally, the |
Theodore Ts'o | a435ec3 | 2003-08-21 00:40:26 -0400 | [diff] [blame] | 396 | .I \-s |
| 397 | option utilizes the backup information in the superblock to locate the |
| 398 | journal. |
| 399 | .IP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 400 | The |
Theodore Ts'o | a435ec3 | 2003-08-21 00:40:26 -0400 | [diff] [blame] | 401 | .I \-a |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 402 | option causes the |
| 403 | .B logdump |
Theodore Ts'o | a435ec3 | 2003-08-21 00:40:26 -0400 | [diff] [blame] | 404 | program to print the contents of all of the descriptor blocks. |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 405 | The |
Theodore Ts'o | a435ec3 | 2003-08-21 00:40:26 -0400 | [diff] [blame] | 406 | .I \-b |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 407 | option causes |
| 408 | .B logdump |
| 409 | to print all journal records that are refer to the specified block. |
| 410 | The |
Theodore Ts'o | a435ec3 | 2003-08-21 00:40:26 -0400 | [diff] [blame] | 411 | .I \-c |
| 412 | option will print out the contents of all of the data blocks selected by |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 413 | the |
Theodore Ts'o | a435ec3 | 2003-08-21 00:40:26 -0400 | [diff] [blame] | 414 | .I \-a |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 415 | and |
Theodore Ts'o | a435ec3 | 2003-08-21 00:40:26 -0400 | [diff] [blame] | 416 | .I \-b |
| 417 | options. |
Theodore Ts'o | 6e96adc | 2001-11-24 16:10:52 -0500 | [diff] [blame] | 418 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 419 | .BI ls " [-d] [-l] [-p] filespec" |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 420 | Print a listing of the files in the directory |
| 421 | .IR filespec . |
Andreas Dilger | dba2bbd | 2013-12-15 22:12:43 -0500 | [diff] [blame] | 422 | The |
JP Abgrall | 65f0aab | 2014-03-06 13:50:20 -0800 | [diff] [blame] | 423 | .I \-d |
| 424 | flag will list deleted entries in the directory. |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 425 | The |
| 426 | .I \-l |
| 427 | flag will list files using a more verbose format. |
| 428 | The |
Theodore Ts'o | d056b99 | 2008-01-04 15:28:51 -0500 | [diff] [blame] | 429 | .I \-p |
| 430 | flag will list the files in a format which is more easily parsable by |
| 431 | 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] | 432 | non-printing characters at the end of filenames. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 433 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 434 | .BI list_deleted_inodes " [limit]" |
| 435 | List deleted inodes, optionally limited to those deleted within |
| 436 | .I limit |
| 437 | seconds ago. Also available as |
| 438 | .BR lsdel . |
| 439 | .IP |
| 440 | This command was useful for recovering from accidental file deletions |
| 441 | for ext2 file systems. Unfortunately, it is not useful for this purpose |
| 442 | if the files were deleted using ext3 or ext4, since the inode's |
| 443 | data blocks are no longer available after the inode is released. |
| 444 | .TP |
| 445 | .BI modify_inode " filespec" |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 446 | Modify the contents of the inode structure in the inode |
| 447 | .IR filespec . |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 448 | Also available as |
| 449 | .BR mi . |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 450 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 451 | .BI mkdir " filespec" |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 452 | Make a directory. |
| 453 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 454 | .BI mknod " filespec [p|[[c|b] major minor]]" |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 455 | Create a special device file (a named pipe, character or block device). |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 456 | If a character or block device is to be made, the |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 457 | .I major |
| 458 | and |
| 459 | .I minor |
| 460 | device numbers must be specified. |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 461 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 462 | .BI ncheck " [-c] inode_num ..." |
Theodore Ts'o | 583ccdc | 1997-05-09 03:06:31 +0000 | [diff] [blame] | 463 | Take the requested list of inode numbers, and print a listing of pathnames |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 464 | to those inodes. The |
| 465 | .I -c |
| 466 | flag will enable checking the file type information in the directory |
| 467 | entry to make sure it matches the inode's type. |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 468 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 469 | .BI open " [-weficD] [-b blocksize] [-s superblock] device" |
| 470 | Open a filesystem for editing. The |
| 471 | .I -f |
| 472 | flag forces the filesystem to be opened even if there are some unknown |
| 473 | or incompatible filesystem features which would normally |
Theodore Ts'o | 2e8d40d | 2000-05-27 15:15:40 +0000 | [diff] [blame] | 474 | prevent the filesystem from being opened. The |
Theodore Ts'o | 98eb44b | 2006-03-18 19:58:13 -0500 | [diff] [blame] | 475 | .I -e |
| 476 | flag causes the filesystem to be opened in exclusive mode. The |
Theodore Ts'o | 0fd68e0 | 2010-09-24 10:12:54 -0400 | [diff] [blame] | 477 | .IR -b ", " -c ", " -i ", " -s ", " -w ", and " -D |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 478 | options behave the same as the command-line options to |
Theodore Ts'o | 98eb44b | 2006-03-18 19:58:13 -0500 | [diff] [blame] | 479 | .BR debugfs . |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 480 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 481 | .BI punch " filespec start_blk [end_blk]" |
| 482 | Delete the blocks in the inode ranging from |
| 483 | .I start_blk |
| 484 | to |
| 485 | .IR end_blk . |
| 486 | If |
| 487 | .I end_blk |
| 488 | is omitted then this command will function as a truncate command; that |
| 489 | is, all of the blocks starting at |
| 490 | .I start_blk |
| 491 | through to the end of the file will be deallocated. |
| 492 | .TP |
| 493 | .BI symlink " filespec target" |
| 494 | Make a symbolic link. |
| 495 | .TP |
| 496 | .B pwd |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 497 | Print the current working directory. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 498 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 499 | .B quit |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 500 | Quit |
| 501 | .B debugfs |
| 502 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 503 | .BI rdump " directory destination" |
Theodore Ts'o | 6e96adc | 2001-11-24 16:10:52 -0500 | [diff] [blame] | 504 | Recursively dump |
| 505 | .I directory |
| 506 | and all its contents (including regular files, symbolic links, and other |
| 507 | directories) into the named |
| 508 | .I destination |
| 509 | which should be an existing directory on the native filesystem. |
| 510 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 511 | .BI rm " pathname" |
| 512 | Unlink |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 513 | .IR pathname . |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 514 | If this causes the inode pointed to by |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 515 | .I pathname |
| 516 | to have no other references, deallocate the file. This command functions |
| 517 | as the unlink() system call. |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 518 | .I |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 519 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 520 | .BI rmdir " filespec" |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 521 | Remove the directory |
| 522 | .IR filespec . |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 523 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 524 | .BI setb " block [count]" |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 525 | Mark the block number |
| 526 | .I block |
| 527 | as allocated. |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 528 | If the optional argument |
| 529 | .I count |
| 530 | is present, then |
Theodore Ts'o | e1018ee | 2002-01-03 04:55:25 -0500 | [diff] [blame] | 531 | .I count |
| 532 | blocks starting at block number |
| 533 | .I block |
| 534 | will be marked as allocated. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 535 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 536 | .BI set_block_group " bgnum field value" |
Theodore Ts'o | c7c1209 | 2007-04-13 15:56:00 -0400 | [diff] [blame] | 537 | Modify the block group descriptor specified by |
| 538 | .I bgnum |
| 539 | so that the block group descriptor field |
| 540 | .I field |
| 541 | has value |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 542 | .IR value . |
| 543 | Also available as |
| 544 | .BR set_bg . |
Theodore Ts'o | c7c1209 | 2007-04-13 15:56:00 -0400 | [diff] [blame] | 545 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 546 | .BI seti " filespec [num]" |
| 547 | Mark inode |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 548 | .I filespec |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 549 | as in use in the inode bitmap. If |
| 550 | .I num |
| 551 | is specified, also set num-1 inodes after the specified inode. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 552 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 553 | .BI set_inode_field " filespec field value" |
| 554 | Modify the inode specified by |
Theodore Ts'o | 7dec050 | 2004-12-21 20:37:36 -0500 | [diff] [blame] | 555 | .I filespec |
| 556 | so that the inode field |
| 557 | .I field |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 558 | has value |
Theodore Ts'o | 7dec050 | 2004-12-21 20:37:36 -0500 | [diff] [blame] | 559 | .I value. |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 560 | The list of valid inode fields which can be set via this command |
Theodore Ts'o | 7dec050 | 2004-12-21 20:37:36 -0500 | [diff] [blame] | 561 | can be displayed by using the command: |
Theodore Ts'o | 1d3a951 | 2005-01-07 21:14:12 -0500 | [diff] [blame] | 562 | .B set_inode_field -l |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 563 | Also available as |
| 564 | .BR sif . |
Theodore Ts'o | 7dec050 | 2004-12-21 20:37:36 -0500 | [diff] [blame] | 565 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 566 | .BI set_mmp_value " field value" |
| 567 | Modify the multiple-mount protection (MMP) data so that the MMP field |
| 568 | .I field |
| 569 | has value |
| 570 | .I value. |
| 571 | The list of valid MMP fields which can be set via this command |
| 572 | can be displayed by using the command: |
| 573 | .B set_mmp_value -l |
| 574 | Also available as |
| 575 | .BR smmp . |
| 576 | .TP |
| 577 | .BI set_super_value " field value" |
Theodore Ts'o | 6e96adc | 2001-11-24 16:10:52 -0500 | [diff] [blame] | 578 | Set the superblock field |
| 579 | .I field |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 580 | to |
Theodore Ts'o | 6e96adc | 2001-11-24 16:10:52 -0500 | [diff] [blame] | 581 | .I value. |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 582 | The list of valid superblock fields which can be set via this command |
Theodore Ts'o | 6e96adc | 2001-11-24 16:10:52 -0500 | [diff] [blame] | 583 | can be displayed by using the command: |
| 584 | .B set_super_value -l |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 585 | Also available as |
| 586 | .BR ssv . |
Theodore Ts'o | 6e96adc | 2001-11-24 16:10:52 -0500 | [diff] [blame] | 587 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 588 | .BI show_super_stats " [-h]" |
Theodore Ts'o | d3aea7d | 1999-09-14 20:55:37 +0000 | [diff] [blame] | 589 | List the contents of the super block and the block group descriptors. If the |
| 590 | .I -h |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 591 | flag is given, only print out the superblock contents. Also available as |
| 592 | .BR stats . |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 593 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 594 | .BI stat " filespec" |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 595 | Display the contents of the inode structure of the inode |
| 596 | .IR filespec . |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 597 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 598 | .BI testb " block [count]" |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 599 | Test if the block number |
| 600 | .I block |
| 601 | is marked as allocated in the block bitmap. |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 602 | If the optional argument |
| 603 | .I count |
| 604 | is present, then |
Theodore Ts'o | e1018ee | 2002-01-03 04:55:25 -0500 | [diff] [blame] | 605 | .I count |
| 606 | blocks starting at block number |
| 607 | .I block |
| 608 | will be tested. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 609 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 610 | .BI testi " filespec" |
| 611 | Test if the inode |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 612 | .I filespec |
| 613 | is marked as allocated in the inode bitmap. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 614 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 615 | .BI undel " <inode_number> [pathname]" |
Theodore Ts'o | b026d53 | 2008-01-01 11:37:20 -0500 | [diff] [blame] | 616 | Undelete the specified inode number (which must be surrounded by angle |
| 617 | brackets) so that it and its blocks are marked in use, and optionally |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 618 | link the recovered inode to the specified pathname. The |
Theodore Ts'o | b026d53 | 2008-01-01 11:37:20 -0500 | [diff] [blame] | 619 | .B e2fsck |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 620 | command should always be run after using the |
Theodore Ts'o | b026d53 | 2008-01-01 11:37:20 -0500 | [diff] [blame] | 621 | .B undel |
| 622 | command to recover deleted files. |
| 623 | .IP |
| 624 | Note that if you are recovering a large number of deleted files, linking |
| 625 | the inode to a directory may require the directory to be expanded, which |
| 626 | could allocate a block that had been used by one of the |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 627 | yet-to-be-undeleted files. So it is safer to undelete all of the |
Theodore Ts'o | b026d53 | 2008-01-01 11:37:20 -0500 | [diff] [blame] | 628 | inodes without specifying a destination pathname, and then in a separate |
| 629 | pass, use the debugfs |
| 630 | .B link |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 631 | command to link the inode to the destination pathname, or use |
Theodore Ts'o | b026d53 | 2008-01-01 11:37:20 -0500 | [diff] [blame] | 632 | .B e2fsck |
| 633 | 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] | 634 | lost+found directory. |
Theodore Ts'o | b026d53 | 2008-01-01 11:37:20 -0500 | [diff] [blame] | 635 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 636 | .BI unlink " pathname" |
| 637 | Remove the link specified by |
| 638 | .I pathname |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 639 | 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] | 640 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 641 | .BI write " source_file out_file" |
| 642 | Copy the contents of |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 643 | .I source_file |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 644 | into a newly-created file in the filesystem named |
| 645 | .IR out_file . |
| 646 | .TP |
| 647 | .BI zap_block " [-f filespec] [-o offset] [-l length] [-p pattern] block_num" |
| 648 | .TP |
| 649 | Overwrite the block specified by |
| 650 | .I block_num |
| 651 | with zero (NUL) bytes, or if |
| 652 | .I -p |
| 653 | is given use the byte specified by |
| 654 | .IR pattern . |
| 655 | If |
| 656 | .I -f |
| 657 | is given then |
| 658 | .I block_num |
| 659 | is relative to the start of the file given by |
| 660 | .IR filespec . |
| 661 | The |
| 662 | .I -o |
| 663 | and |
| 664 | .I -l |
| 665 | options limit the range of bytes to zap to the specified |
| 666 | .I offset |
| 667 | and |
| 668 | .I length |
| 669 | relative to the start of the block. |
| 670 | .TP |
| 671 | .BI zap_block " [-f filespec] [-b bit] block_num" |
| 672 | Bit-flip portions of the physical |
| 673 | .IR block_num . |
| 674 | If |
| 675 | .I -f |
| 676 | is given, then |
| 677 | .I block_num |
| 678 | is a logical block relative to the start of |
| 679 | .IR filespec . |
Theodore Ts'o | 2b5ddd7 | 2004-01-24 18:54:41 -0500 | [diff] [blame] | 680 | .SH ENVIRONMENT VARIABLES |
| 681 | .TP |
| 682 | .B DEBUGFS_PAGER, PAGER |
| 683 | The |
Theodore Ts'o | 0fd68e0 | 2010-09-24 10:12:54 -0400 | [diff] [blame] | 684 | .B debugfs |
Theodore Ts'o | 2b5ddd7 | 2004-01-24 18:54:41 -0500 | [diff] [blame] | 685 | program always pipes the output of the some commands through a |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 686 | pager program. These commands include: |
| 687 | .IR show_super_stats " (" stats ), |
| 688 | .IR list_directory " (" ls ), |
| 689 | .IR show_inode_info " (" stat ), |
| 690 | .IR list_deleted_inodes " (" lsdel ), |
Theodore Ts'o | 2b5ddd7 | 2004-01-24 18:54:41 -0500 | [diff] [blame] | 691 | and |
| 692 | .IR htree_dump . |
| 693 | The specific pager can explicitly specified by the |
| 694 | .B DEBUGFS_PAGER |
| 695 | environment variable, and if it is not set, by the |
| 696 | .B PAGER |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 697 | environment variable. |
Theodore Ts'o | 2b5ddd7 | 2004-01-24 18:54:41 -0500 | [diff] [blame] | 698 | .IP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 699 | Note that since a pager is always used, the |
Theodore Ts'o | 2b5ddd7 | 2004-01-24 18:54:41 -0500 | [diff] [blame] | 700 | .BR less (1) |
| 701 | pager is not particularly appropriate, since it clears the screen before |
| 702 | displaying the output of the command and clears the output the screen |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 703 | when the pager is exited. Many users prefer to use the |
Theodore Ts'o | 2b5ddd7 | 2004-01-24 18:54:41 -0500 | [diff] [blame] | 704 | .BR less (1) |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 705 | pager for most purposes, which is why the |
| 706 | .B DEBUGFS_PAGER |
Theodore Ts'o | 2b5ddd7 | 2004-01-24 18:54:41 -0500 | [diff] [blame] | 707 | environment variable is available to override the more general |
| 708 | .B PAGER |
| 709 | environment variable. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 710 | .SH AUTHOR |
| 711 | .B debugfs |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 712 | was written by Theodore Ts'o <tytso@mit.edu>. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 713 | .SH SEE ALSO |
| 714 | .BR dumpe2fs (8), |
Andreas Mohr | 0fd2f90 | 2008-02-28 20:50:05 -0500 | [diff] [blame] | 715 | .BR tune2fs (8), |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 716 | .BR e2fsck (8), |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 717 | .BR mke2fs (8), |
| 718 | .BR ext4 (5) |