1 | .so mnx.mac
|
---|
2 | .TH DE 9
|
---|
3 | .CD "de \(en disk editor"
|
---|
4 | .SX "de\fR [\fB\(enw\fR] \fIblock_device"
|
---|
5 | .SX "de \(enr \fIfile
|
---|
6 | .FL "\(enr" "Recover a file that has been removed"
|
---|
7 | .FL "\(enw" "Enable writing, so device can be modified"
|
---|
8 | .EX "de \(enr /usr/ast/prog.c" "Undo the effects of: \fIrm /usr/ast/prog.c\fR"
|
---|
9 | .EX "de \(enw /dev/fd0" "Edit \fI/dev/fd0\fR for writing"
|
---|
10 | .PP
|
---|
11 | The \fIde\fR program allows a system administrator to examine and modify
|
---|
12 | a \s-2MINIX\s0 file system device.
|
---|
13 | Commands are available to move to any address on the disk
|
---|
14 | and display the disk block contents. This information may
|
---|
15 | be presented in one of three visual modes: as two-byte words,
|
---|
16 | as ASCII characters or as a bit map. The disk may be searched
|
---|
17 | for a string of characters. If the \fB\(enw\fR option is given,
|
---|
18 | \fIde\fR will open the device for writing and words may be
|
---|
19 | modified.
|
---|
20 | Without this flag, writing is prohibited.
|
---|
21 | Lost blocks and files can be recovered using a variety of
|
---|
22 | commands. The \fB\(enr\fR option supports automated recovery of
|
---|
23 | files removed by \fIunlink\fR.
|
---|
24 | .SS "Positioning"
|
---|
25 | .PP
|
---|
26 | Disks are divided into blocks (also called \*(OQzones\*(CQ) of 1024
|
---|
27 | bytes. \fIDe\fR keeps a current address on the disk as a
|
---|
28 | block number and a byte offset within the block. In some
|
---|
29 | visual modes the offset is rounded off, for example, in
|
---|
30 | \*(OQword\*(CQ mode the offset must be even.
|
---|
31 | .PP
|
---|
32 | There are different types of blocks on a file system device,
|
---|
33 | including a super block, bit maps, i-nodes and data blocks.
|
---|
34 | \fIDe\fR knows the type of the current block, but will allow
|
---|
35 | most positioning commands and visual modes to function
|
---|
36 | anywhere on the disk.
|
---|
37 | .PP
|
---|
38 | The \fIf\fR command (or PGDN on the keypad) moves forward to the
|
---|
39 | next block, similarly \fIb\fR (PGUP) moves backwards one block.
|
---|
40 | \fIF\fR (END) moves to the last block and \fIB\fR (HOME) moves to the
|
---|
41 | first block.
|
---|
42 | .PP
|
---|
43 | The arrow keys (or
|
---|
44 | \fIu\fR, \fId\fR, \fIl\fR, and \fIr\fR) change the current
|
---|
45 | address by small increments. The size of the increment
|
---|
46 | depends on the current display mode, as shown below. The
|
---|
47 | various sizes suit each display and pointers move on the
|
---|
48 | screen to follow each press of an arrow key.
|
---|
49 | .HS
|
---|
50 | .if t .ta .75iR 1.5iR 2.25iR 3.0iR 3.75iR
|
---|
51 | .if n .ta .75i 1.5i 2.25i 3.0i 3.75i
|
---|
52 | .nf
|
---|
53 | \fB Mode Up Down Left Right\fR
|
---|
54 | Word \(mi2 +2 \(mi32 +32
|
---|
55 | Block \(mi64 +64 \(mi1 +1
|
---|
56 | Map \(mi256 +256 \(mi4 +4
|
---|
57 | .fi
|
---|
58 | .HS
|
---|
59 | The \fIg\fR command allows movement to any specified block.
|
---|
60 | Like all commands that take arguments, a prompt and
|
---|
61 | subsequent input are written to the bottom line of the
|
---|
62 | screen. Numerical entry may be decimal, octal or
|
---|
63 | hexadecimal, for example 234, \(mi1, 070, 0xf3, \(miX3C.
|
---|
64 | .PP
|
---|
65 | While checking an i-node one may want to move to a block
|
---|
66 | listed as a zone of the file. The \fIG\fR command takes the
|
---|
67 | contents at the current address in the device as a block
|
---|
68 | number and indirectly jumps to that block.
|
---|
69 | .PP
|
---|
70 | The address may be set to the start of any i-node using
|
---|
71 | the \fI\fR command and supplying an i-node number. The \fII\fR
|
---|
72 | command maps a given file name into an i-node address.
|
---|
73 | The file must exist on the current device and this
|
---|
74 | device must be mounted.
|
---|
75 | .SS "The Display"
|
---|
76 | .PP
|
---|
77 | The first line of the display contains the device name,
|
---|
78 | the name of the current output file (if one is open) and
|
---|
79 | the current search string. If \fIde\fR is being run with
|
---|
80 | the \fB\(enw\fR option then the device name is flagged with \*(OQ(w).\*(CQ
|
---|
81 | If a string is too long to fit on the line it is marked with \*(OQ...\*(CQ.
|
---|
82 | .PP
|
---|
83 | The second line contains the current block number, the
|
---|
84 | total number of blocks, and the type of the current block.
|
---|
85 | The types are: boot, super, i-node bit map, zone bit map,
|
---|
86 | i-nodes and data block.
|
---|
87 | If the current address is
|
---|
88 | within a data block then the string \*(OQin use\*(CQ is displayed
|
---|
89 | if the block corresponds to a set in the zone bit map.
|
---|
90 | .PP
|
---|
91 | The third line shows the offset in the current block. If
|
---|
92 | the current address is within either the i-node or zone bit
|
---|
93 | maps then the i-node or block number corresponding to the
|
---|
94 | current bit is shown. If the current address is within an
|
---|
95 | i-node then the i-node number and \*(OQin use\*(CQ status is displayed.
|
---|
96 | If the address is within a bit map or i-node block, but past
|
---|
97 | the last usable entry, then the string \*(OQpadding\*(CQ is shown.
|
---|
98 | .PP
|
---|
99 | The rest of the screen is used to display data from the
|
---|
100 | current block. There are three visual display modes:
|
---|
101 | \*(OQword,\*(CQ \*(OQblock,\*(CQ and \*(OQmap.\*(CQ
|
---|
102 | The \fIv\fR command followed by
|
---|
103 | \fIw\fR, \fIb\fR, or \fIm\fR sets the current display mode.
|
---|
104 | .PP
|
---|
105 | In \*(OQword\*(CQ mode 16 words, of two bytes each, are shown in
|
---|
106 | either base 2, 8, 10 or 16. The current base is displayed
|
---|
107 | to the far right of the screen. It can be changed using the
|
---|
108 | \fIo\fR command followed by either an \fIh\fR (hexadecimal), \fId\fR
|
---|
109 | (decimal), \fIo\fR (octal) or \fIb\fR (binary).
|
---|
110 | .PP
|
---|
111 | \fIDe\fR knows where i-nodes are, and will display the
|
---|
112 | contents in a readable format, including the \fIrwx\fR bits,
|
---|
113 | the user name and the time field. If the current page
|
---|
114 | is at the beginning of the super block, or an executable
|
---|
115 | file or an \fIar\fR archive, then \fIde\fR will also inform
|
---|
116 | the user. In all other cases the contents of the 16
|
---|
117 | words are shown to the right as equivalent ASCII
|
---|
118 | characters.
|
---|
119 | .PP
|
---|
120 | In \*(OQblock\*(CQ mode a whole block of 1024 bytes is displayed
|
---|
121 | as ASCII characters, 64 columns by 16 lines. Control codes
|
---|
122 | are shown as highlighted characters. If the high order bit
|
---|
123 | is set in any of the 1024 bytes then an \*(OQMSB\*(CQ flag is shown
|
---|
124 | on the far right of the screen, but these bytes are not
|
---|
125 | individually marked.
|
---|
126 | .PP
|
---|
127 | In \*(OQmap\*(CQ mode 2048 bits (256 bytes) are displayed from the
|
---|
128 | top to the bottom (32 bits) and from the left to the right
|
---|
129 | of the screen. Bit zero of a byte is towards the top of the
|
---|
130 | screen. This visual mode is generally used to observe
|
---|
131 | the bit map blocks. The number of set bits displayed is
|
---|
132 | written on the far right of the screen.
|
---|
133 | .SS "Searching"
|
---|
134 | .PP
|
---|
135 | A search for an ASCII string is initiated by the \fI/\fR command.
|
---|
136 | Control characters not used for other purposes may be
|
---|
137 | entered in the search string, for example CTRL-J is an end-of-line
|
---|
138 | character. The search is from the current position to
|
---|
139 | the end of the current device.
|
---|
140 | .PP
|
---|
141 | Once a search string has been defined by a use of \fI/\fR, the
|
---|
142 | next search may be initiated with the \fIn\fR command, (a \fI/\fR
|
---|
143 | followed immediately by an ENTER is equivalent to an \fIn\fR).
|
---|
144 | .PP
|
---|
145 | Whenever a search is in progress \fIde\fR will append
|
---|
146 | one \fI.\fR to the prompt line for every 500 blocks searched. If the
|
---|
147 | string is found between the end of the file system and the
|
---|
148 | actual end of the device, then the current address is set to
|
---|
149 | the end of the file system.
|
---|
150 | .PP
|
---|
151 | Some of the positioning commands push the current address
|
---|
152 | and visual mode in a stack before going to a new address.
|
---|
153 | These commands are
|
---|
154 | \fIB\fR, \fIF\fR, \fIg\fR, \fIG\fR, \fIi\fR, \fII\fR, \fIn\fR, \fIx\fR and
|
---|
155 | \fI/\fR.
|
---|
156 | The \fIp\fR
|
---|
157 | (previous) command pops the last address and visual mode
|
---|
158 | from the stack. This stack is eight entries deep.
|
---|
159 | .SS "Modifying the File System"
|
---|
160 | .PP
|
---|
161 | The \fIs\fR command will prompt for a data word and store it at
|
---|
162 | the current address on the disk. This is used to change
|
---|
163 | information that can not be easily changed by any other
|
---|
164 | means.
|
---|
165 | .PP
|
---|
166 | The data word is 16 bits wide, it may be entered in decimal,
|
---|
167 | octal or hexadecimal. Remember that the \fB\(enw\fR option must
|
---|
168 | be specified for the \fIs\fR command to operate. Be careful
|
---|
169 | when modifying a mounted file system.
|
---|
170 | .SS "Recovering Files"
|
---|
171 | .PP
|
---|
172 | Any block on the disk may be written to an output file.
|
---|
173 | This is used to recover blocks marked as free on the
|
---|
174 | disk. A write command will request a file name the first
|
---|
175 | time it is used, on subsequent writes the data is appended
|
---|
176 | to the current output file.
|
---|
177 | .PP
|
---|
178 | The name of the current output file is changed using the
|
---|
179 | \fIc\fR command. This file should be on a different file system,
|
---|
180 | to avoid overwriting an i-node or block before it is
|
---|
181 | recovered.
|
---|
182 | .PP
|
---|
183 | An ASCII block is usually recovered using the \fIw\fR command.
|
---|
184 | All bytes will have their most significant bit cleared before
|
---|
185 | being written to the output file. Bytes containing '\\0'
|
---|
186 | or '\\177' are not copied. The \fIW\fR command writes the current
|
---|
187 | block (1024 bytes exactly) to the output file.
|
---|
188 | .PP
|
---|
189 | When a file is deleted using \fIunlink\fR the i-node number
|
---|
190 | in the directory is zeroed, but before its removal, it is
|
---|
191 | copied into the end of the file name field. This allows
|
---|
192 | the i-node of a deleted file to be found by searching
|
---|
193 | through a directory. The \fIx\fR command asks for the path
|
---|
194 | name of a lost file, extracts the old i-node number and
|
---|
195 | changes the current disk address to the start of the
|
---|
196 | i-node.
|
---|
197 | .PP
|
---|
198 | Once an i-node is found, all of the freed blocks may be
|
---|
199 | recovered by checking the i-node zone fields, using 'G'
|
---|
200 | to go to a block, writing it back out using 'w', going
|
---|
201 | back to the i-node with \fIp\fR and advancing to the next
|
---|
202 | block. This file extraction process is automated by using
|
---|
203 | the \fIX\fR command, which goes through the i-node, indirect
|
---|
204 | and double indirect blocks finding all the block pointers
|
---|
205 | and recovering all the blocks of the file.
|
---|
206 | .PP
|
---|
207 | The \fIX\fR command closes the current output file and asks
|
---|
208 | for the name of a new output file. All of the disk blocks
|
---|
209 | must be marked as free, if they are not the command stops
|
---|
210 | and the file must be recovered manually.
|
---|
211 | .PP
|
---|
212 | When extracting lost blocks \fIde\fR will maintain \*(OQholes\*(CQ in
|
---|
213 | the file. Thus, a recovered sparse file does not allocate
|
---|
214 | unused blocks and will keep its efficient storage scheme.
|
---|
215 | This property of the \fIX\fR command may be used to move a sparse
|
---|
216 | file from one device to another.
|
---|
217 | .PP
|
---|
218 | Automatic recovery may be initiated by the \fB\(enr\fR option on
|
---|
219 | the command line. Also specified is the path name of a
|
---|
220 | file just removed by \fIunlink\fR. \fIDe\fR determines which
|
---|
221 | mounted file system device held the file and opens it for
|
---|
222 | reading. The lost i-node is found and the file extracted by
|
---|
223 | automatically performing an \fIx\fR and an \fIX\fR command.
|
---|
224 | .PP
|
---|
225 | The recovered file will be written to \fI/tmp\fR. \fIDe\fR will
|
---|
226 | refuse to automatically recover a file on the same file
|
---|
227 | system as \fI/tmp\fR. The lost file must have belonged to the
|
---|
228 | user. If automatic recovery will not complete, then manual
|
---|
229 | recovery may be performed.
|
---|
230 | .SS "Miscellaneous"
|
---|
231 | .PP
|
---|
232 | The user can terminate a session with \fIde\fR by typing
|
---|
233 | \fIq\fR, CTRL-D, or the key associated with SIGQUIT.
|
---|
234 | .PP
|
---|
235 | The \fIm\fR command invokes the \s-2MINIX\s0 \fIsh\fR shell as a subprocess.
|
---|
236 | .PP
|
---|
237 | For help while using \fIde\fR use \fIh\fR.
|
---|
238 | .SS "Command Summary"
|
---|
239 | .LP
|
---|
240 | .ta 0.25i 1.0i 1.5i
|
---|
241 | .nf
|
---|
242 | .sp
|
---|
243 | PGUP b Back one block
|
---|
244 | PGDN f Forward one block
|
---|
245 | HOME B Goto first block
|
---|
246 | END F Goto last block
|
---|
247 | UP u Move back 2/64/256 bytes
|
---|
248 | DOWN d Move forward 2/64/256 bytes
|
---|
249 | LEFT l Move back 32/1/4 bytes
|
---|
250 | RIGHT r Move forward 32/1/4 bytes
|
---|
251 | g Goto specified block
|
---|
252 | G Goto block indirectly
|
---|
253 | i Goto specified i-node
|
---|
254 | I Filename to i-node
|
---|
255 | / Search
|
---|
256 | n Next occurrence
|
---|
257 | p Previous address
|
---|
258 | h Help
|
---|
259 | EOF q Quit
|
---|
260 | m \s-2MINIX\s0 shell
|
---|
261 | v Visual mode (w b m)
|
---|
262 | o Output base (h d o b)
|
---|
263 | c Change file name
|
---|
264 | w Write ASCII block
|
---|
265 | W Write block exactly
|
---|
266 | x Extract lost directory entry
|
---|
267 | X Extract lost file blocks
|
---|
268 | s Store word
|
---|
269 | .fi
|
---|
270 | .sp
|
---|
271 | NOTES:
|
---|
272 | When entering a line in response to a prompt from \fIde\fR
|
---|
273 | there are a couple of editing characters available. The
|
---|
274 | previous character may be erased by typing CTRL-H and the
|
---|
275 | whole line may be erased by typing CTRL-U. ENTER terminates
|
---|
276 | the input. If DELETE or a non-ASCII character is typed
|
---|
277 | then the command requesting the input is aborted.
|
---|
278 | .PP
|
---|
279 | The commands \fIG\fR, \fIs\fR and \fIX\fR will only function if
|
---|
280 | the current visual display mode is \*(OQword.\*(CQ
|
---|
281 | The commands
|
---|
282 | \fIi\fR, \fII\fR and \fIx\fR change the mode to \*(OQword\*(CQ on
|
---|
283 | completion. The commands \fIG\fR and \fI/\fR change the mode
|
---|
284 | to \*(OQblock\*(CQ. These restrictions and automatic mode
|
---|
285 | conversions are intended to aid the user.
|
---|
286 | .PP
|
---|
287 | The \*(OQmap\*(CQ mode uses special graphic characters, and
|
---|
288 | only functions if the user is at the console.
|
---|
289 | .PP
|
---|
290 | \fIDe\fR generates warnings for illegal user input or if
|
---|
291 | erroneous data is found on the disk, for example a
|
---|
292 | corrupted magic number. Warnings appear in the middle
|
---|
293 | of the screen for two seconds, then the current page
|
---|
294 | is redrawn. Some minor errors, for example, setting
|
---|
295 | an unknown visual mode, simply ring the bell. Major
|
---|
296 | errors, for example I/O problems on the file system
|
---|
297 | device cause an immediate exit from \fIde\fR.
|
---|
298 | .PP
|
---|
299 | The i-node and zone bit maps are read from the device
|
---|
300 | when \fIde\fR starts up. These determine whether \*(OQin use\*(CQ
|
---|
301 | or \*(OQnot in use\*(CQ is displayed in the status field at
|
---|
302 | the top of the screen. The bit maps are not re-read
|
---|
303 | while using \fIde\fR and will become out-of-date if
|
---|
304 | observing a mounted file system.
|
---|
305 | .PP
|
---|
306 | \fIDe\fR requires termcap definitions for \*(OQcm\*(CQ and \*(OQcl\*(CQ.
|
---|
307 | Furthermore, \*(OQso\*(CQ and \*(OQse\*(CQ will also be used if available.
|
---|
308 | The ANSI strings generated by the keypad arrows are recognized,
|
---|
309 | as well as any single character codes defined by \*(OQku\*(CQ,
|
---|
310 | \*(OQkd\*(CQ, \*(OQkl\*(CQ and \*(OQkr\*(CQ.
|
---|
311 | .SS "Author"
|
---|
312 | .PP
|
---|
313 | The \fIde\fR program was written by Terrence Holm.
|
---|