• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE Article PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
2
3<Article>
4
5<ArticleInfo>
6
7<Title>EXT2ED - The Extended-2 filesystem editor - User's guide</Title>
8<AUTHOR>
9<FirstName>Gadi Oxman, tgud@tochnapc2.technion.ac.il</FirstName>
10</AUTHOR>
11<PubDate>v0.1, August 3 1995</PubDate>
12
13<Abstract>
14
15<Para>
16This is only the initial version of this document. It may be unclear at
17some places. Please send me feedback with anything regarding to it.
18</Para>
19
20</Abstract>
21
22</ArticleInfo>
23
24<Sect1>
25<Title>About EXT2ED documentation</Title>
26
27<Para>
28The EXT2ED documentation consists of three parts:
29
30<ItemizedList>
31<ListItem>
32
33<Para>
34	The ext2 filesystem overview.
35</Para>
36</ListItem>
37<ListItem>
38
39<Para>
40	The EXT2ED user's guide.
41</Para>
42</ListItem>
43<ListItem>
44
45<Para>
46	The EXT2ED design and implementation.
47</Para>
48</ListItem>
49
50</ItemizedList>
51
52</Para>
53
54<Para>
55If you intend to used EXT2ED, I strongly suggest that you would be familiar
56with the material presented in the <Literal remap="tt">ext2 filesystem overview</Literal> as well.
57</Para>
58
59<Para>
60If you also intend to browse and modify the source code, I suggest that you
61will also read the article <Literal remap="tt">The EXT2ED design and implementation</Literal>, as it
62provides a general overview of the structure of my source code.
63</Para>
64
65</Sect1>
66
67<Sect1>
68<Title>Introduction</Title>
69
70<Para>
71EXT2ED is a "disk editor" for the ext2 filesystem. Its purpose is to show
72you the internal structures of the ext2 filesystem in an rather intuitive
73and logical way, so that it will be easier to "travel" between the various
74internal filesystem structures.
75</Para>
76
77</Sect1>
78
79<Sect1>
80<Title>Basic concepts in EXT2ED</Title>
81
82<Para>
83Two basic concepts in EXT2ED are <Literal remap="tt">commands</Literal> and <Literal remap="tt">types</Literal>.
84</Para>
85
86<Para>
87EXT2ED is object-oriented in the sense that it defines objects in the
88filesystem, like a <Literal remap="tt">super-block</Literal> or a <Literal remap="tt">directory</Literal>. An object is
89something which "knows" how to handle some aspect of the filesystem.
90</Para>
91
92<Para>
93Your interaction with EXT2ED is done through <Literal remap="tt">commands</Literal> which EXT2ED
94accepts. There are three levels of commands:
95
96<ItemizedList>
97<ListItem>
98
99<Para>
100	General Commands
101</Para>
102</ListItem>
103<ListItem>
104
105<Para>
106	Extended-2 Filesystem general commands
107</Para>
108</ListItem>
109<ListItem>
110
111<Para>
112	Type specific commands
113</Para>
114</ListItem>
115
116</ItemizedList>
117
118The General commands are always available.
119</Para>
120
121<Para>
122The ext2 general commands are available only when editing an ext2 filesystem.
123</Para>
124
125<Para>
126The Type specific commands are available when editing a specific object in the
127filesystem. Each object typically comes with its own set of internal
128variables, and its own set of commands, which are fine tuned handle the
129corresponding structure in the filesystem.
130</Para>
131
132</Sect1>
133
134<Sect1>
135<Title>Running EXT2ED</Title>
136
137<Para>
138Running EXT2ED is as simple as typing <Literal remap="tt">ext2ed</Literal> from the shell prompt.
139There are no command line switches.
140</Para>
141
142<Para>
143When first run, EXT2ED parses its configuration file, <Literal remap="tt">ext2ed.conf</Literal>.
144This file must exist.
145</Para>
146
147<Para>
148When the configuration file processing is done, EXT2ED screen should appear
149on the screen, with the command prompt <Literal remap="tt">ext2ed&#62;</Literal> displayed.
150</Para>
151
152</Sect1>
153
154<Sect1>
155<Title>EXT2ED user interface</Title>
156
157<Para>
158EXT2ED uses the <Emphasis>ncurses</Emphasis> library for screen management. Your screen
159will be divided into four parts, from top to bottom:
160
161<ItemizedList>
162<ListItem>
163
164<Para>
165 Title window
166</Para>
167</ListItem>
168<ListItem>
169
170<Para>
171 Status window
172</Para>
173</ListItem>
174<ListItem>
175
176<Para>
177 Main editing window
178</Para>
179</ListItem>
180<ListItem>
181
182<Para>
183 Command window
184</Para>
185</ListItem>
186
187</ItemizedList>
188
189The title window just displays the current version of EXT2ED.
190</Para>
191
192<Para>
193The status window will display various information regarding the state of
194the editing at this point.
195</Para>
196
197<Para>
198The main editing window is the place at which the actual data will be shown.
199Almost every command will cause some display at this window. This window, as
200opposed to the three others, is of variable length - You always look at one
201page of it. The current page and the total numbers of pages at this moment
202is displayed at the status window. Moving between pages is done by the use
203of the <Command>pgdn</Command> and <Command>pgup</Command> commands.
204</Para>
205
206<Para>
207The command window is at the bottom of the screen. It always displays a
208command prompt <Literal remap="tt">ext2ed&#62;</Literal> and allows you to type a command. Feedback
209about the commands entered is displayed to this window also.
210</Para>
211
212<Para>
213EXT2ED uses the <Emphasis>readline</Emphasis> library while processing a command line. All
214the usual editing keys are available. Each entered command is placed into a
215history of commands, and can be recalled later. Command Completion is also
216supported - Just start to type a command, and press the completion key.
217</Para>
218
219<Para>
220Pressing <Literal remap="tt">enter</Literal> at the command window, without entering a command,
221recalls the last command. This is useful when moving between close entries,
222in the <Command>next</Command> command, for example.
223</Para>
224
225</Sect1>
226
227<Sect1>
228<Title>Getting started</Title>
229
230<Sect2>
231<Title>A few precautions</Title>
232
233<Para>
234EXT2ED is a tool for filesystem <Literal remap="tt">editing</Literal>. As such, it can be
235<Literal remap="tt">dangerous</Literal>. The summary to the subsections below is that
236<Literal remap="tt">You must know what you are doing</Literal>.
237</Para>
238
239<Sect3 id="mounted-ref">
240<Title>A mounted filesystem</Title>
241
242<Para>
243EXT2ED is not designed to work on a mounted filesystem - It is complicated
244enough as it is; I didn't even try to think of handling the various race
245conditions. As such, please respect the following advice:
246</Para>
247
248<Para>
249<Literal remap="tt">Do not use EXT2ED on a mounted filesystem !</Literal>
250</Para>
251
252<Para>
253EXT2ED will not allow write access to a mounted filesystem. Although it is
254fairly easy to change EXT2ED so that it will be allowed, I hereby request
255again- EXT2ED is not designed for that action, and will most likely corrupt
256data if used that way. Please don't do that.
257</Para>
258
259<Para>
260Concerning read access, I chose to leave the decision for the user through
261the configuration file option <Literal remap="tt">AllowMountedRead</Literal>. Although read access
262on a mounted partition will not do any damage to the filesystem, the data
263displayed to you will not be reliable, and showing you incorrect information
264may be as bad as corrupting the filesystem. However, you may still wish to
265do that.
266</Para>
267
268</Sect3>
269
270<Sect3>
271<Title>Write access</Title>
272
273<Para>
274Considering the obvious sensitivity of the subject, I took the following
275actions:
276</Para>
277
278<Para>
279
280<OrderedList>
281<ListItem>
282
283<Para>
284	EXT2ED will always start with a read-only access. Write access mode
285needs to be specifically entered by the <Command>enablewrite</Command> command.
286Until this is done, no write will be allowed. Write access can be
287disabled at any time with <Command>disablewrite</Command>. When
288<Command>enablewrite</Command> is issued, the device is reopened in read-write
289mode. Needless to say, the device permissions should allow that.
290</Para>
291</ListItem>
292<ListItem>
293
294<Para>
295	As a second level of protection, you can disallow write access in
296the configuration file by using the <Literal remap="tt">AllowChanges off</Literal>
297configuration option. In this case, the <Command>enablewrite</Command> command
298will be refused.
299</Para>
300</ListItem>
301<ListItem>
302
303<Para>
304	When write access is enabled, the data will never change
305immediately. Rather, a specific <Command>writedata</Command> command is needed
306to update the object in the disk with the changed object in memory.
307</Para>
308</ListItem>
309<ListItem>
310
311<Para>
312	In addition, A logging option is provided through the configuration
313file options <Literal remap="tt">LogChanges</Literal> and <Literal remap="tt">LogFile</Literal>. With logging
314enabled, each change to the disk will be logged at a very primitive
315level - A hex dump of the original data and of the new written data.
316The log file will be a text file which is easily readable, and you
317can make use of it to undo any changes which you made (EXT2ED doesn't
318make use of the log file for that purpose, it just logs the changes).
319</Para>
320</ListItem>
321
322</OrderedList>
323
324Please remember that this is only the initial release of EXT2ED, and it is
325not very much tested - It is reasonable to assume that <Literal remap="tt">there are
326bugs</Literal>.
327However, the logging option above can offer protection even from this
328unfortunate case. Therefor, I highly recommend that at least when first
329working with EXT2ED, the logging option will be enabled, despite the disk
330space which it consumes.
331</Para>
332
333</Sect3>
334
335</Sect2>
336
337<Sect2 id="help-ref">
338<Title>The help command</Title>
339
340<Para>
341When loaded, EXT2ED will show a short help screen. This help screen can
342always be retrieved by the command <Command>help</Command>. The help screen displays a
343list of all the commands which are available at this point. At startup, only
344the <Literal remap="tt">General commands</Literal> are available.
345This will change with time, since each object has its own commands. Thus,
346commands which are available now may not be available later.
347Using <Command>help</Command> <Emphasis>command</Emphasis> will display additional information about
348the specific command <Emphasis>command</Emphasis>.
349</Para>
350
351</Sect2>
352
353<Sect2 id="setdevice-ref">
354<Title>The setdevice command</Title>
355
356<Para>
357The first command that is usually entered to EXT2ED is the <Command>setdevice</Command>
358command. This command simply tells EXT2ED on which device the filesystem is
359present. For example, suppose my ext2 filesystem is on the first partition
360of my ide disk. The command will be:
361
362<Screen>
363setdevice /dev/hda1
364</Screen>
365
366The following actions will take place in the following order:
367
368<OrderedList>
369<ListItem>
370
371<Para>
372	EXT2ED will check if the partition is mounted.
373If the partition is mounted (<Literal remap="tt">highly not recommended</Literal>),
374the accept/reject behavior will be decided by the configuration
375file. Cross reference section <XRef LinkEnd="mounted-ref">.
376</Para>
377</ListItem>
378<ListItem>
379
380<Para>
381	The specified device will be opened in read-only mode. The
382permissions of the device should be set in a way that allows
383you to open the device for read access.
384</Para>
385</ListItem>
386<ListItem>
387
388<Para>
389	Autodetection of an ext2 filesystem will be made by searching for
390the ext2 magic number in the main superblock.
391</Para>
392</ListItem>
393<ListItem>
394
395<Para>
396	In the case of a successful recognition of an ext2 filesystem, the
397ext2 filesystem specific commands and the ext2 specific object
398definitions will be registered. The object definitions will be read
399at run time from a file specified by the configuration file.
400
401In case of a corrupted ext2 filesystem, it is quite possible that
402the main superblock is damaged and autodetection will fail. In that
403case, use the configuration option <Literal remap="tt">ForceExt2 on</Literal>. This is not
404the default case since EXT2ED can be used at a lower level to edit a
405non-ext2 filesystem.
406</Para>
407</ListItem>
408<ListItem>
409
410<Para>
411	In a case of a successful autodetection, essential information about
412the filesystem such as the block size will be read from the
413superblock, unless the used overrides this behavior with an
414configuration option (not recommended). In that case, the parameters
415will be read from the configuration file.
416
417In a case of an autodetection failure, the essential parameters
418will be read from the configuration file.
419</Para>
420</ListItem>
421
422</OrderedList>
423
424Assuming that you are editing an ext2 filesystem and that everything goes
425well, you will notice that additional commands are now available in the help
426screen, under the section <Literal remap="tt">ext2 filesystem general commands</Literal>. In
427addition, EXT2ED now recognizes a few objects which are essential to the
428editing of an ext2 filesystem.
429</Para>
430
431</Sect2>
432
433</Sect1>
434
435<Sect1>
436<Title>Two levels of usage</Title>
437
438<Sect2>
439<Title>Low level usage</Title>
440
441<Para>
442This section explains what EXT2ED provides even when not editing an ext2
443filesystem.
444</Para>
445
446<Para>
447Even at this level, EXT2ED is more than just a hex editor. It still allows
448definition of objects and variables in run time through a user file,
449although of-course the objects will not have special fine tuned functions
450connected to them. EXT2ED will allow you to move in the filesystem using
451<Command>setoffset</Command>, and to apply an object definition on a specific place
452using <Command>settype</Command> <Emphasis>type</Emphasis>. From this point and on, the object will
453be shown <Literal remap="tt">in its native form</Literal> - You will see a list of the
454variables rather than just a hex dump, and you will be able to change each
455variable in the intuitive form <Command>set variable=value</Command>.
456</Para>
457
458<Para>
459To define objects, use the configuration option <Literal remap="tt">AlternateDescriptors</Literal>.
460</Para>
461
462<Para>
463There are now two forms of editing:
464
465<ItemizedList>
466<ListItem>
467
468<Para>
469	Editing without a type. In this case, the disk block will be shown
470as a text+hex dump, and you will be able to move along and change it.
471</Para>
472</ListItem>
473<ListItem>
474
475<Para>
476	Editing with a type. In this case, the object's variables will be
477shown, and you will be able to change each variable in its native form.
478</Para>
479</ListItem>
480
481</ItemizedList>
482
483</Para>
484
485</Sect2>
486
487<Sect2>
488<Title>High level usage</Title>
489
490<Para>
491EXT2ED was designed for the editing of the ext2 filesystem. As such, it
492"understands" the filesystem structure to some extent. Each object now has
493special fine tuned 'C' functions connected to it, which knows how to display
494it in an intuitive form, and how the object fits in the general design of
495the ext2 filesystem. It is of-course much easier to use this type of
496editing. For example:
497
498<Screen>
499Issue <Emphasis>group 2</Emphasis> to look at the main copy of the third group block
500descriptor. With <Emphasis>gocopy 1</Emphasis> you can move to its first backup copy,
501and with <Emphasis>inode</Emphasis> you can start editing the inode table of the above
502group block. From here, if the inode corresponds to a file, you can
503use <Emphasis>file</Emphasis> to edit the file in a "continuous" way, using
504<Emphasis>nextblock</Emphasis> to pass to its next block, letting EXT2ED following by
505itself the direct blocks, indirect blocks, ..., while still preserving the
506actual view of the exact block usage of the file.
507</Screen>
508
509The point is that the "tour" of the filesystem will now be synchronous rather
510than asynchronous - Each object has the "links" to pass between connected
511logical structures, and special fine-tuned functions to deal with it.
512</Para>
513
514</Sect2>
515
516</Sect1>
517
518<Sect1>
519<Title>General commands</Title>
520
521<Para>
522I will now start with a systematic explanation of the general commands.
523Please feel free to experiment, but take care when using the
524<Literal remap="tt">enablewrite</Literal> command.
525</Para>
526
527<Para>
528Whenever a command syntax is specified, arguments which are optional are
529enclosed with square brackets.
530</Para>
531
532<Para>
533Please note that in EXT2ED, each command can be overridden by a specific
534object to provide special fine-tuned functionality. In general, I was
535attempting to preserve the similarity between those functions, which are
536accessible by the same name.
537</Para>
538
539<Sect2 id="disablewrite-ref">
540<Title>disablewrite</Title>
541
542<Para>
543
544<Screen>
545Syntax: disablewrite
546</Screen>
547
548<Command>disablewrite</Command> is used to reopen the device with read-only access. When
549first running EXT2ED, the device is opened in read-only mode, and an
550explicit <Command>enablewrite</Command> is required for write access. When finishing
551with changing, a <Command>disablewrite</Command> is recommended for safety. Cross
552reference section <XRef LinkEnd="disablewrite-ref">.
553</Para>
554
555</Sect2>
556
557<Sect2 id="enablewrite-ref">
558<Title>enablewrite</Title>
559
560<Para>
561
562<Screen>
563Syntax: enablewrite
564</Screen>
565
566<Command>enablewrite</Command> is used to reopen the device with read-write access.
567When first running EXT2ED, the device is opened in read-only mode, and an
568explicit <Command>enablewrite</Command> is required for write access.
569<Command>enablewrite</Command> will fail if write access is disabled from the
570configuration file by the <Literal remap="tt">AllowChanges off</Literal> configuration option.
571Even after <Command>enablewrite</Command>, an explicit <Command>writedata</Command>
572is required to actually write the new data to the disk.
573When finishing with changing, a <Command>disablewrite</Command> is recommended for safety.
574Cross reference section <XRef LinkEnd="enablewrite-ref">.
575</Para>
576
577</Sect2>
578
579<Sect2>
580<Title>help</Title>
581
582<Para>
583
584<Screen>
585Syntax: help [command]
586</Screen>
587
588The <Command>help</Command> command is described at section <XRef LinkEnd="help-ref">.
589</Para>
590
591</Sect2>
592
593<Sect2 id="next-ref">
594<Title>next</Title>
595
596<Para>
597
598<Screen>
599Syntax: next [number]
600</Screen>
601
602This section describes the <Emphasis>general command</Emphasis> <Command>next</Command>. <Command>next</Command>
603is overridden by several types in EXT2ED, to provide fine-tuned
604functionality.
605</Para>
606
607<Para>
608The <Literal remap="tt">next general command</Literal> behavior is depended on whether you are editing a
609specific object, or none.
610</Para>
611
612<Para>
613
614<ItemizedList>
615<ListItem>
616
617<Para>
618	In the case where Type is <Literal remap="tt">none</Literal> (The current type is showed
619on the status window by the <Command>show</Command> command), <Literal remap="tt">next</Literal>
620passes to the next <Emphasis>number</Emphasis> bytes in the current edited block.
621If <Emphasis>number</Emphasis> is not specified, <Emphasis>number=1</Emphasis> is assumed.
622</Para>
623</ListItem>
624<ListItem>
625
626<Para>
627 	In the case where Type is defined, the <Command>next</Command> commands assumes
628that you are editing an array of objects of that type, and the
629<Command>next</Command> command will just pass to the next entry in the array.
630If <Emphasis>number</Emphasis> is defined, it will pass <Emphasis>number</Emphasis> entries
631ahead.
632</Para>
633</ListItem>
634
635</ItemizedList>
636
637</Para>
638
639</Sect2>
640
641<Sect2 id="pgdn-ref">
642<Title>pgdn</Title>
643
644<Para>
645
646<Screen>
647Syntax: pgdn
648</Screen>
649
650Usually the edited data doesn't fit into the visible main window. In this
651case, the status window will indicate that there is more to see "below" by
652the message <Literal remap="tt">Page x of y</Literal>. This means that there are <Emphasis>y</Emphasis> pages
653total, and you are currently viewing the <Emphasis>x</Emphasis> page. With the <Command>pgdn</Command>
654command, you can pass to the next available page.
655</Para>
656
657</Sect2>
658
659<Sect2>
660<Title>pgup</Title>
661
662<Para>
663
664<Screen>
665Syntax: pgup
666</Screen>
667
668</Para>
669
670<Para>
671<Command>pgup</Command> is the opposite of <Command>pgdn</Command> - It will pass to the previous
672page. Cross reference section <XRef LinkEnd="pgdn-ref">.
673</Para>
674
675</Sect2>
676
677<Sect2>
678<Title>prev</Title>
679
680<Para>
681
682<Screen>
683Syntax: prev [number]
684</Screen>
685
686</Para>
687
688<Para>
689<Command>prev</Command> is the opposite of <Command>next</Command>. Cross reference section
690<XRef LinkEnd="next-ref">.
691</Para>
692
693</Sect2>
694
695<Sect2 id="recall-ref">
696<Title>recall</Title>
697
698<Para>
699
700<Screen>
701Syntax: recall object
702</Screen>
703
704<Command>recall</Command> is the opposite of <Command>remember</Command>. It will place you at the
705place you where when saving the object position and type information. Cross
706reference section <XRef LinkEnd="remember-ref">.
707</Para>
708
709</Sect2>
710
711<Sect2>
712<Title>redraw</Title>
713
714<Para>
715
716<Screen>
717Syntax: redraw
718</Screen>
719
720Sometimes the screen display gets corrupted. I still have problems with
721this. The <Command>redraw</Command> command simply redraws the entire display screen.
722</Para>
723
724</Sect2>
725
726<Sect2 id="remember-ref">
727<Title>remember</Title>
728
729<Para>
730
731<Screen>
732Syntax: remember object
733</Screen>
734
735EXT2ED provides you <Literal remap="tt">memory</Literal> of objects; While editing, you may reach an
736object which you will like to return to later. The <Command>remember</Command> command
737will store in memory the current place and type of the object. You can
738return to the object by using the <Command>recall</Command> command. Cross reference
739section <XRef LinkEnd="recall-ref">.
740</Para>
741
742<Para>
743<Literal remap="tt">Note:</Literal>
744
745<ItemizedList>
746<ListItem>
747
748<Para>
749	When remembering a <Literal remap="tt">file</Literal> or a <Literal remap="tt">directory</Literal>, the
750corresponding inode will be saved in memory. The basic reason is that
751the inode is essential for finding the blocks of the file or the
752directory.
753</Para>
754</ListItem>
755
756</ItemizedList>
757
758</Para>
759
760</Sect2>
761
762<Sect2>
763<Title>set</Title>
764
765<Para>
766
767<Screen>
768Syntax: set [text || hex] arg1 [arg2 arg3 ...]
769
770or
771
772Syntax: set variable=value
773</Screen>
774
775The <Command>set</Command> command is used to modify the current data.
776The <Command>set general command</Command> behavior is depended on whether you are editing a
777specific object, or none.
778</Para>
779
780<Para>
781
782<ItemizedList>
783<ListItem>
784
785<Para>
786	In the case where Type is <Command>none</Command>, the first syntax should be
787used. The set command affects the data starting at the current
788highlighted position in the edited block.
789
790<ItemizedList>
791<ListItem>
792
793<Para>
794	When using the <Command>set hex</Command> command, a list of
795hexadecimal bytes should follow.
796</Para>
797</ListItem>
798<ListItem>
799
800<Para>
801	When using the <Command>set text</Command> command, it should be followed
802by a text string.
803</Para>
804</ListItem>
805
806</ItemizedList>
807
808Examples:
809
810<Screen>
811	set hex 09 0a 0b 0c 0d 0e 0f
812	set text Linux is just great !
813
814</Screen>
815
816</Para>
817</ListItem>
818<ListItem>
819
820<Para>
821 	In the case where Type is defined, the second syntax should be used.
822The set commands just sets the variable <Emphasis>variable</Emphasis> with the
823value <Emphasis>value</Emphasis>.
824</Para>
825</ListItem>
826
827</ItemizedList>
828
829In any case, the data is only changed in memory. For an actual update to the
830disk, use the <Command>writedata</Command> command.
831</Para>
832
833</Sect2>
834
835<Sect2>
836<Title>setdevice</Title>
837
838<Para>
839
840<Screen>
841Syntax: setdevice device
842</Screen>
843
844The <Command>setdevice</Command> command is described at section <XRef LinkEnd="setdevice-ref">.
845</Para>
846
847</Sect2>
848
849<Sect2>
850<Title>setoffset</Title>
851
852<Para>
853
854<Screen>
855Syntax: setoffset [block || type] [+|-]offset
856</Screen>
857
858The <Command>setoffset</Command> command is used to move asynchronously inside the file
859system. It is considered a low level command, and usually should not be used
860when editing an ext2 filesystem, simply because movement is better
861utilized through the specific ext2 commands.
862</Para>
863
864<Para>
865The <Command>offset</Command> is in bytes, and meanwhile should be positive and smaller
866than 2GB.
867</Para>
868
869<Para>
870Use of the <Command>block</Command> modifier changes the counting unit to block.
871</Para>
872
873<Para>
874Use of the <Literal remap="tt">+ or -</Literal> modifiers signals that the offset is relative to
875the current position.
876</Para>
877
878<Para>
879use of the <Literal remap="tt">type</Literal> modifier is allowed only with relative offset. This
880modifier will multiply the offset by the size of the current type.
881</Para>
882
883</Sect2>
884
885<Sect2>
886<Title>settype</Title>
887
888<Para>
889
890<Screen>
891Syntax: settype type || [none | hex]
892</Screen>
893
894The <Command>settype</Command> command is used to move apply the object definitions of
895the type <Emphasis>type</Emphasis> on the current position. It is considered a low level
896command and usually should not be used when editing an ext2 filesystem since
897EXT2ED provides better tools. It is of-course very useful when editing a
898non-ext2 filesystem and using user-defined objects.
899</Para>
900
901<Para>
902When <Emphasis>type</Emphasis> is <Emphasis>hex</Emphasis> or <Emphasis>none</Emphasis>, the data will be displayed as
903a hex and text dump.
904</Para>
905
906</Sect2>
907
908<Sect2>
909<Title>show</Title>
910
911<Para>
912
913<Screen>
914Syntax: show
915</Screen>
916
917The <Command>show</Command> command will show the data of the current object at the
918current position on the main display window. It will also update the status
919window with type specific information. It may be necessary to use
920<Command>pgdn</Command> and <Command>pgup</Command> to view the entire data.
921</Para>
922
923</Sect2>
924
925<Sect2>
926<Title>writedata</Title>
927
928<Para>
929
930<Screen>
931Syntax: writedata
932</Screen>
933
934The <Command>writedata</Command> command will update the disk with the object data that
935is currently in memory. This is the point at which actual change is made to
936the filesystem. Without this command, the edited data will not have any
937effect. Write access should be allowed for a successful update.
938</Para>
939
940</Sect2>
941
942</Sect1>
943
944<Sect1>
945<Title>Editing an ext2 filesystem</Title>
946
947<Para>
948In order to edit an ext2 filesystem, you should, of course, know the structure
949of the ext2 filesystem. If you feel that you lack some knowledge in this
950area, I suggest that you do some of the following:
951
952<ItemizedList>
953<ListItem>
954
955<Para>
956	Read the supplied ext2 technical information. I tried to summarize
957the basic information which is needed to get you started.
958</Para>
959</ListItem>
960<ListItem>
961
962<Para>
963	Get the slides that Remy Card (The author of the ext2 filesystem)
964prepared concerning the ext2 filesystem.
965</Para>
966</ListItem>
967<ListItem>
968
969<Para>
970	Read the kernel sources.
971</Para>
972</ListItem>
973
974</ItemizedList>
975
976At this point, you should be familiar with the following terms:
977<Literal remap="tt">block, inode, superblock, block groups, block allocation bitmap, inode
978allocation bitmap, group descriptors, file, directory.</Literal>Most of the above
979are objects in EXT2ED.
980</Para>
981
982<Para>
983When editing an ext2 filesystem it is recommended that you use the ext2
984specific commands, rather then the general commands  <Command>setoffset</Command> and
985<Command>settype</Command>, mainly because:
986
987<OrderedList>
988<ListItem>
989
990<Para>
991	In most cases it will be unreliable, and will display incorrect
992information.
993
994Sometimes in order to edit an object, EXT2ED needs the information
995of some other related objects. For example, when editing a
996directory, EXT2ED needs access to the inode of the edited directory.
997Simply setting the type to a directory <Literal remap="tt">will be unreliable</Literal>,
998since the object assumes that you passed through its inode to reach
999it, and expects this information, which isn't initialized if you
1000directly set the type to a directory.
1001</Para>
1002</ListItem>
1003<ListItem>
1004
1005<Para>
1006	EXT2ED offers far better tools for handling the ext2 filesystem
1007using the ext2 specific commands.
1008</Para>
1009</ListItem>
1010
1011</OrderedList>
1012
1013</Para>
1014
1015</Sect1>
1016
1017<Sect1>
1018<Title>ext2 general commands</Title>
1019
1020<Para>
1021The <Literal remap="tt">ext2 general commands</Literal> are available only when you are editing an
1022ext2 filesystem. They are <Literal remap="tt">general</Literal> in the sense that they are not
1023specific to some object, and can be invoked anytime.
1024</Para>
1025
1026<Sect2 id="general-superblock">
1027<Title>super</Title>
1028
1029<Para>
1030
1031<Screen>
1032Syntax: super
1033</Screen>
1034
1035The <Command>super</Command> command will "bring you" to the main superblock copy. It
1036will automatically set the object type to <Literal remap="tt">ext2&lowbar;super&lowbar;block</Literal>. Then you
1037will be able to view and edit the superblock. When you are in the
1038superblock, other commands will be available.
1039</Para>
1040
1041</Sect2>
1042
1043<Sect2>
1044<Title>group</Title>
1045
1046<Para>
1047
1048<Screen>
1049Syntax: group [number]
1050</Screen>
1051
1052The <Command>group</Command> command will "bring you" to the main copy of the
1053<Emphasis>number</Emphasis> group descriptor. It will automatically set the object type to
1054<Literal remap="tt">ext2&lowbar;group&lowbar;desc</Literal>. Then you will be able to view and edit the group
1055descriptor entry. When you are there, other commands will be available.
1056</Para>
1057
1058</Sect2>
1059
1060<Sect2>
1061<Title>cd</Title>
1062
1063<Para>
1064
1065<Screen>
1066Syntax: cd path
1067</Screen>
1068
1069The <Command>cd</Command> command will let you travel in the filesystem in the nice way
1070that the mounted filesystem would have let you.
1071</Para>
1072
1073<Para>
1074The <Command>cd</Command> command is a complicated command. Although it may sound
1075simple at first, an implementation of a typical cd requires passing through
1076the group descriptors, inodes, directory entries, etc. For example:
1077</Para>
1078
1079<Para>
1080The innocent cd /usr command can be done by using more primitive
1081EXT2ED commands in the following way (It is implemented exactly this way):
1082
1083<OrderedList>
1084<ListItem>
1085
1086<Para>
1087	Using <Command>group 0</Command> to go to the first group descriptor.
1088</Para>
1089</ListItem>
1090<ListItem>
1091
1092<Para>
1093	Using <Command>inode</Command> to get to the Bad blocks inode.
1094</Para>
1095</ListItem>
1096<ListItem>
1097
1098<Para>
1099	Using <Command>next</Command> to pass to the root directory inode.
1100</Para>
1101</ListItem>
1102<ListItem>
1103
1104<Para>
1105	Using <Command>dir</Command> to see the directory.
1106</Para>
1107</ListItem>
1108<ListItem>
1109
1110<Para>
1111	Using <Command>next</Command> until we find the directory usr.
1112</Para>
1113</ListItem>
1114<ListItem>
1115
1116<Para>
1117	Using <Command>followinode</Command> to pass to the inode corresponding to usr.
1118</Para>
1119</ListItem>
1120<ListItem>
1121
1122<Para>
1123	Using <Command>dir</Command> to see the directory of /usr.
1124</Para>
1125</ListItem>
1126
1127</OrderedList>
1128
1129And those commands aren't that primitive; For example, the tracing of the
1130blocks which belong to the root directory is done automatically by the dir
1131command behind the scenes, and the followinode command will automatically
1132"run" to the correct group descriptor in order to find the required inode.
1133</Para>
1134
1135<Para>
1136The path to the <Command>general cd</Command> command needs to be a full pathname -
1137Starting from <Filename>/</Filename>. The <Command>cd</Command> command stops at the last reachable
1138point, which can be a directory entry, in which case the type will be set to
1139<Literal remap="tt">dir</Literal>, or an inode, in which case the type will be set to
1140<Literal remap="tt">ext2&lowbar;inode</Literal>. Symbolic links (Only fast symbolic links, meanwhile) are
1141automatically followed (if they are not across filesystems, of-course). If
1142the type is set to <Literal remap="tt">dir</Literal>, you can use a path relative to the
1143"current directory".
1144</Para>
1145
1146</Sect2>
1147
1148</Sect1>
1149
1150<Sect1>
1151<Title>The superblock</Title>
1152
1153<Para>
1154The superblock can always be reached by the ext2 general command
1155<Command>super</Command>. Cross reference section <XRef LinkEnd="general-superblock">.
1156</Para>
1157
1158<Para>
1159The status window will show you which copy of the superblock copies you are
1160currently editing.
1161</Para>
1162
1163<Para>
1164The main data window will show you the values of the various superblock
1165variables, along with some interpretation of the values.
1166</Para>
1167
1168<Para>
1169Data can be changed with the <Command>set</Command> and <Command>writedata</Command> commands.
1170
1171<Screen>
1172For example, set s_r_blocks_count=1400 will reserve 1400 blocks for root.
1173</Screen>
1174
1175</Para>
1176
1177<Sect2>
1178<Title>gocopy</Title>
1179
1180<Para>
1181
1182<Screen>
1183Syntax: gocopy number
1184</Screen>
1185
1186The <Command>gocopy</Command> command will "bring you" to the backup copy <Emphasis>number</Emphasis>
1187of the superblock copies. <Command>gocopy 0</Command>, for example, will bring you to
1188the main copy.
1189</Para>
1190
1191</Sect2>
1192
1193<Sect2>
1194<Title>setactivecopy</Title>
1195
1196<Para>
1197
1198<Screen>
1199Syntax: setactivecopy
1200</Screen>
1201
1202The <Command>setactivecopy</Command> command will copy the contents of the current
1203superblock copy onto the contents of the main copy. It will also switch to
1204editing of the main copy. No actual data is written to disk, of-course,
1205until you issue the <Command>writedata</Command> command.
1206</Para>
1207
1208</Sect2>
1209
1210</Sect1>
1211
1212<Sect1>
1213<Title>The group descriptors</Title>
1214
1215<Para>
1216The group descriptors can be edited by the <Command>group</Command> command.
1217</Para>
1218
1219<Para>
1220The status window will indicate the current group descriptor, the total
1221number of group descriptors (and hence of group blocks), and the backup copy
1222number.
1223</Para>
1224
1225<Para>
1226The main data window will just show you the values of the various variables.
1227</Para>
1228
1229<Para>
1230Basically, you can use the <Command>next</Command> and <Command>prev</Command> commands, along with the
1231<Command>set</Command> command, to modify the group descriptors.
1232</Para>
1233
1234<Para>
1235The group descriptors object is a junction, from which you can reach:
1236
1237<ItemizedList>
1238<ListItem>
1239
1240<Para>
1241	The inode table of the corresponding block group (the <Literal remap="tt">inode</Literal>
1242command)
1243</Para>
1244</ListItem>
1245<ListItem>
1246
1247<Para>
1248	The block allocation bitmap (the <Literal remap="tt">blockbitmap</Literal> command)
1249</Para>
1250</ListItem>
1251<ListItem>
1252
1253<Para>
1254	The inode allocation bitmap (the <Literal remap="tt">inodebitmap</Literal> command)
1255</Para>
1256</ListItem>
1257
1258</ItemizedList>
1259
1260</Para>
1261
1262<Sect2>
1263<Title>blockbitmap</Title>
1264
1265<Para>
1266
1267<Screen>
1268Syntax: blockbitmap
1269</Screen>
1270
1271The <Command>blockbitmap</Command> command will let you edit the block bitmap allocation
1272block of the current group block.
1273</Para>
1274
1275</Sect2>
1276
1277<Sect2>
1278<Title>entry</Title>
1279
1280<Para>
1281
1282<Screen>
1283Syntax: entry number
1284</Screen>
1285
1286The <Command>entry</Command> command will move you to the <Emphasis>number</Emphasis> group descriptor in the
1287group descriptors table.
1288</Para>
1289
1290</Sect2>
1291
1292<Sect2>
1293<Title>inode</Title>
1294
1295<Para>
1296
1297<Screen>
1298Syntax: inode
1299</Screen>
1300
1301The <Command>inode</Command> command will pass you to the first inode in the current
1302group block.
1303</Para>
1304
1305</Sect2>
1306
1307<Sect2>
1308<Title>inodebitmap</Title>
1309
1310<Para>
1311
1312<Screen>
1313Syntax: inodebitmap
1314</Screen>
1315
1316The <Command>inodebitmap</Command> command will let you edit the inode bitmap allocation
1317block of the current group block.
1318</Para>
1319
1320</Sect2>
1321
1322<Sect2>
1323<Title>next</Title>
1324
1325<Para>
1326
1327<Screen>
1328Syntax: next [number]
1329</Screen>
1330
1331The <Command>next</Command> command will pass to the next <Emphasis>number</Emphasis> group
1332descriptor. If <Emphasis>number</Emphasis> is omitted, <Emphasis>number=1</Emphasis> is assumed.
1333</Para>
1334
1335</Sect2>
1336
1337<Sect2>
1338<Title>prev</Title>
1339
1340<Para>
1341
1342<Screen>
1343Syntax: prev [number]
1344</Screen>
1345
1346The <Command>prev</Command> command will pass to the previous <Emphasis>number</Emphasis> group
1347descriptor. If <Emphasis>number</Emphasis> is omitted, <Emphasis>number=1</Emphasis> is assumed.
1348</Para>
1349
1350</Sect2>
1351
1352<Sect2>
1353<Title>setactivecopy</Title>
1354
1355<Para>
1356
1357<Screen>
1358Syntax: setactivecopy
1359</Screen>
1360
1361The <Command>setactivecopy</Command> command copies the contents of the current group
1362descriptor, to its main copy. The updated main copy will then be shown. No
1363actual change is made to the disk until you issue the <Command>writedata</Command>
1364command.
1365</Para>
1366
1367</Sect2>
1368
1369</Sect1>
1370
1371<Sect1>
1372<Title>The inode</Title>
1373
1374<Para>
1375An inode can be reached by the following two ways:
1376
1377<ItemizedList>
1378<ListItem>
1379
1380<Para>
1381	Using <Command>inode</Command> from the corresponding group descriptor.
1382</Para>
1383</ListItem>
1384<ListItem>
1385
1386<Para>
1387	Using <Command>followinode</Command> from a directory entry.
1388</Para>
1389</ListItem>
1390<ListItem>
1391
1392<Para>
1393	Using the <Command>cd</Command> command with the pathname to the file.
1394
1395For example, <Command>cd /usr/src/ext2ed/ext2ed.h</Command>
1396</Para>
1397</ListItem>
1398
1399</ItemizedList>
1400
1401</Para>
1402
1403<Para>
1404The status window will indicate:
1405
1406<ItemizedList>
1407<ListItem>
1408
1409<Para>
1410	The current global inode number.
1411</Para>
1412</ListItem>
1413<ListItem>
1414
1415<Para>
1416	The total total number of inodes.
1417</Para>
1418</ListItem>
1419<ListItem>
1420
1421<Para>
1422	On which block group the inode is allocated.
1423</Para>
1424</ListItem>
1425<ListItem>
1426
1427<Para>
1428	The total number of inodes in this group block.
1429</Para>
1430</ListItem>
1431<ListItem>
1432
1433<Para>
1434	The index of the current inode in the current group block.
1435</Para>
1436</ListItem>
1437<ListItem>
1438
1439<Para>
1440	The type of the inode (file, directory, special, etc).
1441</Para>
1442</ListItem>
1443
1444</ItemizedList>
1445
1446</Para>
1447
1448<Para>
1449The main data window, in addition to the list of variables, will contain
1450some interpretations on the right side.
1451</Para>
1452
1453<Para>
1454If the inode corresponds to a file, you can use the <Command>file</Command> command to
1455edit the file.
1456</Para>
1457
1458<Para>
1459If the inode is an inode of a directory, you can use the <Command>dir</Command> command
1460to edit the directory.
1461</Para>
1462
1463<Sect2>
1464<Title>dir</Title>
1465
1466<Para>
1467
1468<Screen>
1469Syntax: dir
1470</Screen>
1471
1472If the inode mode corresponds to a directory (shown on the status window),
1473you can enter directory mode editing by using <Literal remap="tt">dir</Literal>.
1474</Para>
1475
1476</Sect2>
1477
1478<Sect2>
1479<Title>entry</Title>
1480
1481<Para>
1482
1483<Screen>
1484Syntax: entry number
1485</Screen>
1486
1487The <Command>entry</Command> command will move you to the <Emphasis>number</Emphasis> inode in the
1488current inode table.
1489</Para>
1490
1491</Sect2>
1492
1493<Sect2>
1494<Title>file</Title>
1495
1496<Para>
1497
1498<Screen>
1499Syntax: file
1500</Screen>
1501
1502If the inode mode corresponds to a file (shown on the status window),
1503you can enter file mode editing by using <Command>file</Command>.
1504</Para>
1505
1506</Sect2>
1507
1508<Sect2>
1509<Title>group</Title>
1510
1511<Para>
1512
1513<Screen>
1514Syntax: group
1515</Screen>
1516
1517The <Command>group</Command> command is used to go to the group descriptor of the
1518current group block.
1519</Para>
1520
1521</Sect2>
1522
1523<Sect2>
1524<Title>next</Title>
1525
1526<Para>
1527
1528<Screen>
1529Syntax: next [number]
1530</Screen>
1531
1532The <Command>next</Command> command will pass to the next <Emphasis>number</Emphasis> inode.
1533If <Emphasis>number</Emphasis> is omitted, <Emphasis>number=1</Emphasis> is assumed.
1534</Para>
1535
1536</Sect2>
1537
1538<Sect2>
1539<Title>prev</Title>
1540
1541<Para>
1542
1543<Screen>
1544Syntax: prev [number]
1545</Screen>
1546
1547The <Command>prev</Command> command will pass to the previous <Emphasis>number</Emphasis> inode.
1548If <Emphasis>number</Emphasis> is omitted, <Emphasis>number=1</Emphasis> is assumed.
1549</Para>
1550
1551</Sect2>
1552
1553</Sect1>
1554
1555<Sect1>
1556<Title>The file</Title>
1557
1558<Para>
1559When editing a file, EXT2ED offers you a both a continuous and a true
1560fragmented view of the file - The file is still shown block by block with
1561the true block number at each stage and EXT2ED offers you commands which
1562allow you to move between the <Literal remap="tt">file blocks</Literal>, while finding the
1563allocated blocks by using the inode information behind the scenes.
1564</Para>
1565
1566<Para>
1567Aside from this, the editing is just a <Literal remap="tt">hex editing</Literal> - You move the
1568cursor in the current block of the file by using <Command>next</Command> and
1569<Command>prev</Command>, move between blocks by <Command>nextblock</Command> and <Command>prevblock</Command>,
1570and make changes by the <Command>set</Command> command. Note that the set command is
1571overridden here - There are no variables. The <Command>writedata</Command> command will
1572update the current block to the disk.
1573</Para>
1574
1575<Para>
1576Reaching a file can be done by using the <Command>file</Command> command from its inode.
1577The inode can be reached by any other means, for example, by the
1578<Command>cd</Command> command, if you know the file name.
1579</Para>
1580
1581<Para>
1582The status window will indicate:
1583
1584<ItemizedList>
1585<ListItem>
1586
1587<Para>
1588	The global block number.
1589</Para>
1590</ListItem>
1591<ListItem>
1592
1593<Para>
1594	The internal file block number.
1595</Para>
1596</ListItem>
1597<ListItem>
1598
1599<Para>
1600	The file offset.
1601</Para>
1602</ListItem>
1603<ListItem>
1604
1605<Para>
1606	The file size.
1607</Para>
1608</ListItem>
1609<ListItem>
1610
1611<Para>
1612	The file inode number.
1613</Para>
1614</ListItem>
1615<ListItem>
1616
1617<Para>
1618	The indirection level - Whether it is a direct block (0), indirect
1619(1), etc.
1620</Para>
1621</ListItem>
1622
1623</ItemizedList>
1624
1625</Para>
1626
1627<Para>
1628The main data window will display the file either in hex mode or in text
1629mode, select-able by the <Command>display</Command> command.
1630</Para>
1631
1632<Para>
1633In hex mode, EXT2ED will display offsets in the current block, along with a
1634text and hex dump of the current block.
1635</Para>
1636
1637<Para>
1638In either case the <Literal remap="tt">current place</Literal> will be highlighted. In the hex mode
1639it will be always highlighted, while in the text mode it will be highlighted
1640if the character is display-able.
1641</Para>
1642
1643<Sect2>
1644<Title>block</Title>
1645
1646<Para>
1647
1648<Screen>
1649Syntax: block block_num
1650</Screen>
1651
1652The <Command>block</Command> command is used to move inside the file. The
1653<Emphasis>block&lowbar;num</Emphasis> argument is the requested internal file block number. A
1654value of 0 will reach the beginning of the file.
1655</Para>
1656
1657</Sect2>
1658
1659<Sect2>
1660<Title>display</Title>
1661
1662<Para>
1663
1664<Screen>
1665Syntax: display [text || hex]
1666</Screen>
1667
1668The <Command>display</Command> command changes the display mode of the file.
1669<Command>display
1670hex</Command> will switch to <Command>hex mode</Command>, while <Command>display text</Command> will switch
1671to text mode. The default mode when no <Command>display</Command> command is issued is
1672<Command>hex mode</Command>.
1673</Para>
1674
1675</Sect2>
1676
1677<Sect2>
1678<Title>inode</Title>
1679
1680<Para>
1681
1682<Screen>
1683Syntax: inode
1684</Screen>
1685
1686The <Command>inode</Command> command will return to the inode of the current file.
1687</Para>
1688
1689</Sect2>
1690
1691<Sect2>
1692<Title>next</Title>
1693
1694<Para>
1695
1696<Screen>
1697Syntax: next [num]
1698</Screen>
1699
1700The <Command>next</Command> command will pass to the next byte in the file. If
1701<Emphasis>num</Emphasis> is supplied, it will pass to the next <Emphasis>num</Emphasis> bytes.
1702</Para>
1703
1704</Sect2>
1705
1706<Sect2>
1707<Title>nextblock</Title>
1708
1709<Para>
1710
1711<Screen>
1712Syntax: nextblock [num]
1713</Screen>
1714
1715The <Command>nextblock</Command> command will pass to the next block in the file. If
1716<Emphasis>num</Emphasis> is supplied, it will pass to the next <Emphasis>num</Emphasis> blocks.
1717</Para>
1718
1719</Sect2>
1720
1721<Sect2>
1722<Title>prev</Title>
1723
1724<Para>
1725
1726<Screen>
1727Syntax: prev [num]
1728</Screen>
1729
1730The <Command>prev</Command> command will pass to the previous byte in the file. If
1731<Emphasis>num</Emphasis> is supplied, it will pass to the previous <Emphasis>num</Emphasis> bytes.
1732</Para>
1733
1734</Sect2>
1735
1736<Sect2>
1737<Title>prevblock</Title>
1738
1739<Para>
1740
1741<Screen>
1742Syntax: prevblock [num]
1743</Screen>
1744
1745The <Command>nextblock</Command> command will pass to the previous block in the file. If
1746<Emphasis>num</Emphasis> is supplied, it will pass to the previous <Emphasis>num</Emphasis> blocks.
1747</Para>
1748
1749</Sect2>
1750
1751<Sect2>
1752<Title>offset</Title>
1753
1754<Para>
1755
1756<Screen>
1757Syntax: offset file_offset
1758</Screen>
1759
1760The <Command>offset</Command> command will move to the specified offset in the file.
1761</Para>
1762
1763</Sect2>
1764
1765<Sect2>
1766<Title>set</Title>
1767
1768<Para>
1769
1770<Screen>
1771Syntax: set [text || hex] arg1 [arg2 arg3 ...]
1772</Screen>
1773
1774The <Command>file set</Command> command is working like the <Literal remap="tt">general set command</Literal>,
1775with <Literal remap="tt">type=none</Literal>. There are no variables.
1776</Para>
1777
1778</Sect2>
1779
1780<Sect2>
1781<Title>writedata</Title>
1782
1783<Para>
1784
1785<Screen>
1786Syntax: writedata
1787</Screen>
1788
1789The <Command>writedata</Command> command will update the current file block in the disk.
1790</Para>
1791
1792</Sect2>
1793
1794</Sect1>
1795
1796<Sect1>
1797<Title>The directory</Title>
1798
1799<Para>
1800When editing a file, EXT2ED analyzes for you both the allocation blocks of
1801the directory entries, and the directory entries.
1802</Para>
1803
1804<Para>
1805Each directory entry is displayed on one row. You can move the highlighted
1806entry with the usual <Command>next</Command> and <Command>prev</Command> commands, and "dive in"
1807with the <Command>followinode</Command> command.
1808</Para>
1809
1810<Para>
1811The status window will indicate:
1812
1813<ItemizedList>
1814<ListItem>
1815
1816<Para>
1817	The directory entry number.
1818</Para>
1819</ListItem>
1820<ListItem>
1821
1822<Para>
1823	The total number of directory entries in this directory.
1824</Para>
1825</ListItem>
1826<ListItem>
1827
1828<Para>
1829	The current global block number.
1830</Para>
1831</ListItem>
1832<ListItem>
1833
1834<Para>
1835	The current offset in the entire directory - When viewing the
1836directory as a continuous file.
1837</Para>
1838</ListItem>
1839<ListItem>
1840
1841<Para>
1842	The inode number of the directory itself.
1843</Para>
1844</ListItem>
1845<ListItem>
1846
1847<Para>
1848	The indirection level - Whether it is a direct block (0), indirect
1849(1), etc.
1850</Para>
1851</ListItem>
1852
1853</ItemizedList>
1854
1855</Para>
1856
1857<Sect2>
1858<Title>cd</Title>
1859
1860<Para>
1861
1862<Screen>
1863Syntax: cd [path]
1864</Screen>
1865
1866The <Command>cd</Command> command is used in the usual meaning, like the global cd
1867command.
1868
1869<ItemizedList>
1870<ListItem>
1871
1872<Para>
1873	If <Emphasis>path</Emphasis> is not specified, the current directory entry is
1874followed.
1875</Para>
1876</ListItem>
1877<ListItem>
1878
1879<Para>
1880	<Emphasis>path</Emphasis> can be relative to the current directory.
1881</Para>
1882</ListItem>
1883<ListItem>
1884
1885<Para>
1886	<Emphasis>path</Emphasis> can also end up in a file, in which case the file inode
1887will be reached.
1888</Para>
1889</ListItem>
1890<ListItem>
1891
1892<Para>
1893	Symbolic link (fast only, meanwhile) is automatically followed.
1894</Para>
1895</ListItem>
1896
1897</ItemizedList>
1898
1899</Para>
1900
1901</Sect2>
1902
1903<Sect2>
1904<Title>entry</Title>
1905
1906<Para>
1907
1908<Screen>
1909Syntax: entry [entry_num]
1910</Screen>
1911
1912The <Command>entry</Command> command sets <Emphasis>entry&lowbar;num</Emphasis> as the current directory
1913entry.
1914</Para>
1915
1916</Sect2>
1917
1918<Sect2>
1919<Title>followinode</Title>
1920
1921<Para>
1922
1923<Screen>
1924Syntax: followinode
1925</Screen>
1926
1927The <Command>followinode</Command> command will move you to the inode pointed by the
1928current directory entry.
1929</Para>
1930
1931</Sect2>
1932
1933<Sect2>
1934<Title>inode</Title>
1935
1936<Para>
1937
1938<Screen>
1939Syntax: inode
1940</Screen>
1941
1942The <Command>inode</Command> command will return you to the parent inode of the whole
1943directory listing.
1944</Para>
1945
1946</Sect2>
1947
1948<Sect2>
1949<Title>next</Title>
1950
1951<Para>
1952
1953<Screen>
1954Syntax: next [num]
1955</Screen>
1956
1957The <Command>next</Command> command will pass to the next directory entry.
1958If <Emphasis>num</Emphasis> is supplied, it will pass to the next <Emphasis>num</Emphasis> entries.
1959</Para>
1960
1961</Sect2>
1962
1963<Sect2>
1964<Title>prev</Title>
1965
1966<Para>
1967
1968<Screen>
1969Syntax: prev [num]
1970</Screen>
1971
1972The <Command>prev</Command> command will pass to the previous directory entry.
1973If <Emphasis>num</Emphasis> is supplied, it will pass to the previous <Emphasis>num</Emphasis> entries.
1974</Para>
1975
1976</Sect2>
1977
1978<Sect2>
1979<Title>writedata</Title>
1980
1981<Para>
1982
1983<Screen>
1984Syntax: writedata
1985</Screen>
1986
1987The <Command>writedata</Command> command will write the current directory entry to the
1988disk.
1989</Para>
1990
1991</Sect2>
1992
1993</Sect1>
1994
1995<Sect1 id="block-bitmap">
1996<Title>The block allocation bitmap</Title>
1997
1998<Para>
1999The <Literal remap="tt">block allocation bitmap</Literal> of any block group can be reached from
2000the corresponding group descriptor.
2001</Para>
2002
2003<Para>
2004You will be offered a bit listing of the entire blocks in the group. The
2005current block will be highlighted and its number will be displayed in the
2006status window.
2007</Para>
2008
2009<Para>
2010A value of "1" means that the block is allocated, while a value of "0"
2011signals that it is free. The value is also interpreted in the status
2012window. You can use the usual <Command>next/prev</Command> commands, along with the
2013<Command>allocate/deallocate</Command> commands.
2014</Para>
2015
2016<Sect2>
2017<Title>allocate</Title>
2018
2019<Para>
2020
2021<Screen>
2022Syntax: allocate [num]
2023</Screen>
2024
2025The <Command>allocate</Command> command allocates <Emphasis>num</Emphasis> blocks, starting from the
2026highlighted position. If <Emphasis>num</Emphasis> is not specified, <Emphasis>num=1</Emphasis> is assumed.
2027Of-course, no actual change is made until you issue a <Command>writedata</Command> command.
2028</Para>
2029
2030</Sect2>
2031
2032<Sect2>
2033<Title>deallocate</Title>
2034
2035<Para>
2036
2037<Screen>
2038Syntax: deallocate [num]
2039</Screen>
2040
2041The <Command>deallocate</Command> command deallocates <Emphasis>num</Emphasis> blocks, starting from the
2042highlighted position. If <Emphasis>num</Emphasis> is not specified, <Emphasis>num=1</Emphasis> is assumed.
2043Of-course, no actual change is made until you issue a <Command>writedata</Command> command.
2044</Para>
2045
2046</Sect2>
2047
2048<Sect2>
2049<Title>entry</Title>
2050
2051<Para>
2052
2053<Screen>
2054Syntax: entry [entry_num]
2055</Screen>
2056
2057The <Command>entry</Command> command sets the current highlighted block to
2058<Emphasis>entry&lowbar;num</Emphasis>.
2059</Para>
2060
2061</Sect2>
2062
2063<Sect2>
2064<Title>next</Title>
2065
2066<Para>
2067
2068<Screen>
2069Syntax: next [num]
2070</Screen>
2071
2072The <Command>next</Command> command will pass to the next bit, which corresponds to the
2073next block. If <Emphasis>num</Emphasis> is supplied, it will pass to the next <Emphasis>num</Emphasis>
2074bits.
2075</Para>
2076
2077</Sect2>
2078
2079<Sect2>
2080<Title>prev</Title>
2081
2082<Para>
2083
2084<Screen>
2085Syntax: prev [num]
2086</Screen>
2087
2088The <Command>prev</Command> command will pass to the previous bit, which corresponds to the
2089previous block. If <Emphasis>num</Emphasis> is supplied, it will pass to the previous
2090<Emphasis>num</Emphasis> bits.
2091</Para>
2092
2093</Sect2>
2094
2095</Sect1>
2096
2097<Sect1>
2098<Title>The inode allocation bitmap</Title>
2099
2100<Para>
2101The <Literal remap="tt">inode allocation bitmap</Literal> is very similar to the block allocation
2102bitmap explained above. It is also reached from the corresponding group
2103descriptor. Please refer to section <XRef LinkEnd="block-bitmap">.
2104</Para>
2105
2106</Sect1>
2107
2108<Sect1>
2109<Title>Filesystem size limitation</Title>
2110
2111<Para>
2112While an ext2 filesystem has a size limit of <Literal remap="tt">4 TB</Literal>, EXT2ED currently
2113<Literal remap="tt">can't</Literal> handle filesystems which are <Literal remap="tt">bigger than 2 GB</Literal>.
2114</Para>
2115
2116<Para>
2117I am sorry for the inconvenience. This will hopefully be fixed in future
2118releases.
2119</Para>
2120
2121</Sect1>
2122
2123<Sect1>
2124<Title>Copyright</Title>
2125
2126<Para>
2127EXT2ED is Copyright (C) 1995 Gadi Oxman.
2128</Para>
2129
2130<Para>
2131EXT2ED is hereby placed under the GPL - Gnu Public License. You are free and
2132welcome to copy, view and modify the sources. My only wish is that my
2133copyright presented above will be left and that a list of the bug fixes,
2134added features, etc, will be provided.
2135</Para>
2136
2137<Para>
2138The entire EXT2ED project is based, of-course, on the kernel sources. The
2139<Literal remap="tt">ext2.descriptors</Literal> distributed with EXT2ED is a slightly modified
2140version of the main ext2 include file, /usr/include/linux/ext2&lowbar;fs.h. Follows
2141the original copyright:
2142</Para>
2143
2144<Para>
2145
2146<Screen>
2147/*
2148 *  linux/include/linux/ext2_fs.h
2149 *
2150 * Copyright (C) 1992, 1993, 1994, 1995
2151 * Remy Card (card@masi.ibp.fr)
2152 * Laboratoire MASI - Institut Blaise Pascal
2153 * Universite Pierre et Marie Curie (Paris VI)
2154 *
2155 *  from
2156 *
2157 *  linux/include/linux/minix_fs.h
2158 *
2159 *  Copyright (C) 1991, 1992  Linus Torvalds
2160 */
2161
2162</Screen>
2163
2164</Para>
2165
2166</Sect1>
2167
2168<Sect1>
2169<Title>Acknowledgments</Title>
2170
2171<Para>
2172EXT2ED was constructed as a student project in the software
2173laboratory of the faculty of electrical-engineering in the
2174<Literal remap="tt">Technion - Israel's institute of technology</Literal>.
2175</Para>
2176
2177<Para>
2178At first, I would like to thank <PersonName><FirstName>Avner</FirstName> <SurName>Lottem</SurName></PersonName> and <PersonName><Honorific>Doctor</Honorific> <FirstName>Ilana</FirstName> <SurName>David</Surname></PersonName> for their interest and assistance in this project.
2179</Para>
2180
2181<Para>
2182I would also like to thank the following people, who were involved in the
2183design and implementation of the ext2 filesystem kernel code and support
2184utilities:
2185
2186<ItemizedList>
2187<ListItem>
2188
2189<Para>
2190<PersonName><FirstName>Remy</FirstName> <SurName>Card</SurName></PersonName>
2191
2192Who designed, implemented and maintains the ext2 filesystem kernel
2193code, and some of the ext2 utilities. Remy Card is also the author
2194of several helpful slides concerning the ext2 filesystem.
2195Specifically, he is the author of <Literal remap="tt">File Management in the Linux
2196Kernel</Literal> and of <Literal remap="tt">The Second Extended File System - Current State,
2197Future Development</Literal>.
2198
2199</Para>
2200</ListItem>
2201<ListItem>
2202
2203<Para>
2204<PersonName><FirstName>Wayne</FirstName> <SurName>Davison</SurName></PersonName>
2205
2206Who designed the ext2 filesystem.
2207</Para>
2208</ListItem>
2209<ListItem>
2210
2211<Para>
2212<PersonName><FirstName>Stephen</FirstName> <Surname>Tweedie</SurName></PersonName>
2213
2214Who helped designing the ext2 filesystem kernel code and wrote the
2215slides <Literal remap="tt">Optimizations in File Systems</Literal>.
2216</Para>
2217</ListItem>
2218<ListItem>
2219
2220<Para>
2221<PersonName><FirstName>Theodore</FirstName> <SurName>Ts'o</SurName></PersonName>
2222
2223Who is the author of several ext2 utilities and of the ext2 library
2224<Literal remap="tt">libext2fs</Literal> (which I didn't use, simply because I didn't know
2225it exists when I started to work on my project).
2226</Para>
2227</ListItem>
2228
2229</ItemizedList>
2230
2231</Para>
2232
2233<Para>
2234Lastly, I would like to thank, of-course, <PersonName><FirstName>Linus</FirstName> <SurName>Torvalds</SurName></PersonName> and the
2235Linux community for providing all of us with such a great operating
2236system.
2237</Para>
2238
2239<Para>
2240Please contact me in a case of bug report, suggestions, or just about
2241anything concerning EXT2ED.
2242</Para>
2243
2244<Para>
2245Enjoy,
2246</Para>
2247
2248<Para>
2249Gadi Oxman &lt;tgud@tochnapc2.technion.ac.il&gt;
2250</Para>
2251
2252<Para>
2253Haifa, August 95
2254</Para>
2255
2256</Sect1>
2257
2258</Article>
2259