home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1997 April / PCO_04_97.ISO / filesbbs / os2 / dfs201.arj / DFS201.ZIP / dfs.DOC next >
Encoding:
Text File  |  1997-02-06  |  45.1 KB  |  1,047 lines

  1.  
  2.    Display File Systems; version 2.01 06-02-97  (c) 1994-1997; Jan van Wijk
  3.  ════════════════════════════════════════════════════════════════════════════
  4.  
  5. CONTENTS
  6. --------
  7.  Introduction, purpose of the program                                    1
  8.  Status of the program and change history                                2
  9.  Terminology used                                                        3
  10.  Summary of commands                                                     5
  11.  Command reference, general DFS commands                                 6
  12.  Command reference, HPFS specific commands                              16
  13.  Diagram of an example HPFS structure                                   20
  14.  Examples of DHPFS usage                                                21
  15.  Known limitations                                                      21
  16.  Considered improvements                                                22
  17.  
  18.  
  19.  
  20.  
  21. Introduction, purpose of the program
  22. ------------------------------------
  23.  
  24.  The DFS program as it is available now is a more general implementation
  25.  of the DHPFS program. It supports partition-structures and it will
  26.  support different file-systems besides HPFS in the near future.
  27.  
  28.  The DHPFS program has been built while studying the HPFS filesystem.
  29.  It's main purpose is getting to understand the file-system as it occurs
  30.  on the disk itself, in the data-structures laid down in disk-sectors.
  31.  Over time, additional logic was implemented to allow analysis of all
  32.  sorts of disk problems on HPFS volumes.
  33.  The tool has been used a few times over the past year to analyse some
  34.  real-life disk problems in a large systems-integration project.
  35.  Also it has proven very usefull in teaching others the internals of HPFS
  36.  Most of my knowledge of the file-system is based on the excelent lectures
  37.  "HPFS Internals" at the 1994 ColoradOS/2 conference by Doug Azzarito
  38.  and on peeking arround on a lot of HPFS volumes using DHPFS.
  39.  
  40.                                                                                
  41.  
  42. Status of the program
  43. ---------------------
  44.  
  45.  This version of the program is free for anyone to use, it was written
  46.  in my own time using my own equipment.
  47.  Further development depends on my own needs and feedback I receive from
  48.  other users, al work has to be done on spare time...
  49.  Improved versions of the program might be in the form of SHAREWARE.
  50.  
  51.  Suggestions and other comments regarding DFS, HPFS and DHPFS are welcome.
  52.  
  53.  You can reach me at my userid at CompuServe: 100603,2437
  54.  
  55.                      or through the Internet: 100603.2437@compuserve.com
  56.                                           or: janvw@ibm.net
  57.                                           or: jan.van.wijk@cmg.nl
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64. Change History
  65. --------------
  66. 1.00  27-11-94     DHPFS initial version, hex dump super+spare blocks
  67. 1.39  20-07-95     32-bit port; Sector Lookup table; bug-fixes
  68. 1.52  13-09-95     new '/' cmd shortcut; First released version!     <== BBS
  69. 1.56  26-09-95     RUN cmd runs REXX dhpfs macro's
  70. 1.62  13-10-95     Added Free-space and inconsistency reporting
  71. 1.64  16-10-95     Cleanup for delivery on ColoradOS/2 CDROM
  72. 1.69  24-06-96     Fixed trap on non-HPFS volumes (open FAT, Enter ==> trap)
  73. 1.70  20-12-96     Update ColoradOS/2, DASD limits; REQUEST (OS2FISYS forum)
  74. 1.84  14-01-97     DFS first distributed version to include partitioning info
  75. 1.87  19-01-97     Fixed MBR/EBR walk; multiple cmds using #, BM-labels in part
  76. 1.90  20-01-97     New fixroot and saveto commands for recovery actions (KULVM)
  77. 1.91  21-01-97     New fixcp command to fix CodePage reference          (KULVM)
  78. 1.96  27-01-97     Dynamic loading of REXX support
  79. 2.00  03-02-97     Removable media (NEWDASD); (part) D: cmd; invisible primary
  80. 2.01  06-02-97     CopyOutput command for REXX
  81.                                                                                
  82. Terminology used
  83. ----------------
  84.  
  85.  Sector         512 bytes of data
  86.                 This is the smallest amount of data manipulated by the
  87.                 disk subsystems and is also the basic allocation-unit
  88.                 for the HPFS file-system
  89.  
  90.  CHS            Cylinder Head Sector (addressing)
  91.                 This is the classical way of addressing physical sectors
  92.                 on a disk. It is used in the PC's BIOS, in partition tables
  93.                 and in low-level disk-IO API's (IOCTL, INT-13).
  94.                 In most implementations the addressing ranges are limitted
  95.                 causing all sorts of problems with large disks/partitions.
  96.                 Example: maximum cylinder=1024 limit for BIOS/INT-13
  97.  
  98.  PSN            Physical Sector Number
  99.                 This is the zero-based, unsigned-LONG, number for a
  100.                 sector on a physical disk. Addressing on a disk using
  101.                 PSN's id often referred to as Relative Block Addressing
  102.                 (RBA) or Logical Block Addressing (LBA)
  103.  
  104.  LSN            Logical Sector Number
  105.                 This is the zero-based, unsigned-LONG, number for a
  106.                 sector on a logical partition. The partition can be seen
  107.                 as a linear sequence of sectors.
  108.  
  109.  SLT            Sector Lookup Table
  110.                 An array of information about sectors or groups of sectors,
  111.                 containing the type of the sector(s) and the LSN of a
  112.                 directly related sector (usualy an Fnode).
  113.                 It is currently implemented for HPFS only.
  114.  
  115.                                                                                
  116.  
  117.  Partition      An area on a physical disk that holds a single logical
  118.                 file-system like FAT, HPFS, Boot-manager, NTFS etc.
  119.                 There is an index to find partitions in the form of a
  120.                 set of partition-tables in the MBR/EBR chain.
  121.  
  122.  MBR            Master Boot Record
  123.                 The first sector on the physical disk, located at PSN 0 =
  124.                 Cylinder 0, Head 0, Sector 1
  125.                 It contains the initial boot code called from the BIOS and
  126.                 the main partition table that holds the primary partitions
  127.                 and the start of the chain of extended boot records (EBR).
  128.  
  129.  EBR            Extended Boot Record
  130.                 It contains no boot code but only a partition table that
  131.                 holds the location of a single logical partitions.
  132.                 It usualy is located on the cylinder just before the actual
  133.                 logical partition itself, at Head 0, Sector 1.
  134.                 Each EBR will also point to the next EBR if more logical
  135.                 partitions exist on the same disk.
  136.  
  137.                                                                                
  138. Summary of commands
  139. -------------------
  140.  
  141.  DFS takes commands from the keyboard and displays the results to the screen,
  142.  scrolling text upward. It can also be copied to a file for later analysis.
  143.  
  144.  The commands are single words or (hexadecimal) numbers.
  145.  Most commands have one or more parameters of wich some are optional.
  146.  
  147.  DFS keeps track of the current- and some other usefull SN's so they
  148.  can be referenced faster, without having to type them in. They are:
  149.  
  150.      Name          Cmd       Description
  151.      ----          ---       -----------
  152.      next          'F'       next in sequence
  153.      prev          'B'       previous in sequence
  154.      up            'u'       up in hierarchy
  155.      down          Enter     down in hierarchy
  156.      this          't'       this (current)
  157.      xtra          'x'       Extra, alternative
  158.      org           'o'       original, usualy the ROOT directory LSN
  159.  
  160.  A logical partition needs to be opened first with the 'part' command.
  161.  After opening an HPFS partition, using 'Enter' a few times will take you
  162.  to the superblock, root-directory, possible sub-directories upto some file.
  163.  
  164.  Multiple commands can be chained if separated with the '#' character.
  165.  
  166.  An overview of the available commands is given below, it can also be
  167.  referenced from within the program using the '?' command.
  168.  
  169.       xx      = Analyse & display sector, SN xx; xx = 1 to 8 hexadecimals
  170.  H,h  xx [s]  = Hex-dump sector of half-sector, SN xx, s sectors/bytes
  171.  t a|e|h [s]  = This SN, display in Ascii, Ea or Hex;  s sectors/bytes
  172.  .NNN         = Display numbered directory- or allocation-entry marked .NNN
  173.  a, M [xx]    = Allocation bitmaps, compact or verbose format
  174.  m            = Directory allocation bitmap; usage of pre-allocated space
  175.  \path-spec   = find and show file/directory specified by path-spec
  176.  findroot [n] = find the Root directory without using the superblock
  177.  /hex-ascii   = forward search mixed hex-ascii string in any sector
  178.  f [type [s]] = forward search sector of [type]; containing string [s]
  179.  b [type [s]] = backward search; sector types see doc: ──┬────────────────┐
  180.  walk [dsknr] = Select a disk and walk MBR/EBR chain     │ u = Unidentif. │
  181.  part [id/dr] = Select partition with index #, or show   │ a = AllocBlock │
  182.  d:           = Open partition for drive-letter d:       │ f = Fnode, any │
  183.  u, Enter     = up / down in hierarchy (Enter = down)    │ F = File fnode │
  184.  x, o         = Extra / original LSN                     │ D = Dir. fnode │
  185.  log [file]   = Log to 'file' ('log' = stop log)         │ d = Dir. block │
  186.  I [type i s] = Show SLT for 'type', at index i, size s ─┤ ! = known type │
  187.  i [xx]       = Identify, using sector lookup table, SLT │ * = any sector │
  188.  run macro    = Run a DFS macro in a REXX .cmd file      └────────────────┘
  189.  q            = Quit FS display; 2.01 06-02-97  (c) 1994-1997; Jan van Wijk
  190.  
  191.  EXTERNALS      Any command not recognized as a valid DFS internal command
  192.                 will be passed to the default command-processor (COMSPEC).
  193.                 Usefull commands: CHKDSK, CD, DIR, ...
  194.                 Note: FDISK, SETBOOT etc will not work if a physical disk
  195.                 is currently opened by DFS itself.
  196.                                                                                
  197. Command reference, general DFS commands
  198. ---------------------------------------
  199.  
  200.  
  201.  disk [nr]    = Select specified physical disk for physical addressing
  202.  
  203.  Purpose:       Select a physical disk
  204.  
  205.  Parameters:    nr      optional   Physical disk number, default is 1
  206.  
  207.  Output:        Disk Geometry and default display of sector 0 (usualy MBR)
  208.  
  209.                 The returncode (rc) will be zero for a valid disk number
  210.                 or equal to the number of disks otherwise.
  211.                 This can be usefull from REXX scripts.
  212.  
  213.  
  214.  walk [nr]    = Walk the MBR/EBR chain of partition-tables for specified disk
  215.  
  216.  Purpose:       Show all partitioning information for the specified disk
  217.  
  218.  Parameters:    nr      optional   Physical disk number, default is 1
  219.  
  220.  Output:        Disk Geometry, MBR and all linked EBR's in partition format
  221.  
  222.  
  223.  lock         = Lock physical disk, to allow writing to it (fixroot)
  224.  
  225.  Purpose:       Lock a physical disk
  226.  
  227.  Parameters:    none
  228.  
  229.  Output:        none
  230.  
  231.  
  232.  unlock       = Unlock physical disk, after writing to it (fixroot)
  233.  
  234.  Purpose:       Unlock a physical disk
  235.  
  236.  Parameters:    none
  237.  
  238.  Output:        none
  239.  
  240.                                                                                
  241.  part [i][th] = Select specified partition
  242.  
  243.  Purpose:       Select a disk partition for analysis
  244.  
  245.  Parameters:    i       optional   Number specifying the partition as shown
  246.                                    by the 'disks' or 'part' commands
  247.                         or   d:    Drive-letter for a partition (part C:)
  248.                         or   +     To get a verbose list
  249.                         or   !     To force a new scan of physical disks
  250.                                    If no parameter is specified the list of
  251.                                    partitions will be displayed.
  252.  
  253.                 th      optional   Start SLT thread automaticaly (HPFS)
  254.                                    When not specified, the SLT will be build
  255.                                    when the 'I' cmd is issued to show the SLT.
  256.  
  257.  Output:        Either the list of partitions or the default display for the
  258.                 first sector of the partition (usualy a boot-sector).
  259.  
  260.  Remarks:       The command "d:" where d is any existing drive-letter will
  261.                 be interpreted as a "part d:" command. This means that the
  262.                 C: partition can be opened just by typing "C:"
  263.  
  264.                 The returncode (rc) will be zero for a valid partition id
  265.                 or equal to the number of partitions otherwise.
  266.                 This can be usefull from REXX scripts.
  267.  
  268.                 An example of the list ouput in table form (default) is:
  269.  
  270. Number of physical disks found: 1
  271. Opened phys. disk : 1          Cyl: 155 H:255 S:63            Size:  1215.9 Mb
  272. Part 4 WARNING: Not formatted (or bootrecord corrupt)
  273. ┌──┬──┬──┬─────────────────┬────────┬────────┬───────────┬────────┬─────────┐
  274. │id│PD│Dr│Type, description│Format  │Creator │Label Info │BM-Name │ Size Mb │
  275. ├──┼──┼──┼─────────────────┼────────┼────────┼───────────┼────────┼─────────┤
  276. │01│ 1│  │Prim 0a Boot Mgr │FAT     │        │«PLATO   » │        │     7.8 │
  277. │02│ 1│C:│Prim 06 FAT >32Mb│FAT     │IBM 20.0│NO NAME    │Prim-31 │    31.4 │
  278. │03│ 1│c │Hide 17 Inst. FS │HPFS    │OS2 20.0│OS2        │PLATO   │   604.0 │
  279. │04│ 1│D:│Log  06 FAT >32Mb│--none--│ fdisk  │           │        │   533.4 │
  280. └──┴──┴──┴─────────────────┴────────┴────────┴───────────┴────────┴─────────┘
  281.  
  282.  Number of physical disks   = The number of disks reported by the system
  283.  Opened phys disk ...       = opened disk with Cylinder, Head, Sector and Size
  284.  Part nn WARNING: ...       = Any informal, strange or alarming conditions
  285.  
  286.  Where:   id                = The selection-id used by DFS for this partition
  287.           PD                = Physical drive number; 1..max
  288.           Dr                = Drive letter, a capital plus a semicolon (C:),
  289.                               or a lowercase drive-letter for hidden partitions
  290.           Type, description = Type-info and hex value of the type, type-info:
  291.                               Prim = Primary (active, accessible)
  292.                               Hide = Hidden  (primary or special)
  293.                               Log  = Logical volume in an extended partition
  294.           Format            = The filesystem format string found in the
  295.                               bootrecord for this partition or --none--
  296.           Creator           = The OEM identification string from the bootrec
  297.                               of "fdisk" if no valid bootrecord is found
  298.           Label Info        = The volumelabel as found in the bootrecord, or
  299.                               the «BM-label» of the current Bootmgr selection
  300.                               Note: The FAT volume-label will not be shown here
  301.           BM-Name           = The name for this partition as registered in
  302.                               the OS/2 boot-manager information area's
  303.           Size Mb           = The gross size of the partition in megabytes     
  304.  
  305.  PSN  xx      = Analyse & display sector using PSN xx
  306.  
  307.  
  308.  Purpose:       Display sector using Physical Sector Number addressing
  309.  
  310.  Parameters:    xx = 1 to 8 hexadecimals
  311.  
  312.  Output:        Sector display, format selected based on sector-contents
  313.  
  314.  Remarks:       The SN is specified in hexadecimal format, however the first
  315.                 digit needs to be decimal to avoid misinterpretation.
  316.                 Prefixing the SN with '0' will avoid any conflicts.
  317.  
  318.                 Output that scrolls of the screen can be repeated using
  319.                 the 't' command. (display 'this' sector)
  320.  CHS c  h  s  = Analyse & display sector using CHS specication
  321.  
  322.  
  323.  Purpose:       Display sector using Cylinder, Head and Sector addressing
  324.  
  325.  Parameters:    c       mandatory  The zero-based decimal Cylinder number
  326.                                    Range 1 to disk-specific maximum and
  327.                                    usualy below 1024.
  328.  
  329.                 h       mandatory  The zero-based decimal Head number
  330.                                    Range 0 to disk-specific maximum but
  331.                                    never more than 255
  332.  
  333.                 s       mandatory  The one-based decimal Sector number
  334.                                    Range 1 to disk-specific maximum but
  335.                                    never more than 63
  336.  
  337.  Output:        Sector display, format selected based on sector-contents
  338.  
  339.  Remarks:       Output that scrolls of the screen can be repeated using
  340.                 the 't' command. (display 'this' sector)
  341.  
  342.                                                                                
  343.  
  344.       xx      = Analyse & display sector, SN xx; xx = 1 to 8 hexadecimals
  345.  
  346.  
  347.  Purpose:       Display a sector in the most usefull format
  348.  
  349.  Parameters:    none
  350.  
  351.  Output:        Sector display, format selected based on sector-contents
  352.  
  353.  Remarks:       The SN is specified in hexadecimal format, however the first
  354.                 digit needs to be decimal to avoid misinterpretation.
  355.                 Prefixing the SN with '0' will avoid any conflicts.
  356.  
  357.                 Logical addressing (LSN) is actualy used, however when a
  358.                 physical disk is selected the offset for logical addressing
  359.                 is set to 0. The result is that LSN's equal PSN's.
  360.  
  361.                 Output that scrolls of the screen can be repeated using
  362.                 the 't' command. (display 'this' sector)
  363.  
  364.  
  365.  
  366.  H,h [xx [s]] = Hex-dump sector or half-sector, LSN xx, s sectors/bytes
  367.  
  368.  Purpose:       Display current or specified sector in hex-dump format
  369.  
  370.  Parameters:    xx      optional   LSN of sector to dump
  371.  
  372.                 s       optional   size to dump:  1..63   specifies sectors
  373.                                                  64..xxx  specifies bytes
  374.                                    Default is 512 bytes for the 'H' command
  375.                                           and 256 bytes for the 'h' command
  376.  
  377.  Output:        Hex-dump of the sector
  378.                 On every line 16 bytes of data will be displayed, each line
  379.                 containing:
  380.                   - the relative offset in the record (4 hex digits)
  381.                   - 16 bytes in hexadecimal; separator after 8 bytes
  382.                   - the same 16 bytes represented as ASCII
  383.  
  384.  Remarks:       The ASCII representation is filtered, non-printable
  385.                 characters are represented with a PERIOD character
  386.  
  387.  
  388.  
  389.  t a|e|h [s]  = This LSN, display in Ascii, Ea or Hex;  s sectors/bytes
  390.  
  391.  Purpose:       Display current sector in ASCII, EA, HEX or default format
  392.  
  393.  Parameters:    a|e|h   optional   Specifies display format as:
  394.                                       a = ASCII
  395.                                       e = EA
  396.                                       h = HEX
  397.                                    none = default (based on sector-contents)
  398.  
  399.                 s       optional   size to dump:  1..63   specifies sectors
  400.                                                  64..xxx  specifies bytes
  401.  
  402.  Output:        Sector display in requested format
  403.  
  404.  Remarks:
  405.  
  406.                                                                                
  407.  f [type [s]] = forward search sector of [type]; containing string [s]
  408.  
  409.  Purpose:       Perform a forward search starting from the current LSN
  410.                 until a sector of the specified type and optionaly
  411.                 containing a specified ASCII/HEX string is found.
  412.  
  413.  Parameters:    type    optional   Type of sector wanted, default is any KNOWN
  414.  
  415.                                    Sectortypes for searching are:
  416.  
  417.                                    u    unidentified data sector
  418.                                    I    file data extent
  419.                                    E    EA data
  420.                                    A    ACL data
  421.                                    b    Boot sector
  422.                                    s    HPFS super-block
  423.                                    p    HPFS spare-block
  424.                                    f    Fnode, dir or file
  425.                                    F    Fnode, file
  426.                                    D    Fnode, directory
  427.                                    a    Allocation sector
  428.                                    d    Directory block
  429.                                    c    Codepage info
  430.                                    t    Codepage data table
  431.                                    i    UserId table (HPFS-386)
  432.                                    m    Bitmap indirect sector
  433.                                    !    any KNOWN type
  434.                                    $    HPFS system sector, non-data
  435.                                    #    Free space
  436.                                    *    any type
  437.  
  438.                 s       optional   A string of bytes that have to be present
  439.                                    in the wanted sector. It can be specified
  440.                                    as a mix of ASCII and HEX.
  441.                                    The starting mode is ASCII, switching to
  442.                                    HEX and back is done with the ' character.
  443.                                    Leading whitespace is skipped.
  444.                                    In HEX mode spaces can be used to improve
  445.                                    readability of the string.
  446.  
  447.                         Example 1: last'0d0a'first
  448.  
  449.                                    This will search for the word "last"
  450.                                    followed by a carriage-return line-feed
  451.                                    combination and the word first
  452.  
  453.                         Example 2: 'e9bd13 0d4023 49 42 4d 3a38 2e'
  454.  
  455.                                    This will search for a byte sequence,
  456.                                    in this case the start of COMMAND.COM
  457.  
  458.  
  459.  Output:        Sector display, format selected based on sector-contents
  460.  
  461.  Remarks:       This command is also very usefull to find a specific fragment
  462.                 of disassembled code anywhere on the disk, to resolve the
  463.                 name of an EXE, DLL or device driver causing traps or hangs.
  464.                                                                                
  465.  
  466.  /hex-ascii   = forward search mixed hex-ascii string in any sector
  467.  
  468.  Purpose:       Like 'f' command, sector-type '*' direction FORWARD
  469.  
  470.  Parameters:    hex-ascii          mixed hex-ascii search-string with no
  471.                                    intervening space after the '/' character
  472.  
  473.  Output:        See 'f' command
  474.  
  475.  Remarks:
  476.  
  477.  
  478.  
  479.  b [type [s]] = backward search sector of [type]; containing string [s]
  480.  
  481.  Purpose:       Like 'f' command with search-direction BACKWARD
  482.  
  483.  Parameters:    See 'f' command
  484.  
  485.  Output:        See 'f' command
  486.  
  487.  Remarks:       Usefull to find the preceding fnode when looking at some
  488.                 random file-data.
  489.  
  490.                 Note: the 'i' command will do this more reliably but depends
  491.                       on the sector-lookup-table to be filled.
  492.  
  493.  
  494.  
  495.  Enter        = down in hierachy (Enter = down)
  496.  
  497.  Purpose:       Display the next, most likely wanted, sector
  498.  
  499.  Parameters:    none
  500.  
  501.  Output:        Sector display, format selected based on sector-contents
  502.  
  503.  Remarks:
  504.  
  505.  
  506.  
  507.  u            = up in hierachy
  508.  
  509.  Purpose:       Display the sector that is higher in the hierarchy (parent)
  510.  
  511.  Parameters:    none
  512.  
  513.  Output:        Sector display, format selected based on sector-contents
  514.  
  515.  Remarks:
  516.  
  517.  
  518.                                                                                
  519.  
  520.  F            = forward in a sequence
  521.  
  522.  Purpose:       Display the next sector
  523.  
  524.  Parameters:    none
  525.  
  526.  Output:        Sector display, format selected based on sector-contents
  527.  
  528.  Remarks:
  529.  
  530.  
  531.  
  532.  B            = backward in a sequence
  533.  
  534.  Purpose:       Display the previous sector
  535.  
  536.  Parameters:    none
  537.  
  538.  Output:        Sector display, format selected based on sector-contents
  539.  
  540.  Remarks:
  541.  
  542.  
  543.  
  544.  x            = Extra LSN
  545.  
  546.  Purpose:       Display the sector marked as eXtra
  547.  
  548.  Parameters:    none
  549.  
  550.  Output:        Sector display, format selected based on sector-contents
  551.  
  552.  Remarks:
  553.  
  554.  
  555.  
  556.  o            = Original LSN
  557.  
  558.  Purpose:       Display the sector marked as Original
  559.  
  560.  Parameters:    none
  561.  
  562.  Output:        Sector display, format selected based on sector-contents
  563.  
  564.  Remarks:       Equals Root directory Fnode, most of the time
  565.  
  566.  
  567.                                                                                
  568.  
  569.  log [file]   = Log to 'file' ('log' without parameters = stop log)
  570.  
  571.  Purpose:       Close current LOG, open new and capture DFS output in it
  572.  
  573.  Parameters:    File specification
  574.                 If no parameter is specified, logging is stopped.
  575.  
  576.  Output:        Concatenated output of DFS commands given after the
  577.                 'log' command, upto next 'log' or 'q' command.
  578.                 ANSI control characters for colors and cursor-positioning
  579.                 are not written to the logfile.
  580.  
  581.  Remarks:       There is no check on available space on the destination
  582.                 drive, file may end up empty if disk(ette) is full.
  583.  
  584.                 The same logfile specification can be used more than once,
  585.                 output will be concatenated.
  586.  
  587.                 On each 'log' command the current logfile will be closed.
  588.  
  589.  
  590.  
  591.  trace [lvl]  = Set trace level for DHPFS internal functions
  592.  
  593.  Purpose:       Investigate unexpected behaviour and debug DFS
  594.  
  595.  Parameters:    lvl     optional   Trace level; 0 = no trace
  596.  
  597.  Output:        The resulting trace-level, after this the output will be
  598.                 normal output mixed with extra trace information showing
  599.                 API return-codes and DFS internal variables
  600.  
  601.  Remarks:       Only available in the special DFSTRACE.EXE version
  602.  
  603.  
  604.  
  605.  q            = Quit FS display; 2.01 06-02-97  (c) 1994-1997; Jan van Wijk
  606.  
  607.  Purpose:       Exit DFS program
  608.  
  609.  Remarks:       Opened physical disk and logfile will be closed on exit
  610.                 Asynchronious running threads will be aborted.
  611.  
  612.  
  613.  
  614.  cd [path]    = Change current Directory
  615.  
  616.  Purpose:       Change both the current directory and the current drive
  617.  
  618.  Parameters:    path    optional   Absolute or relative path specification
  619.  
  620.  Output:        The resulting current drive and directory
  621.  
  622.  Remarks:       '.' and '..' can be used in the relative path specification
  623.  
  624.                                                                                
  625.  run mf [arg] = Run a REXX macro from DFS
  626.  
  627.  Purpose:       Execute a REXX script using the 'DFS' environment
  628.  
  629.  Parameters:    mf      mandatory  Macro file specification
  630.  
  631.                 arg     optional   Arguments to the REXX macro
  632.  
  633.  Output:        Any output from the REXX macro including (OS/2) commands
  634.                 executed from the macro.
  635.  
  636.  Remarks:       DFS commands can be issued from within the macro, this
  637.                 is the default environment (Address DFS).
  638.                 Commands for CMD.EXE must be addressed using 'Address Cmd'
  639.  
  640.                 The following REXX variables will be available after
  641.                 each executed DFS command from a macro:
  642.  
  643.                 rc            The returncode from the DFS command
  644.  
  645.                 dfs_disknr    Physical disk number currently open
  646.                 dfs_partid    Partition-id for selection with "part"
  647.                 dfs_drive     The opened drive letter, including a colon.
  648.                 dfs_afsys     The attached filesystem, like "HPFS" or "FAT"
  649.                 dfs_sect      The last retrieved sector(s), binary buffer
  650.                 dfs_type      Type of last retrieved sector, this is a string
  651.                               starting with the type-character (see 'F' cmd)
  652.                               followed by a textual description.
  653.  
  654.                 dfs_this      SN of the last retrieved sector
  655.                 dfs_down      SN of most likely sector to retrieve now
  656.                 dfs_up        SN of sector up in hierarchy
  657.                 dfs_next      SN of next in sequence
  658.                 dfs_prev      SN of previous in sequence
  659.                 dfs_down      SN of up in hierarchy
  660.  
  661.                 dfs_sn.0      Number of sector-numbers in the SN stem variable
  662.                 dfs_sn.n      nth sector-number in the SN stem variable, coming
  663.                               from DFS output for directories and allocation.
  664.                               They correspond to the '.NNN' command
  665.  
  666.                               Note: SN's are in an 8-digit Hexadecimal format
  667.  
  668.                 The number of disks and partitions can be resolved using the
  669.                 returncode (rc) from the commands "disk 0" and "part 0" or
  670.                 "part" respectively.
  671.  
  672.                 REXX is dynamically loaded, when the run-command is exectuted
  673.                 It requires REXX.DLL and REXXAPI.DLL in the libpath.
  674.  
  675.  
  676.  copyoutput [stem-name]      Copy output from last-command to REXX stem-var
  677.  
  678.  Purpose:       Allow output to be captured and processed from REXX
  679.  
  680.  Parameters:    stem    optional   name of stem variable, ending in a '.'
  681.                         default:   "dfs_output."
  682.  
  683.  Output:        none
  684.  
  685.  Remarks:       The <stem>.0 will hold the number of lines
  686.                 <stem>.1 through <stem>.n the actual cmd-output
  687.                                                                                
  688.  
  689.  screen [arg] = Switch output to the screen on or off
  690.  
  691.  Purpose:       Allow output to logfile only
  692.  
  693.  Parameters:    arg     optional   'on' or 'off' to switch mode
  694.  
  695.  Output:        none
  696.  
  697.  Remarks:       The returncode (rc from REXX) will indicate the setting for
  698.                 screen output: 0 indicates screen switched on
  699.                                1 indicates screen switched off
  700.  
  701.  
  702.  EXTERNALS      Any command not recognized as a valid DFS internal command
  703.                 will be passed to the default command-processor (COMSPEC).
  704.  
  705.  Purpose:       Allow execution of external commands like CHKDSK, DIR etc.
  706.  
  707.  Parameters:    As required by the external command
  708.  
  709.  Output:        Any output by the command
  710.  
  711.  Remarks:       Output on stdout and stderr will be redirected to the logfile
  712.  
  713.                                                                                
  714. Command reference, HPFS specific commands
  715. -----------------------------------------
  716.  
  717.  .NNN         = Display numbered directory- or allocation-entry marked .NNN
  718.  
  719.  Purpose:       Display one of the entries from the list last shown
  720.                 It can be applied on Directory- as well as Allocation-lists
  721.                 The number (NNN) to use is displayed to the left of the list
  722.  
  723.  Parameters:    NNN                The zero-based decimal entry number to show
  724.  
  725.  Output:        Sector display, format selected based on sector-contents
  726.  
  727.  
  728.  
  729.  a            = Allocation bitmaps, compact format
  730.  
  731.  Purpose:       Show usage of the volume and the distribution of data over
  732.                 the volume.
  733.  
  734.  Parameters:    none
  735.  
  736.  Output:        A single bitmap-graphic for the entire volume
  737.  
  738.  Remarks:       System-reserved and Directory-band are indicated with 'S'
  739.                 and 'R' respectively. Other area's are filled in according
  740.                 to the degree of usage (allocation)
  741.  
  742.  
  743.  M [xx [s]]   = Allocation bitmaps, verbose format
  744.  
  745.  Purpose:       Show usage of the volume and the distribution of data over
  746.                 the volume for each allocation band.
  747.  
  748.  Parameters:    xx      optional   LSN of a bitmap sector
  749.  
  750.                 s       optional   size to dump:  1..63   specifies sectors
  751.                                                  64..xxx  specifies bytes
  752.                                    Default is 4 sectors (default bitmap size)
  753.  
  754.  Output:        A bitmap-graphic for every allocation-band of 8Mb when no
  755.                 parameters are specified, or one bitmap-graphic for the
  756.                 specified bitmap LSN.
  757.  
  758.  Remarks:       Specifying an LSN that is not a bitmap-LSN will result in
  759.                 a garbage bitmap display.
  760.  
  761.  
  762.  m            = Directory allocation bitmap; usage of pre-allocated space
  763.  
  764.  Purpose:       Show usage of the pre-allocated directory-band
  765.  
  766.  Parameters:    none
  767.  
  768.  Output:        A single bitmap-graphic showing the allocationof the
  769.                 pre-allocated directory band.
  770.  
  771.  Remarks:       If 100% is allocated more directory information will be
  772.                 allocated elsewhere on the volume.
  773.                                                                                
  774.  
  775.  \path-spec   = find and show file/directory specified by path-spec
  776.  
  777.  Purpose:       Locate the fnode for a known file- or directory
  778.  
  779.  Parameters:    path-spec          full path specification with no intervening
  780.                                    space after the '\' command character
  781.  
  782.                               or   absolute- or relative path specification
  783.                                    with an intervening space. If the path
  784.                                    does not start with a '\' it is relative
  785.                                    to the current directory (see CD cmd).
  786.  
  787.  Output:        Searchlist starting at the ROOT directory upto the requested
  788.                 file or directory. It is either followed by an error message
  789.                 if the path-spec was not found or by the display of the
  790.                 corresponding fnode information.
  791.  
  792.  Remarks:       The search algorithm depends on the ROOT fnode being known.
  793.                 When the superblock is corrupt this fnode can be resolved
  794.                 using the 'findroot' command.
  795.  
  796.  
  797.  
  798.  findroot [n] = find the Root directory without using the superblock
  799.  
  800.  Purpose:       Find the fnode for the ROOT directory, even if parts of
  801.                 the volume, including the superblock, are damaged.
  802.  
  803.  Parameters:    n           optional   Start LSN for the search
  804.  
  805.  Output:        Search-list starting at the first fnode encountered upto
  806.                 the fnode for the ROOT directory when found.
  807.  
  808.  Remarks:       Specifying a startlsn might be needed if reading at the
  809.                 start of the volume results in device errors, or if some
  810.                 fnodes in the sequence are corrupted.
  811.  
  812.                                                                                
  813.  fixroot      = Write the root-LSN found with the 'findroot' command back
  814.  
  815.  Purpose:       Fix bad Root-LSN pointer, caused by CHKDSK bugs or
  816.                 other corruption
  817.  
  818.  Parameters:    none
  819.  
  820.  Output:        none
  821.  
  822.  Remarks:       It is better to lock the physical before writing to it
  823.                 See 'lock' and 'unlock' commands
  824.  
  825.  
  826.  fixcp        = Write the CodePage-LSN found with the '0#f c' command back
  827.  
  828.  Purpose:       Fix bad CodePage-LSN pointer, caused by CHKDSK bugs or
  829.                 other corruption
  830.  
  831.  Parameters:    none
  832.  
  833.  Output:        none
  834.  
  835.  Remarks:       It is better to lock the physical before writing to it
  836.                 See 'lock' and 'unlock' commands
  837.  
  838.  
  839.  saveto p [n] = Save contents of a file to a safe-copy on another disk
  840.  
  841.  Purpose:       Recover a file if the fnode can still be found, by making
  842.                 a low-level sector-by-sector copy of its data to a new file.
  843.  
  844.  Parameters:    p           mandatory  Path to save the file copy (existing!)
  845.  
  846.                 n           optional   LSN of the fnode of the file to recover
  847.                                        default is the current LSN (This)
  848.  Output:        none
  849.  
  850.  Remarks:       Only the file contents is recovered, date&time, attributes
  851.                 and extended attributes are lost.
  852.  
  853.                                                                                
  854.  
  855.  I [t i s m]  = Show SLT for 'type', at index i, size s, error-mask m
  856.  
  857.  Purpose:       Display (selection of) the Sector Lookup Table
  858.  
  859.  Parameters:    t       optional   Sector-types to include in the displayed
  860.                                    list. Default is all types ('*')
  861.                                    Types are same as specified for 'f' cmd
  862.  
  863.                 i       optional   Start index in the SLT to display
  864.  
  865.                 s       optional   Number of entries to display, default
  866.                                    will result in one screen-full
  867.  
  868.                 m       optional   Error filtering mask, * = all errors
  869.                                    4-digit Hexadecimal value, each set bit
  870.                                    will include a specific error value.
  871.  
  872.  
  873.  Output:        One line for each entry in the SLT, containing:
  874.                         LSN        Start LSN for a range of sectors
  875.                         size       Number of sectors in the range
  876.                         ref        Other sector refering to this range (fnode)
  877.                         type       Type of the sectors in the range
  878.                         error      4-digit Hexadecimal error value:
  879.  
  880.                            0x0001  Linked to some structure, but not in bitmap
  881.                            0x0002  Allocated in bitmap, but not linked
  882.                            0x0008  Fnode is a directory but DirFlag is not set
  883.                            0x0010  Fnode datalength greater than Dir-entry size
  884.                            0x0020  Fnode datalength smaller than Dir-entry size
  885.                            0x0040  Fnode datalength greater than allocated size
  886.                            0x0080  Fnode datalength smaller than allocated size
  887.  
  888.  Remarks:       Sector ranges might overlap, the smallest matching range will
  889.                 hold the best identification for a specific sector.
  890.  
  891.                 The start-index will default to the position of the sector
  892.                 last searched using the 'i' cmd.
  893.  
  894.  
  895.  i [xx]       = Identify, using sector lookup table
  896.  
  897.  Purpose:       Display the type for a specific sector and one major reference
  898.  
  899.  Parameters:    xx      optional   LSN of sector to identify, default is
  900.                                    the current sector
  901.  
  902.  Output:        One line specifying corresponding SLT entry, followed by
  903.                 a line specifying the type of the sector itself and a
  904.                 sector display of the 'ref' sector, in a format based
  905.                 on sector-contents
  906.  
  907.  Remarks:       Sector ranges might overlap, the smallest matching range will
  908.                 be considered best.
  909.  
  910.                 This function is extremely usefull to relate file-data sectors
  911.                 from fragmented files to the Fnode for the file.
  912.                 It will tell you exactly to wich file a certain sector belongs.
  913.  
  914.                                                                                
  915. Diagram of an example HPFS structure
  916.  
  917.  Basic HPFS data-structure for Root-directory with AUTOEXEC.BAT, README file,
  918.  an OS2 subdirectory and lots of other files. The README file has it's data
  919.  allocated in 2 alloc-chunks.
  920.  
  921.  ╔═════════╗                  ╔══════════════════╗       ╔═══════╗
  922.  ║SUPER    ║              ┌──>║ DIR block        ║   ┌──>║ FNODE ║
  923.  ║         ║              │   ║                  ║   │   ║       ║
  924.  ║         ║    ╔═══════╗ │   ║┌────────────────┐║   │   ║       ║  ╔══════════
  925.  ║Root LSN ────>║ FNODE ║ │   ║│*Special**Start*│║   │   ║ ALLOC ──>║ DIR block
  926.  ╚═════════╝    ║       ║ │   ║│entry FNODE  LSN│║   │   ╚═══════╝  ║
  927.                 ║       ║ │   ║│BtreeDownPtr LSN│║   │              ║┌─────────
  928.                 ║ ALLOC ──┘   ║└────────────────┘║   │              ║│8514.RC
  929.                 ╚═══════╝     ║┌────────────────┐║   │              ║│entry FNO
  930.                               ║│OS2 (subdir)    │║   │              ║│BtreeDown
  931.                               ║│entry FNODE  LSN├────┘              ║└─────────
  932.  ┌─────────────────────────────┤BtreeDownPtr LSN│║                  ║┌─────────
  933.  │                            ║└────────────────┘║                  ║│ANSI.EXE
  934.  │                            ║┌────────────────┐║
  935.  │                            ║│Special-end     │║
  936.  │  ╔══════════════════╗      ║│entry FNODE  LSN│║       ╔══════════════════╗
  937.  └─>║ DIR block        ║      ║│BtreeDownPtr LSN├───────>║ DIR block        ║
  938.     ║┌────────────────┐║      ║└────────────────┘║       ║┌────────────────┐║
  939.     ║│*Special**Start*│║      ╚══════════════════╝       ║│*Special**Start*│║
  940.     ║│entry FNODE  LSN│║                                 ║│entry FNODE  LSN│║
  941.     ║│BtreeDownPtr LSN│║     ╔═══════╗                   ║│BtreeDownPtr LSN│║
  942.     ║└────────────────┘║  ┌─>║ FNODE ║                   ║└────────────────┘║
  943.     ║┌────────────────┐║  │  ║       ║                   ║┌────────────────┐║
  944.     ║│AUTOEXEC.BAT    │║  │  ║       ║  ╔═══════════     ║│PP... filename  │║
  945.     ║│entry FNODE  LSN├───┘  ║ ALLOC ──>║┌──────────     ║│entry FNODE  LSN│║
  946.     ║│BtreeDownPtr LSN│║     ╚═══════╝  ║│ 1st data-     ║│BtreeDownPtr LSN│║
  947.     ║└────────────────┘║                ║└──────────     ║└────────────────┘║
  948.     ║┌────────────────┐║                                 ║┌────────────────┐║
  949.     ║│OS1.. filename  │║                                 ║│README filename │║
  950.     ║│entry FNODE  LSN│║      ┌───────────────────────────┤entry FNODE  LSN│║
  951.     ║│BtreeDownPtr LSN│║      │                          ║│BtreeDownPtr LSN│║
  952.     ║└────────────────┘║      │                          ║└────────────────┘║
  953.     ║┌────────────────┐║      │                          ║┌────────────────┐║
  954.     ║│**Special**End**│║      │                          ║│XXX... filename │║
  955.     ║│entry FNODE  LSN│║      │                          ║│entry FNODE  LSN│║
  956.     ║│BtreeDownPtr LSN│║      │                          ║│BtreeDownPtr LSN│║
  957.     ║└────────────────┘║      │                          ║└────────────────┘║
  958.     ╚══════════════════╝      │                          ║┌────────────────┐║
  959.                               │                          ║│**Special**End**│║
  960.                               │                          ║│entry FNODE  LSN│║
  961.                               │                          ║│BtreeDownPtr LSN│║
  962.                               │                          ║└────────────────┘║
  963.                               │                          ╚══════════════════╝
  964.                               │
  965.                               │                    ╔════════════════════════╗
  966.                               │               ┌───>║┌──────────────────────┐║
  967.                               │               │    ║│ 1st data-sector      │║
  968.                               │               │    ║└──────────────────────┘║
  969.                               │               │    ║┌──────────────────────┐║
  970.                               │  ╔═══════╗    │    ║│ 2nd data-sector      │║
  971.                               └─>║ FNODE ║    │    ║└──────────────────────┘║
  972.                                  ║       ║    │    ╚════════════════════════╝
  973.                                  ║       ─────┘
  974.                                  ║ ALLOC ║         ╔════════════════════════╗
  975.                                  ║       ─────────>║┌──────────────────────┐║
  976.                                  ╚═══════╝         ║│ 3rd data-sector      │║
  977.                                                    ║└──────────────────────┘║
  978.     (c) 1995                                       ║┌──────────────────────┐║
  979.     J. v. Wijk                                     ║│ 4th data-                
  980.  
  981. Examples of DFS usage
  982. ---------------------
  983.  
  984.  1) Resolve original name of FILExxxx.CHK files (created by CHKDSK)
  985.  
  986.     When CHKDSK recovers files it will place in a FOUND.xxx directory in
  987.     the root-directory. This directory contains one or more recovered files
  988.     with names like FILE0001.CHK
  989.  
  990.     The original name of the file is still in the Fnode, it can be shown
  991.     using the following dhpfs commands (assuming drive c:) :
  992.  
  993.     Command                            Explanation
  994.  
  995.     DFS disks                          Start DFS and scan physical disks
  996.     part id                            Select partition 'id' (must be HPFS)
  997.     \found.000\file0001.chk            Search and display Fnode for .CHK
  998.  
  999.     Now 15 characters of the original name are shown as "Fnode Name String"
  1000.  
  1001.  
  1002.                                                                                
  1003.  
  1004. Known limitations
  1005. -----------------
  1006.  
  1007.  To be refined
  1008.  
  1009.  
  1010. Considered improvements
  1011. -----------------------
  1012.  
  1013.  Automatic detection of inconsistencies (like CHKDSK, HVA and CHKPART)
  1014.  
  1015.    This will show HPFS problems like CHKDSK does, but in more detail and
  1016.    maybe some more types of inconsistencies.
  1017.    Note: Basic HPFS functionality implemented in version 1.62
  1018.          Some partitioning errors implemented in version 1.82
  1019.  
  1020.  
  1021.  Better coverage of HPFS386 specific structures and fields
  1022.  
  1023.    This should allow full-coverage of the Access-control lists and other
  1024.    HPFS386 specific information.
  1025.  
  1026.  
  1027.  Coverage of other file-systems besides HPFS like FAT, LINUX, NTFS ...
  1028.  
  1029.  
  1030.  Graphical User Interface, using IBM Class Library
  1031.  
  1032.    This could make the program easier to use, however it also makes
  1033.    the program requirements less attractive becaus it uses PM/WPS.
  1034.    A command-line version will allways be available to allow operation
  1035.    from a minimal (diskette) system.
  1036.  
  1037.  
  1038.  Write capability,
  1039.  
  1040.    This will allow recovery operations without using other (third-party)
  1041.    utilities. This will require locking the entire disk so usage is
  1042.    often limited to diskette BOOT.
  1043.  
  1044.  Recovery for deleted files (undelete)
  1045.  
  1046.  Recovery for a 'quick format' on HPFS (unformat)
  1047.