Whamcloud - gitweb
Many files:
[tools/e2fsprogs.git] / debugfs / debugfs.8.in
1 .\" -*- nroff -*-
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 .\" 
5 .TH DEBUGFS 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
6 .SH NAME
7 debugfs \- ext2 file system debugger
8 .SH SYNOPSIS
9 .B debugfs
10 [
11 .B \-w
12 ]
13 [
14 .B \-f 
15 cmd_file
16 ]
17 [
18 .B \-R
19 request
20 ]
21 [
22 device
23 ]
24 .SH DESCRIPTION
25 The 
26 .B debugfs 
27 program
28 is a file system debugger. It can be used to examine and change the
29 state of an ext2 file system.
30 .br
31 .I device
32 is the special file corresponding to the device containing the ext2
33 file system (e.g /dev/hdXX).
34 .SH OPTIONS
35 .TP
36 .I -w
37 Specify that the file system should be open in read-write mode. Without this
38 option, the file system is open in read-only mode.
39 .TP
40 .I -f cmd_file
41 Causes 
42 .B debugfs
43 to read in commands from 
44 .IR cmd_file , 
45 and execute them.  When 
46 .B debugfs
47 is finsihed executing those commands, it will exit.
48 .TP 
49 .I -R request
50 Causes 
51 .B debugfs
52 to execute the single command 
53 .IR request ,
54 and then exit.
55 .SH COMMANDS
56 .B debugfs
57 is an interactive debugger. It understands a number of commands.
58 .TP
59 .I cat filespec
60 Dump the contents of the inode 
61 .I filespec
62 to stdout.
63 .TP
64 .I cd filespec
65 Change the current working directory to 
66 .IR filespec .
67 .TP
68 .I chroot filespec
69 Change the root directory to be the directory 
70 .IR filespec .
71 .TP
72 .I close
73 Close the currently open file system.
74 .TP
75 .I clri file
76 Clear the contents of the inode 
77 .IR file .
78 .TP
79 .I dump [-p] filspec out_file
80 Dump the contents of the inode 
81 .I filespec
82 to the output file 
83 .IR out_file .  
84 If the 
85 .I -p 
86 option is given set the owner, group and permissions information on 
87 .I out_file 
88 to match 
89 .IR filespec .
90 .TP
91 .I expand_dir filespec
92 Expand the directory
93 .IR filespec .
94 .TP
95 .I find_free_block [goal]
96 Find the first free block, starting from
97 .I goal
98 and allocates it.
99 .TP
100 .I find_free_inode [dir [mode]]
101 Find a free inode and allocates it.  If present, 
102 .I dir
103 specifies the inode number of the directory 
104 which the inode is to be located.  The second 
105 optional argument
106 .I mode
107 specifies the permissions of the new inode.  (If the directory bit is set
108 on the mode, the allocation routine will function differently.)
109 .TP
110 .I freeb block
111 Mark the block number
112 .I block
113 as not allocated.
114 .TP
115 .I freei filespec
116 Free the inode specified by 
117 .I filespec
118 .TP
119 .I help
120 Print a list of commands understood by 
121 .BR debugfs (8).
122 .TP
123 .I icheck block ...
124 Print a listing of the inodes which use the one or more block specified
125 on the command line.
126 .TP
127 .I initialize device blocksize
128 Create an ext2 file system on
129 .I device
130 with device size
131 .IR blocksize .
132 Note that this does not fully initialize all of the data structures; 
133 to do this, use the 
134 .BR mke2fs (8)
135 program.  This is just a call to the low-level library, which sets up
136 the superblock and block descriptors.
137 .TP
138 .I kill_file filespec
139 Dellocate the inode 
140 .I filespec
141 and its blocks.  Note that this does not remove any directory
142 entries (if any) to this inode.  See the 
143 .I rm
144 command if you wish to unlink a file.
145 .TP
146 .I ln filespec dest_file
147 Create a link named 
148 .I dest_file
149 which is a link to 
150 .IR filespec .
151 Note this does not adjust the inode reference counts.
152 .TP
153 .I ls filespec
154 Print a listing of the files in the directory
155 .IR filespec .
156 .TP
157 .I modify_inode filespec
158 Modify the contents of the inode structure in the inode
159 .IR filespec .
160 .TP
161 .I mkdir filespec
162 Make a directory.
163 .TP
164 .I mknod filespec [p|[[c|b] major minor]]
165 Create a special device file (a named pipe, character or block device).
166 If a character or block device is to be made, the 
167 .I major
168 and
169 .I minor
170 device numbers must be specified.
171 .TP
172 .I ncheck inode_num ...
173 Take the requested list of inode numbers, and print a listing of pathnams
174 to those inodes.
175 .TP
176 .I open [-w] device
177 Open a file system for editing.  
178 .TP
179 .I pwd
180 Print the current working directory.
181 .TP
182 .I quit
183 Quit
184 .B debugfs
185 .TP
186 .I rm pathname
187 Unlink 
188 .IR pathname .
189 If this cuases the inode pointed to by 
190 .I pathname
191 to have no other references, deallocate the file.  This command functions
192 as the unlink() system call.
193 .I 
194 .TP
195 .I rmdir filespec
196 Remove the directory
197 .IR filespec .
198 This function is currently not implemented.
199 .TP
200 .I setb block
201 Mark the block number
202 .I block
203 as allocated.
204 .TP
205 .I seti filespec
206 Mark inode 
207 .I filespec
208 as in use in the inode bitmap.
209 .TP
210 .I show_super_stats
211 List the contents of the super block.
212 .TP
213 .I stat filespec
214 Display the contents of the inode structure of the inode
215 .IR filespec .
216 .TP
217 .I testb block
218 Test if the block number
219 .I block
220 is marked as allocated in the block bitmap.
221 .TP
222 .I testi filespec
223 Test if the inode 
224 .I filespec
225 is marked as allocated in the inode bitmap.
226 .TP
227 .I unlink pathname
228 Remove the link specified by 
229 .I pathname 
230 to an inode.  Note this does not adjust the inode reference counts.
231 .TP
232 .I write source_file out_file
233 Create a file in the filesystem named
234 .IR out_file ,
235 and copy the contents of
236 .I source_file
237 into the destination file.
238 .SH SPECIFYING FILES
239 Many
240 .B debugfs
241 commands take a
242 .I filespec
243 as an argument to specify an inode (as opposed to a pathname) 
244 in the filesystem which is currently opened by debugfs. The
245 .I filespec
246 argument may be specified in two forms.  The first form is an inode 
247 number surrounded by angle brackets, e.g., 
248 .IR <2> .
249 The second form is a pathname; if the pathname is prefixed by a forward slash
250 ('/'), then it is interpreted relative to the root of the filesystem 
251 which is currently opened by debugfs.  If not, the pathname is 
252 interpreted relative to the current working directory as maintained 
253 by debugfs.  This may be modified by using the debugfs command
254 .IR cd .
255 .SH AUTHOR
256 .B debugfs
257 was written by Theodore Ts'o <tytso@mit.edu>.
258 .SH SEE ALSO
259 .BR dumpe2fs (8),
260 .BR e2fsck (8),
261 .BR mke2fs (8)