1 <!DOCTYPE Article PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
7 <Title>EXT2ED - The Extended-2 filesystem editor - User's guide</Title>
9 <FirstName>Gadi Oxman, tgud@tochnapc2.technion.ac.il</FirstName>
11 <PubDate>v0.1, August 3 1995</PubDate>
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.
25 <Title>About EXT2ED documentation</Title>
28 The EXT2ED documentation consists of three parts:
34 The ext2 filesystem overview.
40 The EXT2ED user's guide.
46 The EXT2ED design and implementation.
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.
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.
68 <Title>Introduction</Title>
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.
80 <Title>Basic concepts in EXT2ED</Title>
83 Two basic concepts in EXT2ED are <Literal remap="tt">commands</Literal> and <Literal remap="tt">types</Literal>.
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.
93 Your interaction with EXT2ED is done through <Literal remap="tt">commands</Literal> which EXT2ED
94 accepts. There are three levels of commands:
106 Extended-2 Filesystem general commands
112 Type specific commands
118 The General commands are always available.
122 The ext2 general commands are available only when editing an ext2 filesystem.
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.
135 <Title>Running EXT2ED</Title>
138 Running EXT2ED is as simple as typing <Literal remap="tt">ext2ed</Literal> from the shell prompt.
139 There are no command line switches.
143 When first run, EXT2ED parses its configuration file, <Literal remap="tt">ext2ed.conf</Literal>.
144 This file must exist.
148 When the configuration file processing is done, EXT2ED screen should appear
149 on the screen, with the command prompt <Literal remap="tt">ext2ed></Literal> displayed.
155 <Title>EXT2ED user interface</Title>
158 EXT2ED uses the <Emphasis>ncurses</Emphasis> library for screen management. Your screen
159 will be divided into four parts, from top to bottom:
189 The title window just displays the current version of EXT2ED.
193 The status window will display various information regarding the state of
194 the editing at this point.
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.
207 The command window is at the bottom of the screen. It always displays a
208 command prompt <Literal remap="tt">ext2ed></Literal> and allows you to type a command. Feedback
209 about the commands entered is displayed to this window also.
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.
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.
228 <Title>Getting started</Title>
231 <Title>A few precautions</Title>
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>.
239 <Sect3 id="mounted-ref">
240 <Title>A mounted filesystem</Title>
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:
249 <Literal remap="tt">Do not use EXT2ED on a mounted filesystem !</Literal>
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.
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
271 <Title>Write access</Title>
274 Considering the obvious sensitivity of the subject, I took the following
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.
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
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.
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).
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
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.
337 <Sect2 id="help-ref">
338 <Title>The help command</Title>
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>.
353 <Sect2 id="setdevice-ref">
354 <Title>The setdevice command</Title>
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:
366 The following actions will take place in the following order:
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">.
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.
389 Autodetection of an ext2 filesystem will be made by searching for
390 the ext2 magic number in the main superblock.
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.
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
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.
417 In a case of an autodetection failure, the essential parameters
418 will be read from the configuration file.
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.
436 <Title>Two levels of usage</Title>
439 <Title>Low level usage</Title>
442 This section explains what EXT2ED provides even when not editing an ext2
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>.
459 To define objects, use the configuration option <Literal remap="tt">AlternateDescriptors</Literal>.
463 There are now two forms of editing:
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.
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.
488 <Title>High level usage</Title>
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:
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.
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.
519 <Title>General commands</Title>
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.
528 Whenever a command syntax is specified, arguments which are optional are
529 enclosed with square brackets.
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.
539 <Sect2 id="disablewrite-ref">
540 <Title>disablewrite</Title>
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">.
557 <Sect2 id="enablewrite-ref">
558 <Title>enablewrite</Title>
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">.
585 Syntax: help [command]
588 The <Command>help</Command> command is described at section <XRef LinkEnd="help-ref">.
593 <Sect2 id="next-ref">
599 Syntax: next [number]
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
608 The <Literal remap="tt">next general command</Literal> behavior is depended on whether you are editing a
609 specific object, or none.
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.
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
641 <Sect2 id="pgdn-ref">
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.
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">.
683 Syntax: prev [number]
689 <Command>prev</Command> is the opposite of <Command>next</Command>. Cross reference section
690 <XRef LinkEnd="next-ref">.
695 <Sect2 id="recall-ref">
696 <Title>recall</Title>
701 Syntax: recall object
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">.
712 <Title>redraw</Title>
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.
726 <Sect2 id="remember-ref">
727 <Title>remember</Title>
732 Syntax: remember object
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">.
743 <Literal remap="tt">Note:</Literal>
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
768 Syntax: set [text || hex] arg1 [arg2 arg3 ...]
772 Syntax: set variable=value
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.
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.
794 When using the <Command>set hex</Command> command, a list of
795 hexadecimal bytes should follow.
801 When using the <Command>set text</Command> command, it should be followed
811 set hex 09 0a 0b 0c 0d 0e 0f
812 set text Linux is just great !
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>.
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.
836 <Title>setdevice</Title>
841 Syntax: setdevice device
844 The <Command>setdevice</Command> command is described at section <XRef LinkEnd="setdevice-ref">.
850 <Title>setoffset</Title>
855 Syntax: setoffset [block || type] [+|-]offset
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.
865 The <Command>offset</Command> is in bytes, and meanwhile should be positive and smaller
870 Use of the <Command>block</Command> modifier changes the counting unit to block.
874 Use of the <Literal remap="tt">+ or -</Literal> modifiers signals that the offset is relative to
875 the current position.
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.
886 <Title>settype</Title>
891 Syntax: settype type || [none | hex]
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.
902 When <Emphasis>type</Emphasis> is <Emphasis>hex</Emphasis> or <Emphasis>none</Emphasis>, the data will be displayed as
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.
926 <Title>writedata</Title>
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.
945 <Title>Editing an ext2 filesystem</Title>
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:
956 Read the supplied ext2 technical information. I tried to summarize
957 the basic information which is needed to get you started.
963 Get the slides that Remy Card (The author of the ext2 filesystem)
964 prepared concerning the ext2 filesystem.
970 Read the kernel sources.
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.
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:
991 In most cases it will be unreliable, and will display incorrect
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.
1006 EXT2ED offers far better tools for handling the ext2 filesystem
1007 using the ext2 specific commands.
1018 <Title>ext2 general commands</Title>
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.
1026 <Sect2 id="general-superblock">
1027 <Title>super</Title>
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_super_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.
1044 <Title>group</Title>
1049 Syntax: group [number]
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_group_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.
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.
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:
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):
1087 Using <Command>group 0</Command> to go to the first group descriptor.
1093 Using <Command>inode</Command> to get to the Bad blocks inode.
1099 Using <Command>next</Command> to pass to the root directory inode.
1105 Using <Command>dir</Command> to see the directory.
1111 Using <Command>next</Command> until we find the directory usr.
1117 Using <Command>followinode</Command> to pass to the inode corresponding to usr.
1123 Using <Command>dir</Command> to see the directory of /usr.
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.
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_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".
1151 <Title>The superblock</Title>
1154 The superblock can always be reached by the ext2 general command
1155 <Command>super</Command>. Cross reference section <XRef LinkEnd="general-superblock">.
1159 The status window will show you which copy of the superblock copies you are
1164 The main data window will show you the values of the various superblock
1165 variables, along with some interpretation of the values.
1169 Data can be changed with the <Command>set</Command> and <Command>writedata</Command> commands.
1172 For example, set s_r_blocks_count=1400 will reserve 1400 blocks for root.
1178 <Title>gocopy</Title>
1183 Syntax: gocopy number
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
1194 <Title>setactivecopy</Title>
1199 Syntax: setactivecopy
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.
1213 <Title>The group descriptors</Title>
1216 The group descriptors can be edited by the <Command>group</Command> command.
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
1226 The main data window will just show you the values of the various variables.
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.
1235 The group descriptors object is a junction, from which you can reach:
1241 The inode table of the corresponding block group (the <Literal remap="tt">inode</Literal>
1248 The block allocation bitmap (the <Literal remap="tt">blockbitmap</Literal> command)
1254 The inode allocation bitmap (the <Literal remap="tt">inodebitmap</Literal> command)
1263 <Title>blockbitmap</Title>
1271 The <Command>blockbitmap</Command> command will let you edit the block bitmap allocation
1272 block of the current group block.
1278 <Title>entry</Title>
1283 Syntax: entry number
1286 The <Command>entry</Command> command will move you to the <Emphasis>number</Emphasis> group descriptor in the
1287 group descriptors table.
1293 <Title>inode</Title>
1301 The <Command>inode</Command> command will pass you to the first inode in the current
1308 <Title>inodebitmap</Title>
1316 The <Command>inodebitmap</Command> command will let you edit the inode bitmap allocation
1317 block of the current group block.
1328 Syntax: next [number]
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.
1343 Syntax: prev [number]
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.
1353 <Title>setactivecopy</Title>
1358 Syntax: setactivecopy
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>
1372 <Title>The inode</Title>
1375 An inode can be reached by the following two ways:
1381 Using <Command>inode</Command> from the corresponding group descriptor.
1387 Using <Command>followinode</Command> from a directory entry.
1393 Using the <Command>cd</Command> command with the pathname to the file.
1395 For example, <Command>cd /usr/src/ext2ed/ext2ed.h</Command>
1404 The status window will indicate:
1410 The current global inode number.
1416 The total total number of inodes.
1422 On which block group the inode is allocated.
1428 The total number of inodes in this group block.
1434 The index of the current inode in the current group block.
1440 The type of the inode (file, directory, special, etc).
1449 The main data window, in addition to the list of variables, will contain
1450 some interpretations on the right side.
1454 If the inode corresponds to a file, you can use the <Command>file</Command> command to
1459 If the inode is an inode of a directory, you can use the <Command>dir</Command> command
1460 to edit the directory.
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>.
1479 <Title>entry</Title>
1484 Syntax: entry number
1487 The <Command>entry</Command> command will move you to the <Emphasis>number</Emphasis> inode in the
1488 current inode table.
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>.
1509 <Title>group</Title>
1517 The <Command>group</Command> command is used to go to the group descriptor of the
1518 current group block.
1529 Syntax: next [number]
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.
1544 Syntax: prev [number]
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.
1556 <Title>The file</Title>
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.
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.
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.
1582 The status window will indicate:
1588 The global block number.
1594 The internal file block number.
1612 The file inode number.
1618 The indirection level - Whether it is a direct block (0), indirect
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.
1633 In hex mode, EXT2ED will display offsets in the current block, along with a
1634 text and hex dump of the current block.
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.
1644 <Title>block</Title>
1649 Syntax: block block_num
1652 The <Command>block</Command> command is used to move inside the file. The
1653 <Emphasis>block_num</Emphasis> argument is the requested internal file block number. A
1654 value of 0 will reach the beginning of the file.
1660 <Title>display</Title>
1665 Syntax: display [text || hex]
1668 The <Command>display</Command> command changes the display mode of the file.
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>.
1678 <Title>inode</Title>
1686 The <Command>inode</Command> command will return to the inode of the current file.
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.
1707 <Title>nextblock</Title>
1712 Syntax: nextblock [num]
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.
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.
1737 <Title>prevblock</Title>
1742 Syntax: prevblock [num]
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.
1752 <Title>offset</Title>
1757 Syntax: offset file_offset
1760 The <Command>offset</Command> command will move to the specified offset in the file.
1771 Syntax: set [text || hex] arg1 [arg2 arg3 ...]
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.
1781 <Title>writedata</Title>
1789 The <Command>writedata</Command> command will update the current file block in the disk.
1797 <Title>The directory</Title>
1800 When editing a file, EXT2ED analyzes for you both the allocation blocks of
1801 the directory entries, and the directory entries.
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.
1811 The status window will indicate:
1817 The directory entry number.
1823 The total number of directory entries in this directory.
1829 The current global block number.
1835 The current offset in the entire directory - When viewing the
1836 directory as a continuous file.
1842 The inode number of the directory itself.
1848 The indirection level - Whether it is a direct block (0), indirect
1866 The <Command>cd</Command> command is used in the usual meaning, like the global cd
1873 If <Emphasis>path</Emphasis> is not specified, the current directory entry is
1880 <Emphasis>path</Emphasis> can be relative to the current directory.
1886 <Emphasis>path</Emphasis> can also end up in a file, in which case the file inode
1893 Symbolic link (fast only, meanwhile) is automatically followed.
1904 <Title>entry</Title>
1909 Syntax: entry [entry_num]
1912 The <Command>entry</Command> command sets <Emphasis>entry_num</Emphasis> as the current directory
1919 <Title>followinode</Title>
1927 The <Command>followinode</Command> command will move you to the inode pointed by the
1928 current directory entry.
1934 <Title>inode</Title>
1942 The <Command>inode</Command> command will return you to the parent inode of the whole
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.
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.
1979 <Title>writedata</Title>
1987 The <Command>writedata</Command> command will write the current directory entry to the
1995 <Sect1 id="block-bitmap">
1996 <Title>The block allocation bitmap</Title>
1999 The <Literal remap="tt">block allocation bitmap</Literal> of any block group can be reached from
2000 the corresponding group descriptor.
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
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.
2017 <Title>allocate</Title>
2022 Syntax: allocate [num]
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.
2033 <Title>deallocate</Title>
2038 Syntax: deallocate [num]
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.
2049 <Title>entry</Title>
2054 Syntax: entry [entry_num]
2057 The <Command>entry</Command> command sets the current highlighted block to
2058 <Emphasis>entry_num</Emphasis>.
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>
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.
2098 <Title>The inode allocation bitmap</Title>
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">.
2109 <Title>Filesystem size limitation</Title>
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>.
2117 I am sorry for the inconvenience. This will hopefully be fixed in future
2124 <Title>Copyright</Title>
2127 EXT2ED is Copyright (C) 1995 Gadi Oxman.
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.
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_fs.h. Follows
2141 the original copyright:
2148 * linux/include/linux/ext2_fs.h
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)
2157 * linux/include/linux/minix_fs.h
2159 * Copyright (C) 1991, 1992 Linus Torvalds
2169 <Title>Acknowledgments</Title>
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>.
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.
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
2190 <PersonName><FirstName>Remy</FirstName> <SurName>Card</SurName></PersonName>
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>.
2204 <PersonName><FirstName>Wayne</FirstName> <SurName>Davison</SurName></PersonName>
2206 Who designed the ext2 filesystem.
2212 <PersonName><FirstName>Stephen</FirstName> <Surname>Tweedie</SurName></PersonName>
2214 Who helped designing the ext2 filesystem kernel code and wrote the
2215 slides <Literal remap="tt">Optimizations in File Systems</Literal>.
2221 <PersonName><FirstName>Theodore</FirstName> <SurName>Ts'o</SurName></PersonName>
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).
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
2240 Please contact me in a case of bug report, suggestions, or just about
2241 anything concerning EXT2ED.
2249 Gadi Oxman <tgud@tochnapc2.technion.ac.il>