]>
Commit | Line | Data |
---|---|---|
3839e657 | 1 | .\" -*- nroff -*- |
50e1e10f TT |
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. | |
dba2bbdf | 4 | .\" |
74becf3c | 5 | .TH DEBUGFS 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@" |
3839e657 | 6 | .SH NAME |
4f858546 | 7 | debugfs \- ext2/ext3/ext4 file system debugger |
3839e657 TT |
8 | .SH SYNOPSIS |
9 | .B debugfs | |
10 | [ | |
0fd68e02 | 11 | .B \-DVwci |
1ad54a94 TT |
12 | ] |
13 | [ | |
2e8d40d5 TT |
14 | .B \-b |
15 | blocksize | |
16 | ] | |
17 | [ | |
18 | .B \-s | |
19 | superblock | |
20 | ] | |
21 | [ | |
dba2bbdf | 22 | .B \-f |
fc6d9d51 TT |
23 | cmd_file |
24 | ] | |
25 | [ | |
26 | .B \-R | |
27 | request | |
28 | ] | |
29 | [ | |
1ad54a94 TT |
30 | .B \-d |
31 | data_source_device | |
59cf7e0d TT |
32 | ] |
33 | [ | |
3839e657 TT |
34 | device |
35 | ] | |
36 | .SH DESCRIPTION | |
dba2bbdf AD |
37 | The |
38 | .B debugfs | |
6e96adcb | 39 | program is an interactive file system debugger. It can be used to |
4f858546 | 40 | examine and change the state of an ext2, ext3, or ext4 file system. |
3839e657 TT |
41 | .br |
42 | .I device | |
4f858546 | 43 | is the special file corresponding to the device containing the |
3839e657 TT |
44 | file system (e.g /dev/hdXX). |
45 | .SH OPTIONS | |
46 | .TP | |
59cf7e0d | 47 | .I \-w |
583ccdc3 TT |
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. | |
fc6d9d51 | 50 | .TP |
59cf7e0d | 51 | .I \-c |
2e8d40d5 TT |
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 | |
59cf7e0d | 57 | .I \-i |
dba2bbdf | 58 | Specifies that |
59cf7e0d TT |
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 | |
dba2bbdf | 63 | group descriptor, block and inode allocation bitmaps, and |
59cf7e0d TT |
64 | the inode table, many |
65 | .B debugfs | |
dba2bbdf | 66 | commands will not function properly. |
59cf7e0d | 67 | .B Warning: |
dba2bbdf AD |
68 | no safety checks are in place, and |
69 | .B debugfs | |
59cf7e0d | 70 | may fail in interesting ways if commands such as |
dba2bbdf AD |
71 | .IR ls ", " dump ", " |
72 | etc. are tried without specifying the | |
1ad54a94 | 73 | .I data_source_device |
dba2bbdf | 74 | using the |
1ad54a94 TT |
75 | .I \-d |
76 | option. | |
dba2bbdf | 77 | .B debugfs |
59cf7e0d TT |
78 | is a debugging tool. It has rough edges! |
79 | .TP | |
1ad54a94 | 80 | .I -d data_source_device |
dba2bbdf | 81 | Used with the |
1ad54a94 TT |
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 | |
2e8d40d5 TT |
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 | |
054cd1f6 TT |
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 | |
2e8d40d5 | 96 | .I -s |
054cd1f6 | 97 | option, you must also provide the blocksize of the filesystem via the |
2e8d40d5 TT |
98 | .I -b |
99 | option. | |
100 | .TP | |
fc6d9d51 | 101 | .I -f cmd_file |
dba2bbdf | 102 | Causes |
fc6d9d51 | 103 | .B debugfs |
dba2bbdf AD |
104 | to read in commands from |
105 | .IR cmd_file , | |
106 | and execute them. When | |
fc6d9d51 | 107 | .B debugfs |
583ccdc3 | 108 | is finished executing those commands, it will exit. |
0fd68e02 TT |
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 | |
fc6d9d51 | 117 | .I -R request |
dba2bbdf | 118 | Causes |
fc6d9d51 | 119 | .B debugfs |
dba2bbdf | 120 | to execute the single command |
fc6d9d51 TT |
121 | .IR request , |
122 | and then exit. | |
818180cd TT |
123 | .TP |
124 | .I -V | |
dba2bbdf | 125 | print the version number of |
818180cd TT |
126 | .B debugfs |
127 | and exit. | |
6e96adcb TT |
128 | .SH SPECIFYING FILES |
129 | Many | |
130 | .B debugfs | |
131 | commands take a | |
132 | .I filespec | |
dba2bbdf AD |
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 . | |
6e96adcb TT |
136 | The |
137 | .I filespec | |
dba2bbdf AD |
138 | argument may be specified in two forms. The first form is an inode |
139 | number surrounded by angle brackets, e.g., | |
6e96adcb TT |
140 | .IR <2> . |
141 | The second form is a pathname; if the pathname is prefixed by a forward slash | |
dba2bbdf AD |
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 | |
6e96adcb | 147 | .BR debugfs . |
dba2bbdf | 148 | This may be modified by using the |
6e96adcb TT |
149 | .B debugfs |
150 | command | |
151 | .IR cd . | |
dba2bbdf | 152 | .\" |
6e96adcb TT |
153 | .\" |
154 | .\" | |
3839e657 | 155 | .SH COMMANDS |
dba2bbdf | 156 | This is a list of the commands which |
3839e657 | 157 | .B debugfs |
6e96adcb | 158 | supports. |
3839e657 | 159 | .TP |
dba2bbdf | 160 | .BI blocks " filespace" |
af0df2aa TT |
161 | Print the blocks used by the inode |
162 | .I filespec | |
163 | to stdout. | |
164 | .TP | |
dba2bbdf | 165 | .BI bmap " filespec logical_block" |
becf36f6 TT |
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 | |
dba2bbdf AD |
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 . | |
85a24385 | 178 | .TP |
dba2bbdf AD |
179 | .BI cat " filespec" |
180 | Dump the contents of the inode | |
fc6d9d51 TT |
181 | .I filespec |
182 | to stdout. | |
3839e657 | 183 | .TP |
dba2bbdf AD |
184 | .BI cd " filespec" |
185 | Change the current working directory to | |
fc6d9d51 | 186 | .IR filespec . |
50e1e10f | 187 | .TP |
dba2bbdf AD |
188 | .BI chroot " filespec" |
189 | Change the root directory to be the directory | |
fc6d9d51 | 190 | .IR filespec . |
3839e657 | 191 | .TP |
dba2bbdf AD |
192 | .BI close " [-a]" |
193 | Close the currently open file system. If the | |
6dce5328 TT |
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. | |
3839e657 | 198 | .TP |
dba2bbdf AD |
199 | .BI clri " filespec" |
200 | Clear the contents of the inode | |
201 | .IR filespec . | |
fc6d9d51 | 202 | .TP |
dba2bbdf | 203 | .BI dirsearch " filespec filename" |
f5ae5b3a ES |
204 | Search the directory |
205 | .I filespec | |
206 | for | |
207 | .IR filename . | |
208 | .TP | |
dba2bbdf AD |
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 | |
fc6d9d51 | 214 | .I filespec |
dba2bbdf AD |
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 | |
fc6d9d51 TT |
222 | .IR filespec . |
223 | .TP | |
dba2bbdf | 224 | .B dump_mmp |
3859977a ES |
225 | Display the multiple-mount protection (mmp) field values. |
226 | .TP | |
dba2bbdf | 227 | .BI dx_hash " [-h hash_alg] [-s hash_seed] filename" |
f5ae5b3a ES |
228 | Calculate the directory hash of |
229 | .IR filename . | |
230 | The hash algorithm specified with | |
231 | .I -h | |
dba2bbdf AD |
232 | may be |
233 | .BR legacy , " half_md4" ", or " tea . | |
f5ae5b3a ES |
234 | The hash seed specified with |
235 | .I -s | |
236 | must be in UUID format. | |
237 | .TP | |
dba2bbdf | 238 | .BI dump_extents " [-n] [-l] filespec" |
187cb623 TT |
239 | Dump the the extent tree of the inode |
240 | .IR filespec . | |
dba2bbdf | 241 | The |
187cb623 TT |
242 | .I -n |
243 | flag will cause | |
dba2bbdf | 244 | .B dump_extents |
187cb623 | 245 | to only display the interior nodes in the extent tree. The |
dba2bbdf AD |
246 | .I -l |
247 | flag will cause | |
248 | .B dump_extents | |
187cb623 TT |
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 | |
d4a93302 | 253 | not stored in filesystem data structures. Hence, the values displayed |
dba2bbdf | 254 | may not necessarily by accurate and does not indicate a problem or |
187cb623 TT |
255 | corruption in the file system.) |
256 | .TP | |
dba2bbdf | 257 | .BI expand_dir " filespec" |
fc6d9d51 TT |
258 | Expand the directory |
259 | .IR filespec . | |
3839e657 | 260 | .TP |
dba2bbdf | 261 | .BI feature " [fs_feature] [-fs_feature] ..." |
d3aea7dc TT |
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 | |
dba2bbdf | 266 | .BI filefrag " [-dvr] filespec" |
c4ab66c5 TT |
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 | |
dba2bbdf AD |
287 | .BI find_free_block " [count [goal]]" |
288 | Find the first | |
e1018eea TT |
289 | .I count |
290 | free blocks, starting from | |
3839e657 | 291 | .I goal |
dba2bbdf AD |
292 | and allocate it. Also available as |
293 | .BR ffb . | |
3839e657 | 294 | .TP |
dba2bbdf AD |
295 | .BI find_free_inode " [dir [mode]]" |
296 | Find a free inode and allocate it. If present, | |
fc6d9d51 | 297 | .I dir |
dba2bbdf AD |
298 | specifies the inode number of the directory |
299 | which the inode is to be located. The second | |
fc6d9d51 TT |
300 | optional argument |
301 | .I mode | |
302 | specifies the permissions of the new inode. (If the directory bit is set | |
dba2bbdf AD |
303 | on the mode, the allocation routine will function differently.) Also |
304 | available as | |
305 | .BR ffi . | |
fc6d9d51 | 306 | .TP |
dba2bbdf | 307 | .BI freeb " block [count]" |
fc6d9d51 TT |
308 | Mark the block number |
309 | .I block | |
310 | as not allocated. | |
dba2bbdf AD |
311 | If the optional argument |
312 | .I count | |
313 | is present, then | |
e1018eea TT |
314 | .I count |
315 | blocks starting at block number | |
316 | .I block | |
317 | will be marked as not allocated. | |
fc6d9d51 | 318 | .TP |
dba2bbdf | 319 | .BI freefrag " [-c chunk_kb]" |
5e96c572 TT |
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. | |
328 | .TP | |
dba2bbdf AD |
329 | .BI freei " filespec [num]" |
330 | Free the inode specified by | |
583ccdc3 | 331 | .IR filespec . |
2ae5d1fd TT |
332 | If |
333 | .I num | |
334 | is specified, also clear num-1 inodes after the specified inode. | |
3839e657 | 335 | .TP |
dba2bbdf AD |
336 | .B help |
337 | Print a list of commands understood by | |
0fd68e02 | 338 | .BR debugfs . |
50e1e10f | 339 | .TP |
dba2bbdf | 340 | .BI htree_dump " filespec" |
f5ae5b3a ES |
341 | Dump the hash-indexed directory |
342 | .IR filespec , | |
343 | showing its tree structure. | |
344 | .TP | |
dba2bbdf | 345 | .BI icheck " block ..." |
583ccdc3 | 346 | Print a listing of the inodes which use the one or more blocks specified |
fc6d9d51 | 347 | on the command line. |
3839e657 | 348 | .TP |
dba2bbdf AD |
349 | .BI imap " filespec" |
350 | Print the location of the inode data structure (in the inode table) | |
becf36f6 TT |
351 | of the inode |
352 | .IR filespec . | |
353 | .TP | |
dba2bbdf | 354 | .BI init_filesys " device blocksize" |
3839e657 TT |
355 | Create an ext2 file system on |
356 | .I device | |
fc6d9d51 TT |
357 | with device size |
358 | .IR blocksize . | |
dba2bbdf AD |
359 | Note that this does not fully initialize all of the data structures; |
360 | to do this, use the | |
fc6d9d51 TT |
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. | |
364 | .TP | |
dba2bbdf AD |
365 | .BI kill_file " filespec" |
366 | Deallocate the inode | |
fc6d9d51 TT |
367 | .I filespec |
368 | and its blocks. Note that this does not remove any directory | |
dba2bbdf | 369 | entries (if any) to this inode. See the |
583ccdc3 | 370 | .BR rm (1) |
fc6d9d51 TT |
371 | command if you wish to unlink a file. |
372 | .TP | |
dba2bbdf | 373 | .BI lcd " directory" |
6e96adcb TT |
374 | Change the current working directory of the |
375 | .B debugfs | |
376 | process to | |
377 | .I directory | |
378 | on the native filesystem. | |
379 | .TP | |
dba2bbdf AD |
380 | .BI ln " filespec dest_file" |
381 | Create a link named | |
fc6d9d51 | 382 | .I dest_file |
dba2bbdf | 383 | which is a hard link to |
fc6d9d51 TT |
384 | .IR filespec . |
385 | Note this does not adjust the inode reference counts. | |
386 | .TP | |
dba2bbdf AD |
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 | |
a435ec34 | 390 | .I \-i |
dba2bbdf AD |
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 | |
a435ec34 | 394 | .I \-f |
dba2bbdf | 395 | option. Finally, the |
a435ec34 TT |
396 | .I \-s |
397 | option utilizes the backup information in the superblock to locate the | |
398 | journal. | |
399 | .IP | |
dba2bbdf | 400 | The |
a435ec34 | 401 | .I \-a |
dba2bbdf AD |
402 | option causes the |
403 | .B logdump | |
a435ec34 | 404 | program to print the contents of all of the descriptor blocks. |
dba2bbdf | 405 | The |
a435ec34 | 406 | .I \-b |
dba2bbdf AD |
407 | option causes |
408 | .B logdump | |
409 | to print all journal records that are refer to the specified block. | |
410 | The | |
a435ec34 TT |
411 | .I \-c |
412 | option will print out the contents of all of the data blocks selected by | |
dba2bbdf | 413 | the |
a435ec34 | 414 | .I \-a |
dba2bbdf | 415 | and |
a435ec34 TT |
416 | .I \-b |
417 | options. | |
6e96adcb | 418 | .TP |
dba2bbdf | 419 | .BI ls " [-d] [-l] [-p] filespec" |
fc6d9d51 TT |
420 | Print a listing of the files in the directory |
421 | .IR filespec . | |
e1018eea TT |
422 | The |
423 | .I \-d | |
424 | flag will list deleted entries in the directory. | |
dba2bbdf AD |
425 | The |
426 | .I \-l | |
427 | flag will list files using a more verbose format. | |
428 | The | |
d056b991 TT |
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 | |
711d3846 | 432 | non-printing characters at the end of filenames. |
fc6d9d51 | 433 | .TP |
dba2bbdf | 434 | .BI modify_inode " filespec" |
fc6d9d51 TT |
435 | Modify the contents of the inode structure in the inode |
436 | .IR filespec . | |
dba2bbdf AD |
437 | Also available as |
438 | .BR mi . | |
fc6d9d51 | 439 | .TP |
dba2bbdf | 440 | .BI mkdir " filespec" |
3839e657 TT |
441 | Make a directory. |
442 | .TP | |
dba2bbdf | 443 | .BI mknod " filespec [p|[[c|b] major minor]]" |
fc6d9d51 | 444 | Create a special device file (a named pipe, character or block device). |
dba2bbdf | 445 | If a character or block device is to be made, the |
fc6d9d51 TT |
446 | .I major |
447 | and | |
448 | .I minor | |
449 | device numbers must be specified. | |
50e1e10f | 450 | .TP |
dba2bbdf | 451 | .BI ncheck " [-c] inode_num ..." |
583ccdc3 | 452 | Take the requested list of inode numbers, and print a listing of pathnames |
8bf1e918 TT |
453 | to those inodes. The |
454 | .I -c | |
455 | flag will enable checking the file type information in the directory | |
456 | entry to make sure it matches the inode's type. | |
50e1e10f | 457 | .TP |
dba2bbdf AD |
458 | .BI open " [-weficD] [-b blocksize] [-s superblock] device" |
459 | Open a filesystem for editing. The | |
460 | .I -f | |
461 | flag forces the filesystem to be opened even if there are some unknown | |
462 | or incompatible filesystem features which would normally | |
2e8d40d5 | 463 | prevent the filesystem from being opened. The |
98eb44bd TT |
464 | .I -e |
465 | flag causes the filesystem to be opened in exclusive mode. The | |
0fd68e02 | 466 | .IR -b ", " -c ", " -i ", " -s ", " -w ", and " -D |
dba2bbdf | 467 | options behave the same as the command-line options to |
98eb44bd | 468 | .BR debugfs . |
3839e657 | 469 | .TP |
dba2bbdf | 470 | .BI punch " filespec start_blk [end_blk]" |
86685923 TT |
471 | Delete the blocks in the inode ranging from |
472 | .I start_blk | |
473 | to | |
474 | .IR end_blk . | |
475 | If | |
476 | .I end_blk | |
477 | is omitted then this command will function as a truncate command; that | |
478 | is, all of the blocks starting at | |
479 | .I start_blk | |
480 | through to the end of the file will be deallocated. | |
481 | .TP | |
4df6a37b DH |
482 | .I symlink filespec target |
483 | Make a symbolic link. | |
484 | .TP | |
dba2bbdf | 485 | .B pwd |
50e1e10f | 486 | Print the current working directory. |
3839e657 | 487 | .TP |
dba2bbdf | 488 | .B quit |
3839e657 TT |
489 | Quit |
490 | .B debugfs | |
491 | .TP | |
dba2bbdf | 492 | .BI rdump " directory destination" |
6e96adcb TT |
493 | Recursively dump |
494 | .I directory | |
495 | and all its contents (including regular files, symbolic links, and other | |
496 | directories) into the named | |
497 | .I destination | |
498 | which should be an existing directory on the native filesystem. | |
499 | .TP | |
dba2bbdf AD |
500 | .BI rm " pathname" |
501 | Unlink | |
fc6d9d51 | 502 | .IR pathname . |
dba2bbdf | 503 | If this causes the inode pointed to by |
fc6d9d51 TT |
504 | .I pathname |
505 | to have no other references, deallocate the file. This command functions | |
506 | as the unlink() system call. | |
dba2bbdf | 507 | .I |
fc6d9d51 | 508 | .TP |
dba2bbdf | 509 | .BI rmdir " filespec" |
fc6d9d51 TT |
510 | Remove the directory |
511 | .IR filespec . | |
fc6d9d51 | 512 | .TP |
dba2bbdf | 513 | .BI setb " block [count]" |
fc6d9d51 TT |
514 | Mark the block number |
515 | .I block | |
516 | as allocated. | |
dba2bbdf AD |
517 | If the optional argument |
518 | .I count | |
519 | is present, then | |
e1018eea TT |
520 | .I count |
521 | blocks starting at block number | |
522 | .I block | |
523 | will be marked as allocated. | |
fc6d9d51 | 524 | .TP |
dba2bbdf | 525 | .BI set_block_group " bgnum field value" |
c7c1209e TT |
526 | Modify the block group descriptor specified by |
527 | .I bgnum | |
528 | so that the block group descriptor field | |
529 | .I field | |
530 | has value | |
dba2bbdf AD |
531 | .IR value . |
532 | Also available as | |
533 | .BR set_bg . | |
c7c1209e | 534 | .TP |
dba2bbdf AD |
535 | .BI seti " filespec [num]" |
536 | Mark inode | |
fc6d9d51 | 537 | .I filespec |
2ae5d1fd TT |
538 | as in use in the inode bitmap. If |
539 | .I num | |
540 | is specified, also set num-1 inodes after the specified inode. | |
3839e657 | 541 | .TP |
dba2bbdf AD |
542 | .BI set_inode_field " filespec field value" |
543 | Modify the inode specified by | |
7dec050a TT |
544 | .I filespec |
545 | so that the inode field | |
546 | .I field | |
dba2bbdf | 547 | has value |
7dec050a | 548 | .I value. |
dba2bbdf | 549 | The list of valid inode fields which can be set via this command |
7dec050a | 550 | can be displayed by using the command: |
1d3a9511 | 551 | .B set_inode_field -l |
dba2bbdf AD |
552 | Also available as |
553 | .BR sif . | |
7dec050a | 554 | .TP |
dba2bbdf AD |
555 | .BI set_mmp_value " field value" |
556 | Modify the multiple-mount protection (MMP) data so that the MMP field | |
3859977a ES |
557 | .I field |
558 | has value | |
559 | .I value. | |
dba2bbdf | 560 | The list of valid MMP fields which can be set via this command |
3859977a ES |
561 | can be displayed by using the command: |
562 | .B set_mmp_value -l | |
dba2bbdf AD |
563 | Also available as |
564 | .BR smmp . | |
3859977a | 565 | .TP |
dba2bbdf | 566 | .BI set_super_value " field value" |
6e96adcb TT |
567 | Set the superblock field |
568 | .I field | |
dba2bbdf | 569 | to |
6e96adcb | 570 | .I value. |
dba2bbdf | 571 | The list of valid superblock fields which can be set via this command |
6e96adcb TT |
572 | can be displayed by using the command: |
573 | .B set_super_value -l | |
dba2bbdf AD |
574 | Also available as |
575 | .BR ssv . | |
6e96adcb | 576 | .TP |
dba2bbdf | 577 | .BI show_super_stats " [-h]" |
d3aea7dc TT |
578 | List the contents of the super block and the block group descriptors. If the |
579 | .I -h | |
dba2bbdf AD |
580 | flag is given, only print out the superblock contents. Also available as |
581 | .BR stats . | |
3839e657 | 582 | .TP |
dba2bbdf | 583 | .BI stat " filespec" |
fc6d9d51 TT |
584 | Display the contents of the inode structure of the inode |
585 | .IR filespec . | |
3839e657 | 586 | .TP |
dba2bbdf | 587 | .BI testb " block [count]" |
fc6d9d51 TT |
588 | Test if the block number |
589 | .I block | |
590 | is marked as allocated in the block bitmap. | |
dba2bbdf AD |
591 | If the optional argument |
592 | .I count | |
593 | is present, then | |
e1018eea TT |
594 | .I count |
595 | blocks starting at block number | |
596 | .I block | |
597 | will be tested. | |
3839e657 | 598 | .TP |
dba2bbdf AD |
599 | .BI testi " filespec" |
600 | Test if the inode | |
fc6d9d51 TT |
601 | .I filespec |
602 | is marked as allocated in the inode bitmap. | |
3839e657 | 603 | .TP |
dba2bbdf | 604 | .BI undel " <inode_number> [pathname]" |
b026d539 TT |
605 | Undelete the specified inode number (which must be surrounded by angle |
606 | brackets) so that it and its blocks are marked in use, and optionally | |
dba2bbdf | 607 | link the recovered inode to the specified pathname. The |
b026d539 | 608 | .B e2fsck |
dba2bbdf | 609 | command should always be run after using the |
b026d539 TT |
610 | .B undel |
611 | command to recover deleted files. | |
612 | .IP | |
613 | Note that if you are recovering a large number of deleted files, linking | |
614 | the inode to a directory may require the directory to be expanded, which | |
615 | could allocate a block that had been used by one of the | |
dba2bbdf | 616 | yet-to-be-undeleted files. So it is safer to undelete all of the |
b026d539 TT |
617 | inodes without specifying a destination pathname, and then in a separate |
618 | pass, use the debugfs | |
619 | .B link | |
dba2bbdf | 620 | command to link the inode to the destination pathname, or use |
b026d539 TT |
621 | .B e2fsck |
622 | to check the filesystem and link all of the recovered inodes to the | |
711d3846 | 623 | lost+found directory. |
b026d539 | 624 | .TP |
dba2bbdf AD |
625 | .BI unlink " pathname" |
626 | Remove the link specified by | |
627 | .I pathname | |
fc6d9d51 | 628 | to an inode. Note this does not adjust the inode reference counts. |
50e1e10f | 629 | .TP |
dba2bbdf AD |
630 | .BI write " source_file out_file" |
631 | Copy the contents of | |
50e1e10f | 632 | .I source_file |
dba2bbdf AD |
633 | into a newly-created file in the filesystem named |
634 | .IR out_file . | |
85a24385 | 635 | .TP |
dba2bbdf | 636 | .BI zap_block " [-f filespec] [-o offset] [-l length] [-p pattern] block_num" |
85a24385 | 637 | .TP |
dba2bbdf AD |
638 | Overwrite the block specified by |
639 | .I block_num | |
640 | with zero (NUL) bytes, or if | |
641 | .I -p | |
642 | is given use the byte specified by | |
643 | .IR pattern . | |
644 | If | |
645 | .I -f | |
646 | is given then | |
647 | .I block_num | |
648 | is relative to the start of the file given by | |
649 | .IR filespec . | |
650 | The | |
651 | .I -o | |
652 | and | |
653 | .I -l | |
654 | options limit the range of bytes to zap to the specified | |
655 | .I offset | |
656 | and | |
657 | .I length | |
658 | relative to the start of the block. | |
659 | .TP | |
660 | .BI zap_block " [-f filespec] [-b bit] block_num" | |
661 | Bit-flip portions of the physical | |
662 | .IR block_num . | |
663 | If | |
664 | .I -f | |
665 | is given, then | |
666 | .I block_num | |
667 | is a logical block relative to the start of | |
668 | .IR filespec . | |
2b5ddd75 TT |
669 | .SH ENVIRONMENT VARIABLES |
670 | .TP | |
671 | .B DEBUGFS_PAGER, PAGER | |
672 | The | |
0fd68e02 | 673 | .B debugfs |
2b5ddd75 | 674 | program always pipes the output of the some commands through a |
dba2bbdf AD |
675 | pager program. These commands include: |
676 | .IR show_super_stats " (" stats ), | |
677 | .IR list_directory " (" ls ), | |
678 | .IR show_inode_info " (" stat ), | |
679 | .IR list_deleted_inodes " (" lsdel ), | |
2b5ddd75 TT |
680 | and |
681 | .IR htree_dump . | |
682 | The specific pager can explicitly specified by the | |
683 | .B DEBUGFS_PAGER | |
684 | environment variable, and if it is not set, by the | |
685 | .B PAGER | |
dba2bbdf | 686 | environment variable. |
2b5ddd75 | 687 | .IP |
dba2bbdf | 688 | Note that since a pager is always used, the |
2b5ddd75 TT |
689 | .BR less (1) |
690 | pager is not particularly appropriate, since it clears the screen before | |
691 | displaying the output of the command and clears the output the screen | |
dba2bbdf | 692 | when the pager is exited. Many users prefer to use the |
2b5ddd75 | 693 | .BR less (1) |
dba2bbdf AD |
694 | pager for most purposes, which is why the |
695 | .B DEBUGFS_PAGER | |
2b5ddd75 TT |
696 | environment variable is available to override the more general |
697 | .B PAGER | |
698 | environment variable. | |
3839e657 TT |
699 | .SH AUTHOR |
700 | .B debugfs | |
50e1e10f | 701 | was written by Theodore Ts'o <tytso@mit.edu>. |
3839e657 TT |
702 | .SH SEE ALSO |
703 | .BR dumpe2fs (8), | |
0fd2f900 | 704 | .BR tune2fs (8), |
3839e657 | 705 | .BR e2fsck (8), |
3c22bf7e TT |
706 | .BR mke2fs (8), |
707 | .BR ext4 (5) |