Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ fsdb(1m) — DG/UX 4.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought



                                                                 fsdb(1m)



        _________________________________________________________________
        fsdb
        file system debugger
        _________________________________________________________________


        SYNTAX

        /etc/fsdb special [ - ]


        DESCRIPTION

        Fsdb views and alters information on the disk.  This information
        includes inodes, directory entries, and any other disk
        information.

        Special is the pathname of a special file referring to a device
        containing a file system.  The - or an `O' argument suppresses
        error-checking routines that verify inode, directory, and block
        addresses.  To do these checks, fsdb reads the fs_nodes_per_dar
        (inodes per disk allocation region) and fs_size (file system
        size) fields of of the file system's super-block.

        Fsdb is intended mainly for emergencies where fsck(1m) and
        clri(1m) are ineffective in dealing with problems on the disk.
        To use fsdb effectively, you must be familiar with the contents
        of inodes and directory entries and how these structures are
        used.

        Fsdb can display disk information in the following formats:

             inode
             directory entry
             double word
             word
             byte
             character

        Fsdb supports decimal and octal numbers.  A zero prefix indicates
        an octal number.  Decimal is the default.


           Examining inodes

        To view an inode, type an integer followed by a lowercase `i'.
        Fsdb then lists the specified inode's number, mode, link count,
        user ID, group ID, size, the fragment numbers stored in its
        direct and indirect block arrays, and the creation, last-
        modification, and last-access times.  The default is the current
        inode.  When you enter fsdb, the current inode is number 2,



        DG/UX 4.00                                                 Page 1
               Licensed material--property of copyright holder(s)





                                                                 fsdb(1m)



        indicating the root directory.  Otherwise the current inode is
        the last inode referenced.

        To change the fields of the inode, use the mnemonics given for a
        particular field followed by an equal sign and the desired
        contents for that field.  For example, sz=1024 sets the file size
        for the current inode to 1024 bytes.  The i-number of an inode
        cannot be changed.

        The following mnemonics are used to change inodes:

             md   Mode
             ln   Link count
             uid  User ID Number
             gid  Group ID Number
             sz   File size in bytes
             a#   Data block numbers (0-12 for ordinary files, and 0-10
                  for non-ordinary files)
             at   Time of last access
             mt   Time of last modification
             ct   Time of creation
             maj  Major device number (special files only)
             min  Minor device number (special files only)

        For control point directories only:


        Max space usage
                       Total amount of space allowed in this and
                       subordinate directories.

        Cur space usage
                       Current amount of space allowed in this directory
                       and subordinates.

        Max file node  Total number of inodes allowed in this and
                       subordinate directories.

        Cur file node  Current number of inodes allowed in this directory
                       and subordinate directories.

        An inode's first 10 data blocks are direct blocks; the next three
        are indirect.  To print the contents of the data blocks, type an
        `f'.  The `f' can be followed by a logical block number and a
        print option or by a print option alone.  If you omit the number,
        block 0 is printed.  The data in the specified block are printed
        according to the mode indicated by a print option.  The print
        options are:

             d    Print as directories.
             o    Print as octal words.



        DG/UX 4.00                                                 Page 2
               Licensed material--property of copyright holder(s)





                                                                 fsdb(1m)



             e    Print as decimal words.
             c    Print as characters.
             b    Print as octal bytes.

        The `f' command does not work on a special file (device) or on
        empty data blocks.  (The pointer in the inode for an empty block
        in a file is 0.)

        The `a' field of the inode is examined and changed differently
        than the other fields are.  To examine a data block entry,
        specify `a' followed by a logical block number and then `b'.  The
        address of the array element within the inode for the logical
        block number is printed, followed by `A'.  Then the octal and the
        decimal disk block number of the data block itself is printed.


           Examining directory entries

        To view a directory entry, type a `d' followed by an integer.  A
        directory entry consists of an inode number, the name length,
        entry length, sequence number, and filename.  Since directory
        entries are found in the data of a directory inode, fsdb displays
        the directory entry specified relative to the current inode.  If
        the current inode is not a directory inode or there are fewer
        directory entries than the one you indicate, fsdb prints this
        message:

             nonexistent block
             Cannot scan directory

        All fields of the directory entry except the inode number can be
        changed by giving the mnemonic for the field followed by an equal
        sign and then a value.  For the name field, the character string
        following the equal sign should be enclosed in double quotes if
        the first character is not alphabetic; otherwise, quotes are
        optional for this field.  To alter the inode number for a
        directory entry, omit the mnemonic.  The mnemonics are as
        follows:

             nl   Name length in characters
             el   Entry length - total byte count used by the entry
             nm   Filename
             sq   Sequence number

        Use extreme care in changing names, name lengths, and entry
        lengths, because following entries can be corrupted or made
        unreachable.


           Examining other data




        DG/UX 4.00                                                 Page 3
               Licensed material--property of copyright holder(s)





                                                                 fsdb(1m)



        Information can also be printed as double words, words, bytes, or
        characters.  To view data in these forms, one can use D, W, or B
        for double words, words, or bytes, respectively.  Used alone,
        these options print the current address in octal, followed by an
        indicator of the mode requested (D., W., or B.).  The contents of
        the current location follow in octal and then in decimal.  If the
        mode desired is preceeded by a number, that number is taken as
        the address and becomes the current address.

        To alter the contents of a double word, word, or byte, follow the
        address and mode indicator (B, W, or D) by an equal sign and a
        value.  For example, `01006W=0177777' sets the contents of word
        01006 to 0177777.


           Current address

        The contents of the current address can also be viewed by
        following the letter `p' with an `i' for inodes or one of the
        print options described above for use with the `f' command.  If
        the `p' is followed by a number, that many elements (inodes,
        words, etc., depending on the print option used) are printed.

        The current address is normalized to an appropriate boundary
        before printing begins.  The current address advances with the
        printing and is left at the address of the last item printed.

        The current address can be saved by using the `<' symbol.  The
        symbol `>' restores the saved address.  Only one address can be
        saved at any one time; a subsequent use of `<' replaces a
        previously saved address with the current address.


           Commands and symbols

        Following is a summary of fsdb commands:

        [n]i        Print inode n; current is the default.
           dn       Print directory entry number n.
           p[n]o|i  Print the next n inodes according to option o or in
                    inode format.
           f[n]o    Print logical data block n according to option o;
                    block 0 is the default.
        [a]B        Enter byte mode at address a; default is the current
                    address.
        [a]W        Enter word mode at address a; default is the current
                    address.
        [a]D        Enter double-word mode at address a; default is the
                    current address.
           +,-      Print next item, last item.
           >,<      Save current address, restore saved address.



        DG/UX 4.00                                                 Page 4
               Licensed material--property of copyright holder(s)





                                                                 fsdb(1m)



           O        Set or unset error-checking toggle.
           !        Escape to the shell.
           q        Quit - terminate the program.
           <NL>     Print next item of the previously specified type.

        The following symbols are used for assignment to inode and
        directory fields and also to locations directly:

           =n       Assignment
           =+n      Incremental assignment
           =-n      Decremental assignment

        You can use dots, tabs, and spaces as delimiters within commands
        to fsdb, but they are not necessary.  A line with just a new-line
        character increases the current address by the size of the data
        type last printed.  That is, the address is set to the next byte,
        word, double word, directory entry, or inode, letting you step
        through a region of the file system.  A line with just a + or -
        takes you to the next or previous item, respectively.


           Miscellaneous

        Fsdb cannot print more than a block's worth of data at once
        because only one block of data is kept in memory at any one time.
        If a count of 0 is used with the `p' command, all entries to the
        end of the current block are printed.  Because fsdb deals with
        only a block at a time, raw devices and block devices can be
        debugged.

        All assignment operations result in immediate write-through of
        the current block.  During any assignment operation, numbers are
        checked for a possible truncation error due to the size of the
        destination address.  The message `alignment' is printed if such
        a truncation would have taken place if the assignment had been
        made.

        To terminate output at any time, type the delete character.


        EXAMPLES

        2i            Prints the root inode of the current file system.

        386i          Prints inode number 386 in inode format; this
                      becomes the current inode.

        ln=4          Changes the link count for the current inode to 4.

        ln=+1         Increases the current inode's link count by 1.




        DG/UX 4.00                                                 Page 5
               Licensed material--property of copyright holder(s)





                                                                 fsdb(1m)



        fc            Prints, in ASCII, block zero of the file associated
                      with the current inode.

        f2c           Prints the third data block of the current inode as
                      characters.

        2i.fd         Prints the root inode's first data block in the
                      form of directory entries.  This example combines
                      several operations on one command line; the same
                      effect would occur if the `2i' were followed by
                      `fd' as a separate command.

        d2            Prints the third directory entry in the current
                      inode.

        d0=32         Sets the inode number of the first directory entry
                      of the current inode to 32.

        d5i.fc        Changes the current inode to that associated with
                      the sixth directory entry of the current inode; the
                      first logical block of the file is then printed in
                      ASCII.

        0B.p0o        Prints the super-block of a DG/UX file system in
                      octal.

        2i.a0b.d7=3   Changes the i-number for the eighth directory slot
                      in the root directory to 3.

        d7.nm="name"  Changes the name field in the directory slot to
                      `name'.

        a2b.p0d       Prints the third block of the current inode as
                      directory entries.

        0140B         Produces the output
                           0140B.:     14 (12)
                      if location 0140 happens to contain 014.


        SEE ALSO

        clri(1m), fsck(1m).











        DG/UX 4.00                                                 Page 6
               Licensed material--property of copyright holder(s)



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026