Home | History | Annotate | Download | only in doc
      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 (a] tochnapc2.technion.ac.il</FirstName>
     10 </AUTHOR>
     11 <PubDate>v0.1, August 3 1995</PubDate>
     12 
     13 <Abstract>
     14 
     15 <Para>
     16 This is only the initial version of this document. It may be unclear at
     17 some 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>
     28 The 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>
     55 If you intend to used EXT2ED, I strongly suggest that you would be familiar
     56 with the material presented in the <Literal remap="tt">ext2 filesystem overview</Literal> as well.
     57 </Para>
     58 
     59 <Para>
     60 If you also intend to browse and modify the source code, I suggest that you
     61 will also read the article <Literal remap="tt">The EXT2ED design and implementation</Literal>, as it
     62 provides 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>
     71 EXT2ED is a "disk editor" for the ext2 filesystem. Its purpose is to show
     72 you the internal structures of the ext2 filesystem in an rather intuitive
     73 and logical way, so that it will be easier to "travel" between the various
     74 internal filesystem structures. 
     75 </Para>
     76 
     77 </Sect1>
     78 
     79 <Sect1>
     80 <Title>Basic concepts in EXT2ED</Title>
     81 
     82 <Para>
     83 Two basic concepts in EXT2ED are <Literal remap="tt">commands</Literal> and <Literal remap="tt">types</Literal>.
     84 </Para>
     85 
     86 <Para>
     87 EXT2ED is object-oriented in the sense that it defines objects in the
     88 filesystem, like a <Literal remap="tt">super-block</Literal> or a <Literal remap="tt">directory</Literal>. An object is
     89 something which "knows" how to handle some aspect of the filesystem.
     90 </Para>
     91 
     92 <Para>
     93 Your interaction with EXT2ED is done through <Literal remap="tt">commands</Literal> which EXT2ED
     94 accepts. 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 
    118 The General commands are always available.
    119 </Para>
    120 
    121 <Para>
    122 The ext2 general commands are available only when editing an ext2 filesystem.
    123 </Para>
    124 
    125 <Para>
    126 The Type specific commands are available when editing a specific object in the
    127 filesystem. Each object typically comes with its own set of internal
    128 variables, and its own set of commands, which are fine tuned handle the
    129 corresponding structure in the filesystem.
    130 </Para>
    131 
    132 </Sect1>
    133 
    134 <Sect1>
    135 <Title>Running EXT2ED</Title>
    136 
    137 <Para>
    138 Running EXT2ED is as simple as typing <Literal remap="tt">ext2ed</Literal> from the shell prompt.
    139 There are no command line switches.
    140 </Para>
    141 
    142 <Para>
    143 When first run, EXT2ED parses its configuration file, <Literal remap="tt">ext2ed.conf</Literal>.
    144 This file must exist.
    145 </Para>
    146 
    147 <Para>
    148 When the configuration file processing is done, EXT2ED screen should appear
    149 on 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>
    158 EXT2ED uses the <Emphasis>ncurses</Emphasis> library for screen management. Your screen
    159 will 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 
    189 The title window just displays the current version of EXT2ED.
    190 </Para>
    191 
    192 <Para>
    193 The status window will display various information regarding the state of
    194 the editing at this point.
    195 </Para>
    196 
    197 <Para>
    198 The main editing window is the place at which the actual data will be shown.
    199 Almost every command will cause some display at this window. This window, as
    200 opposed to the three others, is of variable length - You always look at one
    201 page of it. The current page and the total numbers of pages at this moment
    202 is displayed at the status window. Moving between pages is done by the use
    203 of the <Command>pgdn</Command> and <Command>pgup</Command> commands.
    204 </Para>
    205 
    206 <Para>
    207 The command window is at the bottom of the screen. It always displays a
    208 command prompt <Literal remap="tt">ext2ed&#62;</Literal> and allows you to type a command. Feedback
    209 about the commands entered is displayed to this window also.
    210 </Para>
    211 
    212 <Para>
    213 EXT2ED uses the <Emphasis>readline</Emphasis> library while processing a command line. All
    214 the usual editing keys are available. Each entered command is placed into a
    215 history of commands, and can be recalled later. Command Completion is also
    216 supported - Just start to type a command, and press the completion key.
    217 </Para>
    218 
    219 <Para>
    220 Pressing <Literal remap="tt">enter</Literal> at the command window, without entering a command,
    221 recalls the last command. This is useful when moving between close entries,
    222 in 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>
    234 EXT2ED 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>
    243 EXT2ED is not designed to work on a mounted filesystem - It is complicated
    244 enough as it is; I didn't even try to think of handling the various race
    245 conditions. 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>
    253 EXT2ED will not allow write access to a mounted filesystem. Although it is
    254 fairly easy to change EXT2ED so that it will be allowed, I hereby request
    255 again- EXT2ED is not designed for that action, and will most likely corrupt
    256 data if used that way. Please don't do that.
    257 </Para>
    258 
    259 <Para>
    260 Concerning read access, I chose to leave the decision for the user through
    261 the configuration file option <Literal remap="tt">AllowMountedRead</Literal>. Although read access
    262 on a mounted partition will not do any damage to the filesystem, the data
    263 displayed to you will not be reliable, and showing you incorrect information
    264 may be as bad as corrupting the filesystem. However, you may still wish to
    265 do that.
    266 </Para>
    267 
    268 </Sect3>
    269 
    270 <Sect3>
    271 <Title>Write access</Title>
    272 
    273 <Para>
    274 Considering the obvious sensitivity of the subject, I took the following
    275 actions:
    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
    285 needs to be specifically entered by the <Command>enablewrite</Command> command.
    286 Until this is done, no write will be allowed. Write access can be
    287 disabled at any time with <Command>disablewrite</Command>. When
    288 <Command>enablewrite</Command> is issued, the device is reopened in read-write
    289 mode. 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
    296 the configuration file by using the <Literal remap="tt">AllowChanges off</Literal>
    297 configuration option. In this case, the <Command>enablewrite</Command> command
    298 will be refused.
    299 </Para>
    300 </ListItem>
    301 <ListItem>
    302 
    303 <Para>
    304 	When write access is enabled, the data will never change
    305 immediately. Rather, a specific <Command>writedata</Command> command is needed
    306 to 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
    313 file options <Literal remap="tt">LogChanges</Literal> and <Literal remap="tt">LogFile</Literal>. With logging
    314 enabled, each change to the disk will be logged at a very primitive
    315 level - A hex dump of the original data and of the new written data.
    316 The log file will be a text file which is easily readable, and you
    317 can make use of it to undo any changes which you made (EXT2ED doesn't
    318 make use of the log file for that purpose, it just logs the changes).
    319 </Para>
    320 </ListItem>
    321 
    322 </OrderedList>
    323 
    324 Please remember that this is only the initial release of EXT2ED, and it is
    325 not very much tested - It is reasonable to assume that <Literal remap="tt">there are
    326 bugs</Literal>.
    327 However, the logging option above can offer protection even from this
    328 unfortunate case. Therefor, I highly recommend that at least when first
    329 working with EXT2ED, the logging option will be enabled, despite the disk
    330 space 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>
    341 When loaded, EXT2ED will show a short help screen. This help screen can
    342 always be retrieved by the command <Command>help</Command>. The help screen displays a
    343 list of all the commands which are available at this point. At startup, only
    344 the <Literal remap="tt">General commands</Literal> are available.
    345 This will change with time, since each object has its own commands. Thus,
    346 commands which are available now may not be available later.
    347 Using <Command>help</Command> <Emphasis>command</Emphasis> will display additional information about
    348 the 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>
    357 The first command that is usually entered to EXT2ED is the <Command>setdevice</Command>
    358 command. This command simply tells EXT2ED on which device the filesystem is
    359 present. For example, suppose my ext2 filesystem is on the first partition
    360 of my ide disk. The command will be:
    361 
    362 <Screen>
    363 setdevice /dev/hda1
    364 </Screen>
    365 
    366 The 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.
    373 If the partition is mounted (<Literal remap="tt">highly not recommended</Literal>),
    374 the accept/reject behavior will be decided by the configuration
    375 file. 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
    382 permissions of the device should be set in a way that allows
    383 you 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
    390 the 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
    397 ext2 filesystem specific commands and the ext2 specific object
    398 definitions will be registered. The object definitions will be read
    399 at run time from a file specified by the configuration file.
    400 
    401 In case of a corrupted ext2 filesystem, it is quite possible that
    402 the main superblock is damaged and autodetection will fail. In that
    403 case, use the configuration option <Literal remap="tt">ForceExt2 on</Literal>. This is not
    404 the default case since EXT2ED can be used at a lower level to edit a
    405 non-ext2 filesystem.
    406 </Para>
    407 </ListItem>
    408 <ListItem>
    409 
    410 <Para>
    411 	In a case of a successful autodetection, essential information about
    412 the filesystem such as the block size will be read from the
    413 superblock, unless the used overrides this behavior with an
    414 configuration option (not recommended). In that case, the parameters
    415 will be read from the configuration file.
    416 
    417 In a case of an autodetection failure, the essential parameters
    418 will be read from the configuration file.
    419 </Para>
    420 </ListItem>
    421 
    422 </OrderedList>
    423 
    424 Assuming that you are editing an ext2 filesystem and that everything goes
    425 well, you will notice that additional commands are now available in the help
    426 screen, under the section <Literal remap="tt">ext2 filesystem general commands</Literal>. In
    427 addition, EXT2ED now recognizes a few objects which are essential to the
    428 editing 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>
    442 This section explains what EXT2ED provides even when not editing an ext2
    443 filesystem.
    444 </Para>
    445 
    446 <Para>
    447 Even at this level, EXT2ED is more than just a hex editor. It still allows
    448 definition of objects and variables in run time through a user file,
    449 although of-course the objects will not have special fine tuned functions
    450 connected 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
    452 using <Command>settype</Command> <Emphasis>type</Emphasis>. From this point and on, the object will
    453 be shown <Literal remap="tt">in its native form</Literal> - You will see a list of the
    454 variables rather than just a hex dump, and you will be able to change each
    455 variable in the intuitive form <Command>set variable=value</Command>.
    456 </Para>
    457 
    458 <Para>
    459 To define objects, use the configuration option <Literal remap="tt">AlternateDescriptors</Literal>.
    460 </Para>
    461 
    462 <Para>
    463 There 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
    470 as 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
    477 shown, 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>
    491 EXT2ED was designed for the editing of the ext2 filesystem. As such, it
    492 "understands" the filesystem structure to some extent. Each object now has
    493 special fine tuned 'C' functions connected to it, which knows how to display
    494 it in an intuitive form, and how the object fits in the general design of
    495 the ext2 filesystem. It is of-course much easier to use this type of
    496 editing. For example:
    497 
    498 <Screen>
    499 Issue <Emphasis>group 2</Emphasis> to look at the main copy of the third group block
    500 descriptor. With <Emphasis>gocopy 1</Emphasis> you can move to its first backup copy,
    501 and with <Emphasis>inode</Emphasis> you can start editing the inode table of the above
    502 group block. From here, if the inode corresponds to a file, you can
    503 use <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
    505 itself the direct blocks, indirect blocks, ..., while still preserving the
    506 actual view of the exact block usage of the file.
    507 </Screen>
    508 
    509 The point is that the "tour" of the filesystem will now be synchronic rather
    510 than asynchronic - Each object has the "links" to pass between connected
    511 logical 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>
    522 I will now start with a systematic explanation of the general commands.
    523 Please feel free to experiment, but take care when using the
    524 <Literal remap="tt">enablewrite</Literal> command.
    525 </Para>
    526 
    527 <Para>
    528 Whenever a command syntax is specified, arguments which are optional are
    529 enclosed with square brackets.
    530 </Para>
    531 
    532 <Para>
    533 Please note that in EXT2ED, each command can be overridden by a specific
    534 object to provide special fine-tuned functionality. In general, I was
    535 attempting to preserve the similarity between those functions, which are
    536 accessible by the same name.
    537 </Para>
    538 
    539 <Sect2 id="disablewrite-ref">
    540 <Title>disablewrite</Title>
    541 
    542 <Para>
    543 
    544 <Screen>
    545 Syntax: disablewrite
    546 </Screen>
    547 
    548 <Command>disablewrite</Command> is used to reopen the device with read-only access. When
    549 first running EXT2ED, the device is opened in read-only mode, and an
    550 explicit <Command>enablewrite</Command> is required for write access. When finishing
    551 with changing, a <Command>disablewrite</Command> is recommended for safety. Cross
    552 reference 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>
    563 Syntax: enablewrite
    564 </Screen>
    565 
    566 <Command>enablewrite</Command> is used to reopen the device with read-write access.
    567 When first running EXT2ED, the device is opened in read-only mode, and an
    568 explicit <Command>enablewrite</Command> is required for write access.
    569 <Command>enablewrite</Command> will fail if write access is disabled from the
    570 configuration file by the <Literal remap="tt">AllowChanges off</Literal> configuration option.
    571 Even after <Command>enablewrite</Command>, an explicit <Command>writedata</Command>
    572 is required to actually write the new data to the disk.
    573 When finishing with changing, a <Command>disablewrite</Command> is recommended for safety.
    574 Cross reference section <XRef LinkEnd="enablewrite-ref">.
    575 </Para>
    576 
    577 </Sect2>
    578 
    579 <Sect2>
    580 <Title>help</Title>
    581 
    582 <Para>
    583 
    584 <Screen>
    585 Syntax: help [command]
    586 </Screen>
    587 
    588 The <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>
    599 Syntax: next [number]
    600 </Screen>
    601 
    602 This section describes the <Emphasis>general command</Emphasis> <Command>next</Command>. <Command>next</Command>
    603 is overridden by several types in EXT2ED, to provide fine-tuned
    604 functionality.
    605 </Para>
    606 
    607 <Para>
    608 The <Literal remap="tt">next general command</Literal> behavior is depended on whether you are editing a
    609 specific 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
    619 on the status window by the <Command>show</Command> command), <Literal remap="tt">next</Literal>
    620 passes to the next <Emphasis>number</Emphasis> bytes in the current edited block.
    621 If <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
    628 that 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.
    630 If <Emphasis>number</Emphasis> is defined, it will pass <Emphasis>number</Emphasis> entries
    631 ahead.
    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>
    647 Syntax: pgdn
    648 </Screen>
    649 
    650 Usually the edited data doesn't fit into the visible main window. In this
    651 case, the status window will indicate that there is more to see "below" by
    652 the message <Literal remap="tt">Page x of y</Literal>. This means that there are <Emphasis>y</Emphasis> pages
    653 total, and you are currently viewing the <Emphasis>x</Emphasis> page. With the <Command>pgdn</Command>
    654 command, 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>
    665 Syntax: 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
    672 page. 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>
    683 Syntax: 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>
    701 Syntax: recall object
    702 </Screen>
    703 
    704 <Command>recall</Command> is the opposite of <Command>remember</Command>. It will place you at the
    705 place you where when saving the object position and type information. Cross
    706 reference section <XRef LinkEnd="remember-ref">.
    707 </Para>
    708 
    709 </Sect2>
    710 
    711 <Sect2>
    712 <Title>redraw</Title>
    713 
    714 <Para>
    715 
    716 <Screen>
    717 Syntax: redraw
    718 </Screen>
    719 
    720 Sometimes the screen display gets corrupted. I still have problems with
    721 this. 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>
    732 Syntax: remember object
    733 </Screen>
    734 
    735 EXT2ED provides you <Literal remap="tt">memory</Literal> of objects; While editing, you may reach an
    736 object which you will like to return to later. The <Command>remember</Command> command
    737 will store in memory the current place and type of the object. You can
    738 return to the object by using the <Command>recall</Command> command. Cross reference
    739 section <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
    750 corresponding inode will be saved in memory. The basic reason is that
    751 the inode is essential for finding the blocks of the file or the
    752 directory.
    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>
    768 Syntax: set [text || hex] arg1 [arg2 arg3 ...]
    769 
    770 or
    771 
    772 Syntax: set variable=value
    773 </Screen>
    774 
    775 The <Command>set</Command> command is used to modify the current data.
    776 The <Command>set general command</Command> behavior is depended on whether you are editing a
    777 specific 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
    787 used. The set command affects the data starting at the current 
    788 highlighted 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
    795 hexadecimal 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
    802 by a text string.
    803 </Para>
    804 </ListItem>
    805 
    806 </ItemizedList>
    807 
    808 Examples:
    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.
    822 The set commands just sets the variable <Emphasis>variable</Emphasis> with the
    823 value <Emphasis>value</Emphasis>.
    824 </Para>
    825 </ListItem>
    826 
    827 </ItemizedList>
    828 
    829 In any case, the data is only changed in memory. For an actual update to the
    830 disk, use the <Command>writedata</Command> command.
    831 </Para>
    832 
    833 </Sect2>
    834 
    835 <Sect2>
    836 <Title>setdevice</Title>
    837 
    838 <Para>
    839 
    840 <Screen>
    841 Syntax: setdevice device
    842 </Screen>
    843 
    844 The <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>
    855 Syntax: setoffset [block || type] [+|-]offset
    856 </Screen>
    857 
    858 The <Command>setoffset</Command> command is used to move asynchronically inside the file
    859 system. It is considered a low level command, and usually should not be used
    860 when editing an ext2 filesystem, simply because movement is better
    861 utilized through the specific ext2 commands.
    862 </Para>
    863 
    864 <Para>
    865 The <Command>offset</Command> is in bytes, and meanwhile should be positive and smaller
    866 than 2GB.
    867 </Para>
    868 
    869 <Para>
    870 Use of the <Command>block</Command> modifier changes the counting unit to block.
    871 </Para>
    872 
    873 <Para>
    874 Use of the <Literal remap="tt">+ or -</Literal> modifiers signals that the offset is relative to
    875 the current position.
    876 </Para>
    877 
    878 <Para>
    879 use of the <Literal remap="tt">type</Literal> modifier is allowed only with relative offset. This
    880 modifier 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>
    891 Syntax: settype type || [none | hex]
    892 </Screen>
    893 
    894 The <Command>settype</Command> command is used to move apply the object definitions of
    895 the type <Emphasis>type</Emphasis> on the current position. It is considered a low level
    896 command and usually should not be used when editing an ext2 filesystem since
    897 EXT2ED provides better tools. It is of-course very useful when editing a
    898 non-ext2 filesystem and using user-defined objects.
    899 </Para>
    900 
    901 <Para>
    902 When <Emphasis>type</Emphasis> is <Emphasis>hex</Emphasis> or <Emphasis>none</Emphasis>, the data will be displayed as
    903 a hex and text dump.
    904 </Para>
    905 
    906 </Sect2>
    907 
    908 <Sect2>
    909 <Title>show</Title>
    910 
    911 <Para>
    912 
    913 <Screen>
    914 Syntax: show
    915 </Screen>
    916 
    917 The <Command>show</Command> command will show the data of the current object at the
    918 current position on the main display window. It will also update the status
    919 window 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>
    931 Syntax: writedata
    932 </Screen>
    933 
    934 The <Command>writedata</Command> command will update the disk with the object data that
    935 is currently in memory. This is the point at which actual change is made to
    936 the filesystem. Without this command, the edited data will not have any
    937 effect. 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>
    948 In order to edit an ext2 filesystem, you should, of course, know the structure
    949 of the ext2 filesystem. If you feel that you lack some knowledge in this
    950 area, 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
    957 the 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)
    964 prepared 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 
    976 At this point, you should be familiar with the following terms:
    977 <Literal remap="tt">block, inode, superblock, block groups, block allocation bitmap, inode
    978 allocation bitmap, group descriptors, file, directory.</Literal>Most of the above
    979 are objects in EXT2ED.
    980 </Para>
    981 
    982 <Para>
    983 When editing an ext2 filesystem it is recommended that you use the ext2
    984 specific 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
    992 information.
    993 
    994 Sometimes in order to edit an object, EXT2ED needs the information
    995 of some other related objects. For example, when editing a
    996 directory, EXT2ED needs access to the inode of the edited directory.
    997 Simply setting the type to a directory <Literal remap="tt">will be unreliable</Literal>,
    998 since the object assumes that you passed through its inode to reach
    999 it, and expects this information, which isn't initialized if you
   1000 directly 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
   1007 using 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>
   1021 The <Literal remap="tt">ext2 general commands</Literal> are available only when you are editing an
   1022 ext2 filesystem. They are <Literal remap="tt">general</Literal> in the sense that they are not
   1023 specific 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>
   1032 Syntax: super
   1033 </Screen>
   1034 
   1035 The <Command>super</Command> command will "bring you" to the main superblock copy. It
   1036 will automatically set the object type to <Literal remap="tt">ext2&lowbar;super&lowbar;block</Literal>. Then you
   1037 will be able to view and edit the superblock. When you are in the
   1038 superblock, other commands will be available.
   1039 </Para>
   1040 
   1041 </Sect2>
   1042 
   1043 <Sect2>
   1044 <Title>group</Title>
   1045 
   1046 <Para>
   1047 
   1048 <Screen>
   1049 Syntax: group [number]
   1050 </Screen>
   1051 
   1052 The <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
   1055 descriptor 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>
   1066 Syntax: cd path
   1067 </Screen>
   1068 
   1069 The <Command>cd</Command> command will let you travel in the filesystem in the nice way
   1070 that the mounted filesystem would have let you.
   1071 </Para>
   1072 
   1073 <Para>
   1074 The <Command>cd</Command> command is a complicated command. Although it may sound
   1075 simple at first, an implementation of a typical cd requires passing through
   1076 the group descriptors, inodes, directory entries, etc. For example:
   1077 </Para>
   1078 
   1079 <Para>
   1080 The innocent cd /usr command can be done by using more primitive
   1081 EXT2ED 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 
   1129 And those commands aren't that primitive; For example, the tracing of the
   1130 blocks which belong to the root directory is done automatically by the dir
   1131 command 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>
   1136 The path to the <Command>general cd</Command> command needs to be a full pathname -
   1137 Starting from <Filename>/</Filename>. The <Command>cd</Command> command stops at the last reachable
   1138 point, 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
   1141 automatically followed (if they are not across filesystems, of-course). If
   1142 the 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>
   1154 The 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>
   1159 The status window will show you which copy of the superblock copies you are
   1160 currently editing.
   1161 </Para>
   1162 
   1163 <Para>
   1164 The main data window will show you the values of the various superblock
   1165 variables, along with some interpretation of the values.
   1166 </Para>
   1167 
   1168 <Para>
   1169 Data can be changed with the <Command>set</Command> and <Command>writedata</Command> commands.
   1170 
   1171 <Screen>
   1172 For 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>
   1183 Syntax: gocopy number
   1184 </Screen>
   1185 
   1186 The <Command>gocopy</Command> command will "bring you" to the backup copy <Emphasis>number</Emphasis>
   1187 of the superblock copies. <Command>gocopy 0</Command>, for example, will bring you to
   1188 the main copy.
   1189 </Para>
   1190 
   1191 </Sect2>
   1192 
   1193 <Sect2>
   1194 <Title>setactivecopy</Title>
   1195 
   1196 <Para>
   1197 
   1198 <Screen>
   1199 Syntax: setactivecopy
   1200 </Screen>
   1201 
   1202 The <Command>setactivecopy</Command> command will copy the contents of the current
   1203 superblock copy onto the contents of the main copy. It will also switch to
   1204 editing of the main copy. No actual data is written to disk, of-course,
   1205 until 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>
   1216 The group descriptors can be edited by the <Command>group</Command> command.
   1217 </Para>
   1218 
   1219 <Para>
   1220 The status window will indicate the current group descriptor, the total
   1221 number of group descriptors (and hence of group blocks), and the backup copy
   1222 number.
   1223 </Para>
   1224 
   1225 <Para>
   1226 The main data window will just show you the values of the various variables.
   1227 </Para>
   1228 
   1229 <Para>
   1230 Basically, 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>
   1235 The 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>
   1242 command)
   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>
   1268 Syntax: blockbitmap
   1269 </Screen>
   1270 
   1271 The <Command>blockbitmap</Command> command will let you edit the block bitmap allocation
   1272 block of the current group block.
   1273 </Para>
   1274 
   1275 </Sect2>
   1276 
   1277 <Sect2>
   1278 <Title>entry</Title>
   1279 
   1280 <Para>
   1281 
   1282 <Screen>
   1283 Syntax: entry number
   1284 </Screen>
   1285 
   1286 The <Command>entry</Command> command will move you to the <Emphasis>number</Emphasis> group descriptor in the
   1287 group descriptors table.
   1288 </Para>
   1289 
   1290 </Sect2>
   1291 
   1292 <Sect2>
   1293 <Title>inode</Title>
   1294 
   1295 <Para>
   1296 
   1297 <Screen>
   1298 Syntax: inode
   1299 </Screen>
   1300 
   1301 The <Command>inode</Command> command will pass you to the first inode in the current
   1302 group block.
   1303 </Para>
   1304 
   1305 </Sect2>
   1306 
   1307 <Sect2>
   1308 <Title>inodebitmap</Title>
   1309 
   1310 <Para>
   1311 
   1312 <Screen>
   1313 Syntax: inodebitmap
   1314 </Screen>
   1315 
   1316 The <Command>inodebitmap</Command> command will let you edit the inode bitmap allocation
   1317 block of the current group block.
   1318 </Para>
   1319 
   1320 </Sect2>
   1321 
   1322 <Sect2>
   1323 <Title>next</Title>
   1324 
   1325 <Para>
   1326 
   1327 <Screen>
   1328 Syntax: next [number]
   1329 </Screen>
   1330 
   1331 The <Command>next</Command> command will pass to the next <Emphasis>number</Emphasis> group
   1332 descriptor. 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>
   1343 Syntax: prev [number]
   1344 </Screen>
   1345 
   1346 The <Command>prev</Command> command will pass to the previous <Emphasis>number</Emphasis> group
   1347 descriptor. 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>
   1358 Syntax: setactivecopy
   1359 </Screen>
   1360 
   1361 The <Command>setactivecopy</Command> command copies the contents of the current group
   1362 descriptor, to its main copy. The updated main copy will then be shown. No
   1363 actual change is made to the disk until you issue the <Command>writedata</Command>
   1364 command.
   1365 </Para>
   1366 
   1367 </Sect2>
   1368 
   1369 </Sect1>
   1370 
   1371 <Sect1>
   1372 <Title>The inode</Title>
   1373 
   1374 <Para>
   1375 An 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 
   1395 For example, <Command>cd /usr/src/ext2ed/ext2ed.h</Command>
   1396 </Para>
   1397 </ListItem>
   1398 
   1399 </ItemizedList>
   1400 
   1401 </Para>
   1402 
   1403 <Para>
   1404 The 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>
   1449 The main data window, in addition to the list of variables, will contain
   1450 some interpretations on the right side.
   1451 </Para>
   1452 
   1453 <Para>
   1454 If the inode corresponds to a file, you can use the <Command>file</Command> command to
   1455 edit the file.
   1456 </Para>
   1457 
   1458 <Para>
   1459 If the inode is an inode of a directory, you can use the <Command>dir</Command> command
   1460 to edit the directory.
   1461 </Para>
   1462 
   1463 <Sect2>
   1464 <Title>dir</Title>
   1465 
   1466 <Para>
   1467 
   1468 <Screen>
   1469 Syntax: dir
   1470 </Screen>
   1471 
   1472 If the inode mode corresponds to a directory (shown on the status window),
   1473 you 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>
   1484 Syntax: entry number
   1485 </Screen>
   1486 
   1487 The <Command>entry</Command> command will move you to the <Emphasis>number</Emphasis> inode in the
   1488 current inode table.
   1489 </Para>
   1490 
   1491 </Sect2>
   1492 
   1493 <Sect2>
   1494 <Title>file</Title>
   1495 
   1496 <Para>
   1497 
   1498 <Screen>
   1499 Syntax: file
   1500 </Screen>
   1501 
   1502 If the inode mode corresponds to a file (shown on the status window),
   1503 you 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>
   1514 Syntax: group
   1515 </Screen>
   1516 
   1517 The <Command>group</Command> command is used to go to the group descriptor of the
   1518 current group block.
   1519 </Para>
   1520 
   1521 </Sect2>
   1522 
   1523 <Sect2>
   1524 <Title>next</Title>
   1525 
   1526 <Para>
   1527 
   1528 <Screen>
   1529 Syntax: next [number]
   1530 </Screen>
   1531 
   1532 The <Command>next</Command> command will pass to the next <Emphasis>number</Emphasis> inode.
   1533 If <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>
   1544 Syntax: prev [number]
   1545 </Screen>
   1546 
   1547 The <Command>prev</Command> command will pass to the previous <Emphasis>number</Emphasis> inode.
   1548 If <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>
   1559 When editing a file, EXT2ED offers you a both a continuous and a true
   1560 fragmented view of the file - The file is still shown block by block with
   1561 the true block number at each stage and EXT2ED offers you commands which
   1562 allow you to move between the <Literal remap="tt">file blocks</Literal>, while finding the
   1563 allocated blocks by using the inode information behind the scenes.
   1564 </Para>
   1565 
   1566 <Para>
   1567 Aside from this, the editing is just a <Literal remap="tt">hex editing</Literal> - You move the
   1568 cursor 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>,
   1570 and make changes by the <Command>set</Command> command. Note that the set command is
   1571 overridden here - There are no variables. The <Command>writedata</Command> command will
   1572 update the current block to the disk.
   1573 </Para>
   1574 
   1575 <Para>
   1576 Reaching a file can be done by using the <Command>file</Command> command from its inode.
   1577 The 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>
   1582 The 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>
   1628 The main data window will display the file either in hex mode or in text
   1629 mode, select-able by the <Command>display</Command> command.
   1630 </Para>
   1631 
   1632 <Para>
   1633 In hex mode, EXT2ED will display offsets in the current block, along with a
   1634 text and hex dump of the current block.
   1635 </Para>
   1636 
   1637 <Para>
   1638 In either case the <Literal remap="tt">current place</Literal> will be highlighted. In the hex mode
   1639 it will be always highlighted, while in the text mode it will be highlighted
   1640 if the character is display-able.
   1641 </Para>
   1642 
   1643 <Sect2>
   1644 <Title>block</Title>
   1645 
   1646 <Para>
   1647 
   1648 <Screen>
   1649 Syntax: block block_num
   1650 </Screen>
   1651 
   1652 The <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
   1654 value 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>
   1665 Syntax: display [text || hex]
   1666 </Screen>
   1667 
   1668 The <Command>display</Command> command changes the display mode of the file. 
   1669 <Command>display
   1670 hex</Command> will switch to <Command>hex mode</Command>, while <Command>display text</Command> will switch
   1671 to 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>
   1683 Syntax: inode
   1684 </Screen>
   1685 
   1686 The <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>
   1697 Syntax: next [num]
   1698 </Screen>
   1699 
   1700 The <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>
   1712 Syntax: nextblock [num]
   1713 </Screen>
   1714 
   1715 The <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>
   1727 Syntax: prev [num]
   1728 </Screen>
   1729 
   1730 The <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>
   1742 Syntax: prevblock [num]
   1743 </Screen>
   1744 
   1745 The <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>
   1757 Syntax: offset file_offset
   1758 </Screen>
   1759 
   1760 The <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>
   1771 Syntax: set [text || hex] arg1 [arg2 arg3 ...]
   1772 </Screen>
   1773 
   1774 The <Command>file set</Command> command is working like the <Literal remap="tt">general set command</Literal>,
   1775 with <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>
   1786 Syntax: writedata
   1787 </Screen>
   1788 
   1789 The <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>
   1800 When editing a file, EXT2ED analyzes for you both the allocation blocks of
   1801 the directory entries, and the directory entries.
   1802 </Para>
   1803 
   1804 <Para>
   1805 Each directory entry is displayed on one row. You can move the highlighted
   1806 entry with the usual <Command>next</Command> and <Command>prev</Command> commands, and "dive in"
   1807 with the <Command>followinode</Command> command.
   1808 </Para>
   1809 
   1810 <Para>
   1811 The 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
   1836 directory 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>
   1863 Syntax: cd [path]
   1864 </Screen>
   1865 
   1866 The <Command>cd</Command> command is used in the usual meaning, like the global cd
   1867 command.
   1868 
   1869 <ItemizedList>
   1870 <ListItem>
   1871 
   1872 <Para>
   1873 	If <Emphasis>path</Emphasis> is not specified, the current directory entry is
   1874 followed.
   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
   1887 will 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>
   1909 Syntax: entry [entry_num]
   1910 </Screen>
   1911 
   1912 The <Command>entry</Command> command sets <Emphasis>entry&lowbar;num</Emphasis> as the current directory
   1913 entry.
   1914 </Para>
   1915 
   1916 </Sect2>
   1917 
   1918 <Sect2>
   1919 <Title>followinode</Title>
   1920 
   1921 <Para>
   1922 
   1923 <Screen>
   1924 Syntax: followinode
   1925 </Screen>
   1926 
   1927 The <Command>followinode</Command> command will move you to the inode pointed by the
   1928 current directory entry.
   1929 </Para>
   1930 
   1931 </Sect2>
   1932 
   1933 <Sect2>
   1934 <Title>inode</Title>
   1935 
   1936 <Para>
   1937 
   1938 <Screen>
   1939 Syntax: inode
   1940 </Screen>
   1941 
   1942 The <Command>inode</Command> command will return you to the parent inode of the whole
   1943 directory listing.
   1944 </Para>
   1945 
   1946 </Sect2>
   1947 
   1948 <Sect2>
   1949 <Title>next</Title>
   1950 
   1951 <Para>
   1952 
   1953 <Screen>
   1954 Syntax: next [num]
   1955 </Screen>
   1956 
   1957 The <Command>next</Command> command will pass to the next directory entry.
   1958 If <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>
   1969 Syntax: prev [num]
   1970 </Screen>
   1971 
   1972 The <Command>prev</Command> command will pass to the previous directory entry.
   1973 If <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>
   1984 Syntax: writedata
   1985 </Screen>
   1986 
   1987 The <Command>writedata</Command> command will write the current directory entry to the
   1988 disk.
   1989 </Para>
   1990 
   1991 </Sect2>
   1992 
   1993 </Sect1>
   1994 
   1995 <Sect1 id="block-bitmap">
   1996 <Title>The block allocation bitmap</Title>
   1997 
   1998 <Para>
   1999 The <Literal remap="tt">block allocation bitmap</Literal> of any block group can be reached from
   2000 the corresponding group descriptor.
   2001 </Para>
   2002 
   2003 <Para>
   2004 You will be offered a bit listing of the entire blocks in the group. The
   2005 current block will be highlighted and its number will be displayed in the
   2006 status window.
   2007 </Para>
   2008 
   2009 <Para>
   2010 A value of "1" means that the block is allocated, while a value of "0"
   2011 signals that it is free. The value is also interpreted in the status
   2012 window. 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>
   2022 Syntax: allocate [num]
   2023 </Screen>
   2024 
   2025 The <Command>allocate</Command> command allocates <Emphasis>num</Emphasis> blocks, starting from the
   2026 highlighted position. If <Emphasis>num</Emphasis> is not specified, <Emphasis>num=1</Emphasis> is assumed.
   2027 Of-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>
   2038 Syntax: deallocate [num]
   2039 </Screen>
   2040 
   2041 The <Command>deallocate</Command> command deallocates <Emphasis>num</Emphasis> blocks, starting from the
   2042 highlighted position. If <Emphasis>num</Emphasis> is not specified, <Emphasis>num=1</Emphasis> is assumed.
   2043 Of-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>
   2054 Syntax: entry [entry_num]
   2055 </Screen>
   2056 
   2057 The <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>
   2069 Syntax: next [num]
   2070 </Screen>
   2071 
   2072 The <Command>next</Command> command will pass to the next bit, which corresponds to the
   2073 next block. If <Emphasis>num</Emphasis> is supplied, it will pass to the next <Emphasis>num</Emphasis>
   2074 bits.
   2075 </Para>
   2076 
   2077 </Sect2>
   2078 
   2079 <Sect2>
   2080 <Title>prev</Title>
   2081 
   2082 <Para>
   2083 
   2084 <Screen>
   2085 Syntax: prev [num]
   2086 </Screen>
   2087 
   2088 The <Command>prev</Command> command will pass to the previous bit, which corresponds to the
   2089 previous 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>
   2101 The <Literal remap="tt">inode allocation bitmap</Literal> is very similar to the block allocation
   2102 bitmap explained above. It is also reached from the corresponding group
   2103 descriptor. 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>
   2112 While 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>
   2117 I am sorry for the inconvenience. This will hopefully be fixed in future
   2118 releases.
   2119 </Para>
   2120 
   2121 </Sect1>
   2122 
   2123 <Sect1>
   2124 <Title>Copyright</Title>
   2125 
   2126 <Para>
   2127 EXT2ED is Copyright (C) 1995 Gadi Oxman.
   2128 </Para>
   2129 
   2130 <Para>
   2131 EXT2ED is hereby placed under the GPL - Gnu Public License. You are free and
   2132 welcome to copy, view and modify the sources. My only wish is that my
   2133 copyright presented above will be left and that a list of the bug fixes,
   2134 added features, etc, will be provided.
   2135 </Para>
   2136 
   2137 <Para>
   2138 The 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
   2140 version of the main ext2 include file, /usr/include/linux/ext2&lowbar;fs.h. Follows
   2141 the 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 (a] 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>
   2172 EXT2ED was constructed as a student project in the software
   2173 laboratory of the faculty of electrical-engineering in the
   2174 <Literal remap="tt">Technion - Israel's institute of technology</Literal>.
   2175 </Para>
   2176 
   2177 <Para>
   2178 At 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>
   2182 I would also like to thank the following people, who were involved in the
   2183 design and implementation of the ext2 filesystem kernel code and support
   2184 utilities:
   2185 
   2186 <ItemizedList>
   2187 <ListItem>
   2188 
   2189 <Para>
   2190 <PersonName><FirstName>Remy</FirstName> <SurName>Card</SurName></PersonName>
   2191 
   2192 Who designed, implemented and maintains the ext2 filesystem kernel
   2193 code, and some of the ext2 utilities. Remy Card is also the author
   2194 of several helpful slides concerning the ext2 filesystem.
   2195 Specifically, he is the author of <Literal remap="tt">File Management in the Linux
   2196 Kernel</Literal> and of <Literal remap="tt">The Second Extended File System - Current State,
   2197 Future Development</Literal>.
   2198 
   2199 </Para>
   2200 </ListItem>
   2201 <ListItem>
   2202 
   2203 <Para>
   2204 <PersonName><FirstName>Wayne</FirstName> <SurName>Davison</SurName></PersonName>
   2205 
   2206 Who designed the ext2 filesystem.
   2207 </Para>
   2208 </ListItem>
   2209 <ListItem>
   2210 
   2211 <Para>
   2212 <PersonName><FirstName>Stephen</FirstName> <Surname>Tweedie</SurName></PersonName>
   2213 
   2214 Who helped designing the ext2 filesystem kernel code and wrote the
   2215 slides <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 
   2223 Who 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
   2225 it exists when I started to work on my project).
   2226 </Para>
   2227 </ListItem>
   2228 
   2229 </ItemizedList>
   2230 
   2231 </Para>
   2232 
   2233 <Para>
   2234 Lastly, I would like to thank, of-course, <PersonName><FirstName>Linus</FirstName> <SurName>Torvalds</SurName></PersonName> and the
   2235 Linux community for providing all of us with such a great operating
   2236 system.
   2237 </Para>
   2238 
   2239 <Para>
   2240 Please contact me in a case of bug report, suggestions, or just about
   2241 anything concerning EXT2ED.
   2242 </Para>
   2243 
   2244 <Para>
   2245 Enjoy,
   2246 </Para>
   2247 
   2248 <Para>
   2249 Gadi Oxman &lt;tgud (a] tochnapc2.technion.ac.il&gt;
   2250 </Para>
   2251 
   2252 <Para>
   2253 Haifa, August 95
   2254 </Para>
   2255 
   2256 </Sect1>
   2257 
   2258 </Article>
   2259