Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ fsdb(ADM) — OpenDesktop 1.0.0y

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fsck(ADM)

dir(F)

filesystem(F)

FSDB(ADM)


     FSDB(ADM)                                  UNIX System V



     Name
          fsdb - filesystem debugger


     Syntax
          /etc/fsdb special [ - ]


     Description
          fsdb can be used to patch up a damaged  filesystem  after  a
          crash.   It has conversions to translate block and i-numbers
          into their corresponding disk addresses.  Also included  are
          mnemonic  offsets  to  access  different parts of an i-node.
          These greatly simplify the  process  of  correcting  control
          block entries or descending the filesystem tree.

          fsdb contains several error-checking routines to  verify  i-
          node   and  block  addresses.   These  can  be  disabled  if
          necessary by invoking fsdb with the optional -  argument  or
          by  the  use of the O symbol.  (fsdb reads the i-size and f-
          size entries from the superblock of the  filesystem  as  the
          basis for these checks.)

          Numbers are considered decimal by  default.   Octal  numbers
          must  be  prefixed  with  a  zero.   During  any  assignment
          operation, numbers are checked  for  a  possible  truncation
          error due to a size mismatch between source and destination.

          fsdb reads a block at a time and will  therefore  work  with
          raw  as  well  as  block I/O. A buffer management routine is
          used to retain commonly used blocks  of  data  in  order  to
          reduce  the  number  of  read  system calls.  All assignment
          operations result  in  an  immediate  write-through  of  the
          corresponding block.

          The symbols recognized by fsdb are:

               #            absolute address
               i            convert from i-number to i-node address
               b            convert to block address
               d            directory slot offset
               +,-          address arithmetic
               q            quit
               >,<          save, restore an address
               =            numerical assignment
               =+           incremental assignment
               =-           decremental assignment
               ="           character string assignment
               O            error checking flip flop
               p            general print facilities
               f            file print facility
               B            byte mode
               W            word mode
               D            double word mode
               !            escape to shell

          The print facilities generate a formatted output in  various
          styles.  The current address is normalized to an appropriate
          boundary before  printing  begins.   It  advances  with  the
          printing  and  is  left  at  the  address  of  the last item
          printed.  The output can be terminated at any time by typing
          the  delete  character.   If  a number follows the p symbol,
          that many entries are printed.  A check is  made  to  detect
          block  boundary  overflows since logically sequential blocks
          are generally not physically sequential.  If a count of zero
          is  used,  all  entries  to the end of the current block are
          printed.  The print options available are:

               i            print as i-nodes
               d            print as directories
               o            print as octal words
               e            print as decimal words
               c            print as characters
               b            print as octal bytes

          The f symbol is  used to print data blocks  associated  with
          the  current i-node.  If followed by a number, that block of
          the file is printed.  (Blocks are numbered from  zero.)  The
          desired  print  option  letter  follows the block number, if
          present, or the f symbol.  This  print  facility  works  for
          small as well as large files.  It checks for special devices
          and that the block pointers used to find the  data  are  not
          zero.

          Dots, tabs, and spaces may be used  as  function  delimiters
          but  are  not  necessary.   A  line  with  just  a  new-line
          character will increment 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 i-node,
          allowing  the user to step through a region of a filesystem.
          Information is printed in a format appropriate to  the  data
          type.   Bytes, words and double words are displayed with the
          octal address followed by the value in octal and decimal.  A
          .B or .D is appended to the address for byte and double word
          values,  respectively.   Directories  are   printed   as   a
          directory  slot  offset followed by the decimal i-number and
          the character representation of the entry name.  I-nodes are
          printed with labeled fields describing each element.

          The following mnemonics are used for i-node examination  and
          refer to the current working i-node:

               md           mode
               ln           link count
               uid          user ID number
               gid          group ID number
               sz           file size
               a#           data block numbers (0 - 12)
               at           access time
               mt           modification time
               maj          major device number
               min          minor device number


     Examples
          386i            prints i-number 386  in  an  i-node  format.
                          This now becomes the current working i-node.

          ln=4            changes the link count for  the  working  i-
                          node to 4.

          ln=+1           increments the link count by 1.

          fc              prints, in ASCII, block  zero  of  the  file
                          associated with the working i-node.

          2i.fd           prints the first 32  directory  entries  for
                          the root i-node of this filesystem.

          d5i.fc          changes   the   current   i-node   to   that
                          associated  with  the  5th  directory  entry
                          (numbered from zero) found  from  the  above
                          command.   The  first  logical  block of the
                          file is then printed in ASCII.

          512B.p0o        prints the superblock of this filesystem  in
                          octal.

          2i.a0b.d7=3     changes  the  i-number   for   the   seventh
                          directory  slot  in the root directory to 3.
                          This  example   also   shows   how   several
                          operations  can  be  combined on one command
                          line.

          d7.nm="name"    changes the name field in the directory slot
                          to  the  given  string.  Quotes are optional
                          when used with nm if the first character  is
                          alphabetic.

          a2b.p0d         prints the third block of the current i-node
                          as directory entries.


     Notes
          The directory /etc/fscmd.d/TYPE contains programs  for  each
          filesystem   type;  each  of  these  programs  applies  some
          appropriate heuristic  to  determine  whether  the  supplied
          special file is of the type for which it checks.


     See Also
          fsck(ADM), dir(F), filesystem(F),  ``Patching  a  Filesystem
          with  fsdb''  in  the  ``Using  Filesystems'' chapter of the
          System Administrator's Guide


     (printed 8/23/89)                                  FSDB(ADM)

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