source: trunk/minix/man/man9/de.9@ 12

Last change on this file since 12 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

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