home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Spezial / SPEZIAL2_97.zip / SPEZIAL2_97.iso / ANWEND / TOOLS / DFS240S / dfs.doc < prev    next >
Text File  |  1997-09-05  |  69KB  |  1,499 lines

  1.  
  2.    Display File Systems; version 2.40 06-09-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                              20
  13.  Diagram of an example HPFS structure                                   25
  14.  Examples of DFS usage                                                  26
  15.  Known limitations                                                      28
  16.  Considered improvements                                                28
  17.  
  18.  
  19.  
  20.  
  21. Introduction, purpose of the program
  22. ------------------------------------
  23.  
  24.  The DFS program is a disk and filesystem browser with an emphasis on the
  25.  HPFS filesystem and disk partitioning.
  26.  It will support different file-systems besides HPFS sometime in the future.
  27.  
  28.  The program has been built while studying the HPFS filesystem.
  29.  It's main purpose is getting to understand the file-system as it resides
  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 years 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 excellent lectures
  37.  "HPFS Internals" at the 1994, 95 and 96 ColoradOS/2 conferences by
  38.  Doug Azzarito and on peeking arround on a lot of HPFS volumes using DFS.
  39.  
  40.  Further improvements will probably be in more advanced recovery commands
  41.  and other filesystems like FAT and NTFS.
  42.  Also a port to NT itself is finished and under test right now.
  43.  
  44.  
  45. Availability
  46. ------------
  47.  
  48.  1) IBM internal: REQUEST DFS FROM NLX0093 at EAMSVM1
  49.  
  50.  2) Compuserve:   GO OS2BVEN, open Filemanagers library section;  DFS.ZIP
  51.  
  52.  3) HOBBES (WWW): ftp://hobbes.nmsu.edu/pub/os2/util/diskutil/DFSxxxS.ZIP
  53.     or shadow:    ftp://ftp.cdrom.com/pub/os2/util/diskutil/DFSxxxS.ZIP
  54.  
  55.  You can also download this and some other software and information from
  56.  my homepage at Compuserve:
  57.  
  58.                          http://ourworld.compuserve.com/homepages/jvwijk
  59.  
  60.  On special (e-mail) request a 16-bit OS/2, tracing/debug versions and
  61.  the (beta) Win NT version are also available.
  62.  
  63.                                                                               
  64. Status of the program
  65. ---------------------
  66.  
  67.  This version of the program is free for anyone to use, it was written
  68.  in my own time using my own equipment.
  69.  
  70.  However, I would very much appreciate any feedback by e-mail or a simple
  71.  postcard to:
  72.                             ┌───────────────────┐
  73.                             │  Jan van Wijk     │
  74.                             │  Blekerstraat 83  │
  75.                             │  1315 AC  Almere  │
  76.                             │  Netherlands      │
  77.                             └───────────────────┘
  78.  
  79.  If you supply an e-mail address you will be put on the DFS mailing-list.
  80.  
  81.  
  82.  Further development depends on my own needs and feedback I receive from
  83.  other users, al work has to be done on spare time...
  84.  Improved versions of the program might be in the form of SHAREWARE.
  85.  
  86.  Suggestions and other comments regarding DFS and filesystems are welcome.
  87.  
  88.  You can reach me at my userid at CompuServe: 100603,2437 or jvwijk
  89.  
  90.                      or through the Internet: jan.van.wijk@cmg.nl
  91.                                           or: jvwijk@compuserve.com
  92.                                           or: janvw@ibm.net
  93.  
  94.  
  95.  
  96. Change History
  97. --------------
  98. 1.00  27-11-94     DHPFS initial version, hex dump super+spare blocks
  99. 1.39  20-07-95     32-bit port; Sector Lookup table; bug-fixes
  100. 1.52  13-09-95     new '/' cmd shortcut; First released version!     <== BBS
  101. 1.56  26-09-95     RUN cmd runs REXX dhpfs macro's
  102. 1.62  13-10-95     Added Free-space and inconsistency reporting
  103. 1.64  16-10-95     Cleanup for delivery on ColoradOS/2 CDROM
  104. 1.69  24-06-96     Fixed trap on non-HPFS volumes (open FAT, Enter ==> trap)
  105. 1.70  20-12-96     Update ColoradOS/2, DASD limits; REQUESTABLE (OS2FISYS forum)
  106. 1.84  14-01-97     DFS first distributed version to include partitioning info
  107. 1.87  19-01-97     Fixed MBR/EBR walk; multiple cmds using #, BM-labels in part
  108. 1.90  20-01-97     New fixroot and saveto commands for recovery actions (KULVM)
  109. 1.91  21-01-97     New fixcp command to fix CodePage reference          (KULVM)
  110. 1.96  27-01-97     Dynamic loading of REXX support
  111. 2.00  03-02-97     Removable media (NEWDASD); (part) D: cmd; invisible primary
  112. 2.01  06-02-97     CopyOutput command for REXX
  113. 2.06  16-03-97     Updated ACL support on HPFS386; Scan badsectors
  114. 2.08  25-03-97     Added cluster/bytes-per-sector knowledge for partitions
  115. 2.12  06-04-97     Added logical volume support using "DASD" type access
  116. 2.20  19-05-97     Win NT beta version; Search speedup; prio command; cleanup
  117. 2.22  28-05-97     Final preparation for other file-system support; cleanup
  118. 2.24  10-06-97     Added Img and Sim commands; date/time on dirblocks;
  119. 2.25  15-06-97     Added Wrim command; Improved lock implementation (nested)
  120. 2.27  19-06-97     Base cmd; Fixed bug in HPFS "saveto" cmd
  121. 2.28  21-06-97     Added autobase command for HPFS (find HPFS partition start)
  122. 2.29  29-06-97     Fixed Bootmgr clustersize; added Deleted Fnode/Alloc support
  123. 2.30  06-07-97     Improved 'find' syntax and functionality; Undelete support
  124. 2.31  13-07-97     Fixed case-insensitive find, '+' option; fix dirmap % error
  125. 2.32  20-07-97     Reporting & ALBLK fixes to saveto; new "ca" cmd CheckAlloc
  126. 2.33  27-07-97     Fnode & Alloc display update; minor fixes
  127. 2.35  18-08-97     Path info in Fnode display and "list" output; MEM cmd
  128. 2.37  24-08-97     Path display on find Fnode; Wildcard select on list +f
  129. 2.40  06-09-97     import/export of LSN lists; getbs/fixbs badsector mgmt
  130.                                                                               
  131. Terminology used
  132. ----------------
  133.  
  134.  Sector         512 bytes of data (although other sizes exist!)
  135.                 This is the smallest amount of data manipulated by the
  136.                 disk subsystems and is also the basic allocation-unit
  137.                 for the HPFS file-system
  138.  
  139.  CHS            Cylinder Head Sector (addressing)
  140.                 This is the classical way of addressing physical sectors
  141.                 on a disk. It is used in the PC's BIOS, in partition tables
  142.                 and in low-level disk-IO API's (IOCTL, INT-13).
  143.                 In most implementations the addressing ranges are limitted
  144.                 causing all sorts of problems with large disks/partitions.
  145.                 Example: maximum cylinder=1024 limit for BIOS/INT-13
  146.  
  147.  PSN            Physical Sector Number
  148.                 This is the zero-based, unsigned-LONG, number for a
  149.                 sector on a physical disk. Addressing on a disk using
  150.                 PSN's id often refered to as Relative Block Addressing
  151.                 (RBA) or Logical Block Addressing (LBA)
  152.  
  153.  LSN            Logical Sector Number
  154.                 This is the zero-based, unsigned-LONG, number for a
  155.                 sector on a logical partition. The partition can be seen
  156.                 as a linear sequence of sectors.
  157.  
  158.  LSN-list       An internal list of LSN's maintained by DFS for search-results,
  159.                 Directory-contents, Bad-sectors and generic LSN 'memory'.
  160.  
  161.  SLT            Sector/Cluster Lookup Table
  162.                 An array of information about sectors or groups of sectors,
  163.                 containing the type of the sector(s) and the LSN of a
  164.                 directly related sector (usualy an Fnode).
  165.                 It is currently implemented for HPFS only.
  166.  
  167.  Cluster        A (small) group of adjecent sectors that are handled by the
  168.                 operating system as one allocation-unit.
  169.                 It is used on FAT filesystems to allow large partitions at
  170.                 the cost of more wasted "slack" space, and on NTFS to balance
  171.                 performance, slack-space etc.
  172.                 HPFS does not use sector-clustering (or a cluster-size of 1!)
  173.  
  174.                 DFS will try to account for clustering where needed, for
  175.                 example in size calculations and where sector/cluster pointers
  176.                 are used in the file-system internal structures.
  177.  
  178.                                                                               
  179.  
  180.  Partition      An area on a physical disk that holds a single logical
  181.                 file-system like FAT, HPFS, Boot-manager, NTFS etc.
  182.                 There is an index to find partitions in the form of a
  183.                 set of partition-tables in the MBR/EBR chain.
  184.  
  185.  MBR            Master Boot Record
  186.                 The first sector on the physical disk, located at PSN 0 =
  187.                 Cylinder 0, Head 0, Sector 1
  188.                 It contains the initial boot code called from the BIOS and
  189.                 the main partition table that holds the primary partitions
  190.                 and the start of the chain of extended boot records (EBR).
  191.  
  192.  EBR            Extended Boot Record
  193.                 It contains no boot code but only a partition table that
  194.                 holds the location of a single logical partitions.
  195.                 It usualy is located on the cylinder just before the actual
  196.                 logical partition itself, at Head 0, Sector 1.
  197.                 Each EBR will also point to the next EBR if more logical
  198.                 partitions exist on the same disk.
  199.  
  200.  Volume         A logical volume as seen by the active operating system,
  201.                 with a logical drive-letter associated to it.
  202.                 It can be either a hard-disk partition with a filesystem
  203.                 recognized and mounted by the operating system, or some
  204.                 other storage-medium like floppy disk or CD-Rom.
  205.                 Note: Network drives or other "virtual" file-systems can also
  206.                       be refered to as volumes. However, DFS will not be able
  207.                       to access them because such devices usualy cannot be
  208.                       accessed using "open volume" (DASD) methods.
  209.  
  210.  Shortname      The leading part of a filename, as contained in an HPFS fnode
  211.                 and usefull for undelete. The maximum length is 15 characters
  212.  
  213.                                                                               
  214. Summary of commands
  215. -------------------
  216.  
  217.  DFS takes commands from the keyboard and displays the results to the screen,
  218.  scrolling text upward. It can also be copied to a file for later analysis.
  219.  
  220.  The commands are single words or (hexadecimal) numbers.
  221.  Most commands have one or more parameters of wich some are optional.
  222.  
  223.  DFS keeps track of the current- and some other usefull SN's so they
  224.  can be referenced faster, without having to type them in. They are:
  225.  
  226.      Name          Cmd       Description
  227.      ----          ---       -----------
  228.      up            'u'       up in hierarchy
  229.      down          Enter     down in hierarchy
  230.      this          't'       this (current)
  231.      xtra          'x'       Extra, alternative
  232.  
  233.  You can display and analyse either a physical disk, a partition or a volume.
  234.  A physical disk can be opened using the 'disk' command.
  235.  
  236.  A logical-partition or volume needs to be opened first with the 'part' or
  237.  'vol' commands respectively. The following prompt will show some status info.
  238.  After opening an HPFS partition, using 'Enter' a few times will take you
  239.  to the superblock, root-directory, possible sub-directories upto some file.
  240.  
  241.  Multiple commands can be chained if separated with the '#' character.
  242.  
  243.  An overview of the available commands is given below, it can also be
  244.  referenced from within the program using the '?' command.
  245.  
  246.  im   img         = Open a file with a FS-image (.img) for display & analysis
  247.  sim  img [f [s]] = Save to FS-image, starting from LSN [f], size [s] sectors
  248.  wrim img [f [s]] = Write FS-image to disk-sectors start at LSN [f], size [s]
  249.  export  [id][fn] = Export  LSN's in sector list [id], to   file [fn]
  250.  import  [id][fn] = Import  LSN's to sector list [id], from file [fn]
  251.  ??               = Show active filesystem name, commands and help info
  252.  ???              = Show all recognized sector-types for current filesystem
  253.  part [dr/nr][No] = Show partitions,  or select one using nr or drive-letter
  254.  vol  [drive][No] = Show all volumes, or select one using drive-letter
  255.       xx          = Analyse & display sector, SN xx; xx = 1 to 8 hexadecimals
  256.  H,h  xx   [size] = Hex-dump sector or half-sector, SN xx, s sectors or bytes
  257.  t a|h     [size] = This SN, display in Ascii/Hexadecimal, s sectors or bytes
  258.  .NNN [id]        = Display numbered FS-entity marked .NNN from a sector list
  259.  list [id+op] [w] = Display LSN's in sector list [id], using options/wildcard
  260.  mem  [c|lsn] [#] = Store LSN in MEMory list at loc #, or limit mem list-size
  261.  SLT  [type i ln] = Display SLT for sectors of 'type' at index i, ln lines
  262.  id          [xx] = Identify current or specified sector, using the SLT
  263.  f[op] [t] [str]] = Find [options] sectors of [t]ypes containing [str]
  264.       options are : * = repeat; - = backward; $ = Ign-case; @[pos] = position
  265.  Enter, u, x      = Show next with <Enter>, up with 'u' or extra LSN with 'x'
  266.  walk    [disknr] = Select a physical disk and walk the MBR/EBR chain
  267.  scan [wr [NoId]] = Scan bad-sectors; use read/Write verify; No automatic id
  268.  log       [file] = Log (append) to 'file' (.log); (No file => stop logging)
  269.  run macro        = Run a DFS macro in a REXX .cmd file
  270.  q                = Quit FS display; 2.40 06-09-97  (c) 1994-1997; Jan van Wijk
  271.  
  272.  EXTERNALS      Any command not recognized as a valid DFS internal command
  273.                 will be passed to the default command-processor (COMSPEC).
  274.                 Usefull commands: CHKDSK, CD, DIR, ...
  275.                 Note: FDISK, SETBOOT etc will not work if a physical disk
  276.                 is currently opened by DFS itself.
  277.                                                                               
  278. Command reference, general DFS commands
  279. ---------------------------------------
  280.  
  281.  
  282.  disk [nr]    = Select specified physical disk for physical addressing
  283.  
  284.  Purpose:       Select a physical disk
  285.  
  286.  Parameters:    nr      optional   Physical disk number, default is 1
  287.  
  288.  Output:        Disk Geometry and default display of sector 0 (usualy MBR)
  289.  
  290.                 The returncode (rc) will be zero for a valid disk number
  291.                 or equal to the number of disks otherwise.
  292.                 This can be usefull from REXX scripts.
  293.  
  294.  
  295.  walk [nr]    = Walk the MBR/EBR chain of partition-tables for specified disk
  296.  
  297.  Purpose:       Show all partitioning information for the specified disk
  298.  
  299.  Parameters:    nr      optional   Physical disk number, default is 1
  300.  
  301.  Output:        Disk Geometry, MBR and all linked EBR's in partition format
  302.  
  303.  
  304.  lock         = Lock physical disk, to allow writing to it (fixroot)
  305.  
  306.  Purpose:       Lock a physical disk
  307.  
  308.  Parameters:    none
  309.  
  310.  Output:        none
  311.  
  312.  
  313.  unlock       = Unlock physical disk, after writing to it (fixroot)
  314.  
  315.  Purpose:       Unlock a physical disk
  316.  
  317.  Parameters:    none
  318.  
  319.  Output:        none
  320.  
  321.                                                                               
  322.  part [i][ns] = Select specified partition, or show the list of partitions
  323.  
  324.  Purpose:       Select a disk partition for analysis
  325.  
  326.  Parameters:    i       optional   Number specifying the partition as shown
  327.                                    by the 'disks' or 'part' commands
  328.                         or   d:    Drive-letter for a partition (part C:)
  329.                         or   +     To get a verbose list
  330.                         or   !     To force a new scan of physical disks
  331.                                    If no parameter is specified the list of
  332.                                    partitions will be displayed.
  333.  
  334.                 ns      optional   Do not start SLT thread automaticaly (HPFS)
  335.                                    When specified, the SLT will be build later
  336.                                    when the 'SLT' cmd is issued to display it.
  337.  
  338.  Output:        Either the list of partitions or the default display for the
  339.                 first sector of the partition (usualy a boot-sector).
  340.  
  341.  Remarks:       The command "d:" where d is any existing drive-letter will
  342.                 be interpreted as a "part d:" command. This means that the
  343.                 C: partition can be opened just by typing "C:"
  344.  
  345.                 The returncode (rc) will be zero for a valid partition id or
  346.                 the number of partitions otherwise (usefull in REXX scripts).
  347.  
  348.                 An example of the list ouput in table form (default) is:
  349.  
  350.  Opened phys. disk : 1          Cyl: 327 H: 64 S:32            Size:   327.0 Mb
  351.  Number of physical disks found: 1
  352.  ┌──┬──┬──┬─────────────────┬────────┬────────┬───────────┬────────┬─────────┐
  353.  │id│PD│Dr│Type, description│Format  │Creator │Label Info │BM-Name │ Size Mb │
  354.  ├──┼──┼──┼─────────────────┼────────┼────────┼───────────┼────────┼─────────┤
  355.  │01│ 1│--│Prim 0a Boot Mgr │FAT     │        │«OS/2    » │        │     1.0 │
  356.  │02│ 1│C:│Prim 07 Inst. FS │HPFS    │OS2 20.0│OS2        │OS/2    │   170.0 │
  357.  │03│ 1│D:│Log  07 Inst. FS │HPFS    │OS2 20.0│OS2        │STARTUP │     5.0 │
  358.  │04│ 1│E:│Log  07 Inst. FS │HPFS    │OS2 20.0│OS2        │        │   145.0 │
  359.  │05│ 1│--│Hide fe PS/2 syst│FAT16   │IBM  5.y│6M OPEN 525│        │     6.0 │
  360.  └──┴──┴──┴─────────────────┴────────┴────────┴───────────┴────────┴─────────┘
  361.  
  362.  Number of physical disks   = The number of disks reported by the system
  363.  Opened phys disk ...       = opened disk with Cylinder, Head, Sector and Size
  364.  Part nn WARNING: ...       = Any informal, strange or alarming conditions
  365.  
  366.  Where:   id                = The selection-id used by DFS for this partition
  367.           PD                = Physical drive number; 1..max
  368.           Dr                = Drive letter, a capital plus a semicolon (C:),
  369.                               or a lowercase drive-letter for hidden partitions
  370.           Type, description = Type-info and hex value of the type, type-info:
  371.                               Prim = Primary (active, accessible)
  372.                               Hide = Hidden  (primary or special)
  373.                               Log  = Logical volume in an extended partition
  374.           Format            = The filesystem format string found in the
  375.                               bootrecord for this partition or --none--
  376.           Creator           = The OEM identification string from the bootrec
  377.                               of "fdisk" if no valid bootrecord is found
  378.           Label Info        = The volumelabel as found in the bootrecord, or
  379.                               the «BM-label» of the current Bootmgr selection
  380.                               Note: The FAT volume-label will not be shown here
  381.           BM-Name           = The name for this partition as registered in
  382.                               the OS/2 boot-manager information area's
  383.           Size Mb           = The gross size of the partition in megabytes
  384.                                                                               
  385.                 An example of a list fragment for verbose form is:
  386.  
  387. DFS partition  Id : 1
  388.  Physical disk nr : 1     (Fixed), Partition-table 0 (MBR), entry: 0
  389.  System Indicator : 0a
  390.  Type description : Boot Mgr
  391.  FileSyst. format : BMGR
  392.  Partition   type : Primary
  393.  Part. visibility : Visible
  394.  Creator OEM-name :  fdisk
  395.  Boot Mgr default : «Merlin  »
  396.  Boot capability  : Bootable directly by BIOS and MBR-code
  397.  Partition  start : Cyl:   0   Hd:   1 Sec:  1
  398.  Partition    end : Cyl:   0   Hd: 254 Sec: 63
  399.  Bootsect. offset : 0000003F =      63 Dec
  400.  Partition   size : 00003E82 =    8001 Kb
  401.  Cluster     size : 00000001 =     512 Bytes, in 1 sector(s)  of 512 bytes
  402.  Bootsector   PSN : 0000003F
  403.  Free space drive : --  Drive not ready,     or unknown file-system: -
  404.  .
  405.  .
  406.  .
  407. DFS partition  Id : 7
  408.  Physical disk nr : 1     (Fixed), Partition-table 4 (EBR), entry: 0
  409.  System Indicator : 07
  410.  Type description : Inst. FS
  411.  FileSyst. format : HPFS
  412.  Partition   type : Logical
  413.  Part. visibility : Visible
  414.  Creator OEM-name : OS2 20.0
  415.  Partition Label  : OS2_BOOT_3
  416.  Boot capability  : Bootable by OS/2 boot-manager as: Merlin
  417.  Partition  start : Cyl:  83   Hd:   1 Sec:  1
  418.  Partition    end : Cyl: 131   Hd: 254 Sec: 63
  419.  Bootsect. offset : 0000003F =      63 Dec
  420.  Partition   size : 000C02B2 =     384 Mb
  421.  Cluster     size : 00000001 =     512 Bytes, in 1 sector(s)  of 512 bytes
  422.  Bootsector   PSN : 001458D2
  423.  Free space drive : G:        92.3 Mb of    384.3 Mb on file-system: HPFS
  424.  
  425. DFS partition  Id : 8
  426.  Physical disk nr : 1     (Fixed), Partition-table 5 (EBR), entry: 0
  427.  System Indicator : 07
  428.  Type description : Inst. FS
  429.  FileSyst. format : HPFS
  430.  Partition   type : Logical
  431.  Part. visibility : Visible
  432.  Creator OEM-name : OS2 20.0
  433.  Partition Label  : OS2_DATA_1
  434.  Boot capability  : Not bootable by BIOS and MBR-code or OS/2 boot-manager
  435.  Partition  start : Cyl: 132   Hd:   1 Sec:  1
  436.  Partition    end : Cyl: 262   Hd: 254 Sec: 63
  437.  Bootsect. offset : 0000003F =      63 Dec
  438.  Partition   size : 00201C84 =    1028 Mb
  439.  Cluster     size : 00000001 =     512 Bytes, in 1 sector(s)  of 512 bytes
  440.  Bootsector   PSN : 00205BC3
  441.  Free space drive : H:       193.3 Mb of   1027.6 Mb on file-system: HPFS
  442.                                                                               
  443.  
  444.  vol [letter] = Select specified logical volume, or show the list of volumes
  445.  
  446.  Purpose:       Work with logical volumes including floppies and CD-rom
  447.  
  448.  Parameters:    Drive-letter for the volume
  449.  
  450.  Output:        Either the list of volumes or the default display for the
  451.                 first sector of the volume (usualy a boot-sector).
  452.  
  453.  Remarks:       Network or other "virtual" file-systems are not supported.
  454.  
  455.  
  456.  im   img         = Open a file with a FS-image (.img) for analysis
  457.  
  458.  Purpose:       Work with a saved binary image
  459.  
  460.  Parameters:    img     Filename for the image, default extention is '.img'
  461.  
  462.  Output:        The default display for the first sector of the image
  463.  
  464.  Remarks:       File-system type is derived from first (boot) sector
  465.  
  466.  
  467.  sim  img [f [s]] = Save FS-image (.img) start from LSN [f], size [s] sectors
  468.  
  469.  Purpose:       Save specified sectors as a binary image for use with 'IM'
  470.  
  471.  Parameters:    img     Filename for the image, default extention is '.img'
  472.                 f       Start LSN for save, default is 0
  473.                 s       Size of the saved image in sectors, default is 256
  474.                         '$' can be used to save all sectors of the disk/volume
  475.  
  476.  Output:        none
  477.  
  478.  Remarks:       When '.' is specified for s, sector 'f' upto 'this' is saved
  479.                 When '.' is specified for f, the start-sector is 'this'
  480.                 When '.' is specified for both, only the 'this' sector is saved
  481.  
  482.  
  483.  wrim img [f [s]] = Write FS-image to disk-sectors start at LSN [f], size [s]
  484.  
  485.  Purpose:       Write sectors back from an image to opened partition or volume
  486.  
  487.  Parameters:    img     Filename for the image, default extention is '.img'
  488.                 f       Start LSN for write, default is 0
  489.                 s       Size of the written sector area, default size of image
  490.  
  491.  Output:        none
  492.  
  493.  Remarks:       '.' can be specified for the f and s parameters, see 'sim' cmd
  494.  
  495.                                                                               
  496.  
  497.  fs  fs-name [No] = Force analysis using specified file-system knowledge
  498.  
  499.  Purpose:       Use specific FS knowledge if the default is not correct
  500.  
  501.  Parameters:    fs-name File-system name, like FAT or HPFS
  502.                 No      Do not try to build SLT automatically
  503.  
  504.  Output:        none
  505.  
  506.  Remarks:       Only HPFS is realy supported at the moment, and depending on
  507.                 disk or image contents DFS might behave strangely or even trap
  508.  
  509.  
  510.  export  [id][fn] = Export  LSN's in sector list [id], to   file [fn]
  511.  
  512.  Purpose:       Save an LSN-list in a file for modification or later use
  513.  
  514.  Parameters:    id      optional   Id for the list, f, b, d or m
  515.                                    see "list" cmd; default is last list used
  516.                 fn      Destination filename, default is dfslistX.lsn
  517.  
  518.  Output:        none
  519.  
  520.  Remarks:       The file has one LSN per line, editable with a text-editor.
  521.  
  522.  
  523.  import  [id][fn] = Import  LSN's to sector list [id], from file [fn]
  524.  
  525.  Purpose:       Read an LSN-list from a file, exported and/or modified
  526.  
  527.  Parameters:    id      optional   Id for the list, f, b, d or m
  528.                         see "list" cmd; default is the "find-result" list
  529.                 fn      Source filename, default is dfslistX.lsn
  530.  
  531.  Output:        none
  532.  
  533.  Remarks:       The file needs one LSN per line, editable with a text-editor.
  534.                 It can be the result of an export, derived from a log-file
  535.                 or created completely by hand.
  536.                                                                               
  537.  
  538.  base [sn [sl]]   = Set base limits start and end values, defining partition
  539.  
  540.  Purpose:       Force a different partition start sector-nr
  541.  
  542.  Parameters:    sn      Sector-number to use as start for partition ==> LSN 0
  543.                 sl      Sector-number to use as end for partition (optional)
  544.  
  545.  Output:        none
  546.  
  547.  Remarks:       Can be used if start of partition / partition-tables are bad
  548.                 Try to find the PSN for the first sector of the partition
  549.                 and use the "base" cmd followed by an "FS xxxx" command
  550.  
  551.  
  552.  PSN  xx      = Analyse & display sector using PSN xx
  553.  
  554.  
  555.  Purpose:       Display sector using Physical Sector Number addressing
  556.  
  557.  Parameters:    xx = 1 to 8 hexadecimals
  558.  
  559.  Output:        Sector display, format selected based on sector-contents
  560.  
  561.  Remarks:       The SN is specified in hexadecimal format, however the first
  562.                 digit needs to be decimal to avoid misinterpretation.
  563.                 Prefixing the SN with '0' will avoid any conflicts.
  564.  
  565.                 Output that scrolls of the screen can be repeated using
  566.                 the 't' command. (display 'this' sector)
  567.  CHS c  h  s  = Analyse & display sector using CHS specication
  568.  
  569.  
  570.  Purpose:       Display sector using Cylinder, Head and Sector addressing
  571.  
  572.  Parameters:    c       mandatory  The zero-based decimal Cylinder number
  573.                                    Range 1 to disk-specific maximum and
  574.                                    usualy below 1024.
  575.  
  576.                 h       mandatory  The zero-based decimal Head number
  577.                                    Range 0 to disk-specific maximum but
  578.                                    never more than 255
  579.  
  580.                 s       mandatory  The one-based decimal Sector number
  581.                                    Range 1 to disk-specific maximum but
  582.                                    never more than 63
  583.  
  584.  Output:        Sector display, format selected based on sector-contents
  585.  
  586.  Remarks:       Output that scrolls of the screen can be repeated using
  587.                 the 't' command. (display 'this' sector)
  588.                                                                               
  589.  
  590.       xx      = Analyse & display sector, SN xx; xx = 1 to 8 hexadecimals
  591.  
  592.  
  593.  Purpose:       Display a sector in the most usefull format
  594.  
  595.  Parameters:    none
  596.  
  597.  Output:        Sector display, format selected based on sector-contents
  598.  
  599.  Remarks:       The SN is specified in hexadecimal format, however the first
  600.                 digit needs to be decimal to avoid misinterpretation.
  601.                 Prefixing the SN with '0' will avoid any conflicts.
  602.  
  603.                 Logical addressing (LSN) is actualy used, however when a
  604.                 physical disk is selected the offset for logical addressing
  605.                 is set to 0. The result is that LSN's equal PSN's.
  606.  
  607.                 Output that scrolls of the screen can be repeated using
  608.                 the 't' command. (display 'this' sector)
  609.  
  610.  
  611.  
  612.  H,h [xx [s]] = Hex-dump sector or half-sector, LSN xx, s sectors/bytes
  613.  
  614.  Purpose:       Display current or specified sector in hex-dump format
  615.  
  616.  Parameters:    xx      optional   LSN of sector to dump
  617.  
  618.                 s       optional   size to dump:  1..63   specifies sectors
  619.                                                  64..xxx  specifies bytes
  620.                                    Default is 512 bytes for the 'H' command
  621.                                           and 256 bytes for the 'h' command
  622.  
  623.  Output:        Hex-dump of the sector
  624.                 On every line 16 bytes of data will be displayed, each line
  625.                 containing:
  626.                   - the relative offset in the record (4 hex digits)
  627.                   - 16 bytes in hexadecimal; separator after 8 bytes
  628.                   - the same 16 bytes represented as ASCII
  629.  
  630.  Remarks:       The ASCII representation is filtered, non-printable
  631.                 characters are represented with a PERIOD character
  632.  
  633.  
  634.  
  635.  t a|h [s]    = This LSN, display in Ascii or Hex;  s sectors/bytes
  636.  
  637.  Purpose:       Display current sector in ASCII, EA, HEX or default format
  638.  
  639.  Parameters:    a|h     optional   Specifies display format as:
  640.                                       a = ASCII
  641.                                       h = HEX
  642.                                    none = default (based on sector-contents)
  643.  
  644.                 s       optional   size to dump:  1..63   specifies sectors
  645.                                                  64..xxx  specifies bytes
  646.  
  647.  Output:        Sector display in requested format
  648.  
  649.  Remarks:
  650.  
  651.                                                                               
  652.  f[op] [t] [str]] = Find [options] sectors of [t]ypes containing [str]
  653.  
  654.  Purpose:       Perform a sector search starting from the current LSN
  655.                 until a sector of the specified type and optionaly
  656.                 containing a specified ASCII/HEX string is found.
  657.  
  658.  Parameters:    op      optional   Search options, default is '+'
  659.                                    *      = automatic repeat (find all ...)
  660.                                    +      = verbose output even when repeating
  661.                                    -      = search towards lower sector numbers
  662.                                    !      = force LSN/PSN display, no file-paths
  663.                                    $      = Use case-insensitive string compare
  664.                                    @[pos] = compare at one sector position [pos]
  665.                                             (with type dependant defaults)
  666.  
  667.                                    Note: Use no spaces betwee 'f' and options!
  668.  
  669.                 t       optional   Types of sector wanted, default is any KNOWN
  670.                                    specify multiple types in a single string
  671.  
  672.                     DFS generic sector types
  673.                     '*' = any sector
  674.                     'r' = Master   Boot Rec    'e' = Extended Boot Rec
  675.                     'b' = Fsys boot sector     'R' = Fsys reserved sec
  676.                     '!' = any known type       'u' = Unidentified data
  677.                     '$' = Free space           '.' = <Past-partition!>
  678.  
  679.                     HPFS specific sector types
  680.                     'I' = File data            'E' = EA data
  681.                     'A' = ACL data             'B' = Boot area
  682.                     's' = HPFS superblock      'p' = HPFS spareblock
  683.                     'H' = Hotfix table         'h' = Hotfix data
  684.                     'x' = Bad sector-list      'X' = Bad sector
  685.                     'S' = Spare dirblocks
  686.                     'D' = Directory   Fnode    'y' = Deleted Dir Fnode
  687.                     'f' = File        Fnode    'z' = Deleted FileFnode
  688.                     'a' = Allocation  block    'Z' = Deleted All-block
  689.                     'd' = Directory block      'P' = Dir-band (free)
  690.                     'Q' = Dir-band bitmap      'c' = Codepage info
  691.                     't' = Codepage data        'i' = HPFS386 User-id
  692.                     'm' = Bitmap Tables        'M' = Bitmap data
  693.  
  694.                     For an up-to-date list, use the '???" command
  695.  
  696.                 str     optional   A string of bytes that have to be present
  697.                                    in the wanted sector.
  698.                                    When the '$' string option is not given, it
  699.                                    can be specified as a mix of ASCII and HEX.
  700.                                    The starting mode is ASCII, switching to
  701.                                    HEX and back is done with the ' character.
  702.                                    Leading whitespace is skipped, in HEX mode
  703.                                    spaces can be used to improve readability.
  704.  
  705.                         Example 1: last'0d0a'first
  706.  
  707.                                    This will search for the word "last"
  708.                                    followed by a carriage-return line-feed
  709.                                    combination and the word first
  710.  
  711.                         Example 2: 'e9bd13 0d4023 49 42 4d 3a38 2e'
  712.  
  713.                                    This will search for a byte sequence,
  714.                                    in this case the start of COMMAND.COM
  715.                                                                               
  716.  
  717.  
  718.  Output:        Sector display, format selected based on sector-contents,
  719.                 or a single line with position and type info when repeating
  720.  
  721.  
  722.  Remarks:       This command is also very usefull to find a specific fragment
  723.                 of disassembled code anywhere on the disk, to resolve the
  724.                 name of an EXE, DLL or device driver causing traps or hangs.
  725.  
  726.                 Backward search can be usefull on HPFS to find the preceding
  727.                 fnode when looking at some random file-data.
  728.                 Note: the 'id' command will do this more reliably but depends
  729.                       on the sector-lookup-table to be filled.
  730.  
  731.  
  732.  list [id+op] [w] = Display LSN's in sector list [id], using options/wildcard
  733.  
  734.  Purpose:       Display one of the sector-number lists maintained by DFS
  735.  
  736.  Parameters     id      optional   Identifier for LSN list, valid values are:
  737.  
  738.                                    d = Dir,   result or dir-block display
  739.                                    b = Bad,   result of 'scan' command
  740.                                    f = Find,  result of 'f' command
  741.                                    m = Mem,   result of 'mem' commands
  742.  
  743.                 op      optional   + = Use verbose output, one line per LSN
  744.                                    f = Incluse PATH info on Fnode LSN's on
  745.                                        verbose output (requires + too)
  746.  
  747.                 w       optional   Wildcard select-string, only valid with "+f"
  748.                                    multiple wildcards '*' and '?' can be used.
  749.                         Very useful on a (large) list of deleted fnodes!
  750.  
  751.  Output:        List of sector numbers in compact or verbose format
  752.  
  753.  Remarks:       There should be NO space between [id] and the options!
  754.                 The default list-identifier will be set to a specific list
  755.                 each-time one of the lists is modified or listed.
  756.                 List also available for REXX in the dfs_sn. stem variable
  757.  
  758.  
  759.  mem  [c|lsn] [#] = Store LSN in MEMory list at loc #, or limit mem list-size
  760.  
  761.  Purpose:       Add an LSN to the LSN memory list for later use with .NNN
  762.  
  763.  Parameters:    c       optional   Clear command, limit list-size to # entries
  764.  
  765.                 lsn     optional   LSN to add to the list, special values are:
  766.                                    x, u, d, t for Xtra, Up, Down and This
  767.  
  768.                 #       optional   memory location to store lsn, or limit
  769.  
  770.  Output:        none
  771.  
  772.  Remarks:       The LSN memory can be listed using "list m" [+f]
  773.                                                                               
  774.  
  775.  .NNN        [id] = Display numbered FS-entity marked .NNN from a sector list
  776.  
  777.  Purpose:       Display one of the entries from the list last shown
  778.                 It can be applied on Directory- as well as Allocation-lists
  779.                 The number (NNN) to use is displayed to the left of the list
  780.  
  781.  Parameters:    NNN                The zero-based decimal entry number to show
  782.  
  783.                 id      optional   Identifier for LSN list (see list command)
  784.  
  785.  Output:        Sector display, format selected based on sector-contents
  786.  
  787.  
  788.  Enter        = down in hierachy (Enter = down)
  789.  
  790.  Purpose:       Display the next, most likely wanted, sector
  791.  
  792.  Parameters:    none
  793.  
  794.  Output:        Sector display, format selected based on sector-contents
  795.  
  796.  Remarks:
  797.  
  798.  
  799.  
  800.  u            = up in hierachy
  801.  
  802.  Purpose:       Display the sector that is higher in the hierarchy (parent)
  803.  
  804.  Parameters:    none
  805.  
  806.  Output:        Sector display, format selected based on sector-contents
  807.  
  808.  
  809.  
  810.  x            = Extra LSN
  811.  
  812.  Purpose:       Display the sector marked as eXtra
  813.  
  814.  Parameters:    none
  815.  
  816.  Output:        Sector display, format selected based on sector-contents
  817.  
  818.  Remarks:
  819.                                                                               
  820.  
  821.  SLT [t i s m]   = Show SLT for 'type', at index i, size s, error-mask m
  822.  
  823.  Purpose:       Display (selection of) the Sector Lookup Table
  824.  
  825.  Parameters:    t       optional   Sector-types to include in the displayed
  826.                                    list. Default is all types ('*')
  827.                                    Types are same as specified for 'f' cmd
  828.  
  829.                 i       optional   Start index in the SLT to display
  830.  
  831.                 s       optional   Number of entries to display, default
  832.                                    will result in one screen-full
  833.  
  834.                 m       optional   Error filtering mask, * = all errors
  835.                                    4-digit Hexadecimal value, each set bit
  836.                                    will include a specific error value.
  837.  
  838.  
  839.  Output:        One line for each entry in the SLT, containing:
  840.                         LSN        Start LSN for a range of sectors
  841.                         size       Number of sectors in the range
  842.                         ref        Other sector refering to this range (fnode)
  843.                         type       Type of the sectors in the range
  844.                         error      4-digit Hexadecimal error value:
  845.  
  846.                            0x0001  Linked to some structure, but not in bitmap
  847.                            0x0002  Allocated in bitmap, but not linked
  848.                            0x0008  Fnode is a directory but DirFlag is not set
  849.                            0x0010  Fnode datalength greater than Dir-entry size
  850.                            0x0020  Fnode datalength smaller than Dir-entry size
  851.                            0x0040  Fnode datalength greater than allocated size
  852.                            0x0080  Fnode datalength smaller than allocated size
  853.  
  854.  Remarks:       Sector ranges might overlap, the smallest matching range will
  855.                 hold the best identification for a specific sector.
  856.  
  857.                 The start-index will default to the position of the sector
  858.                 last searched using the 'i' cmd.
  859.  
  860.                 If needed the SLT will be built in a background thread.
  861.  
  862.  
  863.  id [xx]      = Identify, using sector lookup table
  864.  
  865.  Purpose:       Display the type for a specific sector and one major reference
  866.  
  867.  Parameters:    xx      optional   LSN of sector to identify, default is
  868.                                    the current sector
  869.  
  870.  Output:        One line specifying corresponding SLT entry, followed by
  871.                 a line specifying the type of the sector itself and a
  872.                 sector display of the 'ref' sector, in a format based
  873.                 on sector-contents
  874.  
  875.  Remarks:       Sector ranges might overlap, the smallest matching range will
  876.                 be considered best.
  877.  
  878.                 This function is extremely usefull to relate file-data sectors
  879.                 from fragmented files to the Fnode for the file.
  880.                 It will tell you exactly to wich file a certain sector belongs.
  881.                                                                               
  882.  log       [file] = Log (append) to 'file' (.log); (No file => stop logging)
  883.  
  884.  Purpose:       Close current LOG, open new and capture DFS output in it
  885.  
  886.  Parameters:    File specification
  887.                 If no parameter is specified, logging is stopped.
  888.  
  889.  Output:        Concatenated output of DFS commands given after the
  890.                 'log' command, upto next 'log' or 'q' command.
  891.                 ANSI control characters for colors and cursor-positioning
  892.                 are not written to the logfile.
  893.  
  894.  Remarks:       There is no check on available space on the destination
  895.                 drive, file may end up empty if disk(ette) is full.
  896.                 The same logfile specification can be used more than once,
  897.                 output will be concatenated.
  898.                 On each 'log' command the current logfile will be closed.
  899.  
  900.  
  901.  trace [lvl]  = Set trace level for DFS internal functions
  902.  
  903.  Purpose:       Investigate unexpected behaviour and debug DFS
  904.  
  905.  Parameters:    lvl     optional   Trace level; 0 = no trace
  906.  
  907.  Output:        The resulting trace-level, after this the output will be
  908.                 normal output mixed with extra trace information showing
  909.                 API return-codes and DFS internal variables
  910.  
  911.  Remarks:       Only available in the special DFSTRACE.EXE version
  912.  
  913.  
  914.  prio  [lvl]  = Set relative priority of the DFS main thread
  915.  
  916.  Purpose:       Increase (search) speed with +, or decrease system impact
  917.  
  918.  Parameters:    lvl     optional   Prority level; + and ++ = high(est),
  919.                                                   - and -- = low(est)
  920.  
  921.  Output:        The resulting prio-level
  922.  
  923.  Remarks:       When running on low(est) priority in the background, DFS
  924.                 will almost come to a halt.
  925.  
  926.  q                = Quit FS display; 2.40 06-09-97  (c) 1994-1997; Jan van Wijk
  927.  
  928.  Purpose:       Exit DFS program
  929.  
  930.  Remarks:       Opened physical disk and logfile will be closed on exit
  931.                 Asynchronious running threads will be aborted.
  932.  
  933.  
  934.  cd [path]    = Change current Directory
  935.  
  936.  Purpose:       Change both the current directory and the current drive
  937.  
  938.  Parameters:    path    optional   Absolute or relative path specification
  939.  
  940.  Output:        The resulting current drive and directory
  941.  
  942.  Remarks:       '.' and '..' can be used in the relative path specification
  943.                                                                               
  944.  run mf [arg] = Run a REXX macro from DFS
  945.  
  946.  Purpose:       Execute a REXX script using the 'DFS' environment
  947.  
  948.  Parameters:    mf      mandatory  Macro file specification
  949.  
  950.                 arg     optional   Arguments to the REXX macro
  951.  
  952.  Output:        Any output from the REXX macro including (OS/2) commands
  953.                 executed from the macro.
  954.  
  955.  Remarks:       DFS commands can be issued from within the macro, this
  956.                 is the default environment (Address DFS).
  957.                 Commands for CMD.EXE must be addressed using 'Address Cmd'
  958.  
  959.                 The following REXX variables will be available after
  960.                 each executed DFS command from a macro:
  961.  
  962.                 rc            The returncode from the DFS command
  963.  
  964.                 dfs_disknr    Physical disk number currently open
  965.                 dfs_partid    Partition-id for selection with "part"
  966.                 dfs_drive     The opened drive letter, including a colon.
  967.                 dfs_afsys     The attached filesystem, like "HPFS" or "FAT"
  968.                 dfs_sect      The last retrieved sector(s), binary buffer
  969.                 dfs_type      Type of last retrieved sector, this is a string
  970.                               starting with the type-character (see 'F' cmd)
  971.                               followed by a textual description.
  972.  
  973.                 dfs_this      SN of the last retrieved sector
  974.                 dfs_down      SN of most likely sector to retrieve now
  975.                 dfs_up        SN of sector up in hierarchy
  976.                 dfs_next      SN of next in sequence
  977.                 dfs_prev      SN of previous in sequence
  978.                 dfs_down      SN of up in hierarchy
  979.  
  980.                 dfs_sn.0      Number of sector-numbers in the SN stem variable
  981.                 dfs_sn.n      nth sector-number in the SN stem variable, coming
  982.                               from DFS output for directories and allocation.
  983.                               They correspond to the '.NNN' command
  984.  
  985.                               Note: SN's are in an 8-digit Hexadecimal format
  986.  
  987.                 The number of disks and partitions can be resolved using the
  988.                 returncode (rc) from the commands "disk 0" and "part 0" or
  989.                 "part" respectively.
  990.  
  991.                 REXX is dynamically loaded, when the run-command is exectuted
  992.                 It requires REXX.DLL and REXXAPI.DLL in the libpath.
  993.  
  994.  
  995.  copyoutput [stem-name]      Copy output from last-command to REXX stem-var
  996.  
  997.  Purpose:       Allow output to be captured and processed from REXX
  998.  
  999.  Parameters:    stem    optional   name of stem variable, ending in a '.'
  1000.                         default:   "dfs_output."
  1001.  
  1002.  Output:        none
  1003.  
  1004.  Remarks:       The <stem>.0 will hold the number of lines
  1005.                 <stem>.1 through <stem>.n the actual cmd-output
  1006.                                                                               
  1007.  
  1008.  scan [wr [NoId]] = Scan bad-sectors; use read/Write verify; No automatic id
  1009.  
  1010.  Purpose:       Identify bad sectors on a physical disk or logical volume
  1011.  
  1012.  Parameters:    write   optional   'w' to use full read/write/verify sequence
  1013.  
  1014.                 NoId    optional   'n' to disable automatic SLT lookup
  1015.  
  1016.  Output:        Progress indication based on sector-numbers, and one line for
  1017.                 each bad-sector found, plus an SLT display of a related sector
  1018.                 like the fnode, if automatic SLT display is enabled.
  1019.  
  1020.  Remarks:       For REXX, the dfs_sn.0 stem variable will hold the number of
  1021.                 bad-sectors found and dfs_sn.1 through dfs_sn.n the actual
  1022.                 bad sector numbers (can be shown with the 'list' command)
  1023.  
  1024.                 Without the write option, only a single 'read' will be done
  1025.                 for each sector, this can be executed on a running system
  1026.                 with open files on the disk/volume to be checked.
  1027.  
  1028.                 With the write option a "read/write-inverse/read/write-normal"
  1029.                 sequence is done for each sector with contents checking.
  1030.                 The contents of each sector will stay the same, so the function
  1031.                 can be safely executed on formatted disks with live data.
  1032.                 This sequence takes at least 4 times more time to complete
  1033.                 and also, for safety, the disk will be locked. This means that
  1034.                 the write option can only be used when the complete physical
  1035.                 disk is not being used.
  1036.  
  1037.  Remarks:       Also available for REXX in the dfs_sn. stem variable
  1038.  
  1039.  
  1040.  screen [arg] = Switch output to the screen on or off
  1041.  
  1042.  Purpose:       Allow output to logfile only
  1043.  
  1044.  Parameters:    arg     optional   'on' or 'off' to switch mode
  1045.  
  1046.  Output:        none
  1047.  
  1048.  Remarks:       The returncode (rc from REXX) will indicate the setting for
  1049.                 screen output: 0 indicates screen switched on
  1050.                                1 indicates screen switched off
  1051.                                                                               
  1052. Command reference, HPFS specific commands
  1053. -----------------------------------------
  1054.  
  1055. Active filesystem : HPFS, specific commands are:
  1056.  
  1057.  alloc  [+]      = Show data-band allocation bitmaps, compact or [+] verbose
  1058.  dirmap          = Show directory band allocation and usage map
  1059.  bitmap [xx,s,D] = Show bitmap at LSN xx, size s, in alloc or [D]ir format
  1060.  find path-spec  = Find and show file/directory specified by path-spec,
  1061.                    relative to current dir, or root if starting with '\'
  1062.  \path-spec      = find and show file/directory relative to root
  1063.  path     [n]    = Show all path-components for current fnode, upto root
  1064.  autobase [t][l] = find the start of an HPFS partition by searching sectors
  1065.                    of types [t], default 'spad'; [l] is last valid sector
  1066.  findroot [n]    = find the Root directory without using the superblock
  1067.                    starting the search at LSN [n]
  1068.  fixroot         = Update superblock with found LSN for root-directory
  1069.  fixcp           = Update superblock with found LSN for codepage info
  1070.  fixbs  [clear]  = Update bad-sector table with LSN's from DFS badsec-list
  1071.  getbs           = Read HPFS bad-sector table into DFS badsec-list
  1072.  saveto [dir][l] = Save filedata connected to (current) fnode to a file
  1073.  ca   [lsn][opt] = Check Allocation integrity for (current) fnode lsn
  1074.  
  1075.  For an up-to-date list of commands, use the '??' command
  1076.  
  1077.  
  1078.  
  1079.  
  1080.  autobase [t][l] = find the start of an HPFS partition by searching sectors
  1081.  
  1082.  Purpose:       Force a different partition start sector-nr for HPFS partition
  1083.  
  1084.  Parameters:    t       One or more sector-types to use in the search
  1085.                         default is "spad", Super, Spare, Alloc and Dirblock
  1086.                         f for fnode can also be used but is less reliable
  1087.                 sl      Sector-number to use as end for partition (optional)
  1088.  
  1089.  Output:        Search progress and finel result when HPFS partition found
  1090.  
  1091.  Remarks:       Can be used if start of partition / partition-tables are bad
  1092.                 Use the "fs hpfs" command first!
  1093.                                                                               
  1094.  
  1095.  
  1096.  alloc  [+]      = Show data-band allocation bitmaps, compact or [+] verbose
  1097.  
  1098.  Purpose:       Show usage and the distribution of data over the volume.
  1099.  
  1100.  Parameters:    none
  1101.  
  1102.  Output:        A single bitmap-graphic for the entire volume or for each
  1103.                 allocation-band when verbose format is selected
  1104.  
  1105.  Remarks:       System-reserved and Directory-band are indicated with 'S'
  1106.                 and 'R' respectively. Other area's are filled in according
  1107.                 to the degree of usage (allocation)
  1108.  
  1109.  
  1110.  dirmap          = Show directory band allocation and usage map
  1111.  
  1112.  Purpose:       Show usage of the pre-allocated directory-band
  1113.  
  1114.  Parameters:    none
  1115.  
  1116.  Output:        A single bitmap-graphic showing the allocation of the
  1117.                 pre-allocated directory band.
  1118.  
  1119.  Remarks:       If 100% is allocated more directory information will be
  1120.                 allocated elsewhere on the volume.
  1121.  
  1122.  bitmap [xx s D] = Show bitmap at LSN xx, size s, in alloc or [D]ir format
  1123.  
  1124.  Purpose:       Show a bitmape located at specified LSN, alloc or DIR format
  1125.  
  1126.  Parameters:    xx      mandatory  LSN of a bitmap sector
  1127.  
  1128.                 s       optional   size to dump:  1..63   specifies sectors
  1129.                                                  64..xxx  specifies bytes
  1130.                                    Default is 4 sectors (default bitmap size)
  1131.  
  1132.                 D       optional   Directory-format flag
  1133.  
  1134.  Output:        One bitmap-graphic for the specified bitmap LSN.
  1135.  
  1136.  Remarks:       Specifying an LSN that is not a bitmap-LSN will result in
  1137.                 a garbage bitmap display.
  1138.                                                                               
  1139.  
  1140.  \path-spec      = find and show file/directory specified by path-spec
  1141.  
  1142.  Purpose:       Locate the fnode for a known file- or directory
  1143.  
  1144.  Parameters:    path-spec          full path specification with no intervening
  1145.                                    space after the '\' command character
  1146.  
  1147.                               or   absolute- or relative path specification
  1148.                                    with an intervening space. If the path
  1149.                                    does not start with a '\' it is relative
  1150.                                    to the current directory (see CD cmd).
  1151.  
  1152.  Output:        Searchlist starting at the ROOT directory upto the requested
  1153.                 file or directory. It is either followed by an error message
  1154.                 if the path-spec was not found or by the display of the
  1155.                 corresponding fnode information.
  1156.  
  1157.  Remarks:       The search algorithm depends on the ROOT fnode being known.
  1158.                 When the superblock is corrupt this fnode can be resolved
  1159.                 using the 'findroot' command.
  1160.  
  1161.  
  1162.  
  1163.  path     [n]    = Show all path-components for current fnode, upto root
  1164.  
  1165.  Purpose:       Show the directory-branch that contains current file/dir
  1166.  
  1167.  Parameters:    n           optional   Start LSN for the search
  1168.  
  1169.  Output:        One line for each found 'parent' directory, upto the root
  1170.  
  1171.  Remarks:
  1172.  
  1173.  
  1174.  ca   [lsn][opt] = Check Allocation for (current) fnode lsn
  1175.  
  1176.  Purpose:       Check allocation integrity for current fnode
  1177.  
  1178.  Parameters:    lsn         optional   LSN of the fnode
  1179.                 opt         optional   Options:  v   = Verbose, show progress
  1180.  
  1181.  Output:        Σ           Start of an allocation-sector (heavily fragmented)
  1182.                 »           Start of one file-extent (fragmented file)
  1183.                 ·           One sector, green small dot is allocation OK
  1184.                 ■           One sector, red big dot is allocation error
  1185.  
  1186.                 Also a summary is given with the number of (failed) sectors
  1187.  
  1188.  Remarks:       Fnode maybe for a regular file (sectors must be ALLOCATED)
  1189.                 or for a deleted file (sectors must be FREE)
  1190.  
  1191.                                                                               
  1192.  findroot [n]    = find the Root directory without using the superblock
  1193.  
  1194.  Purpose:       Find the fnode for the ROOT directory, even if parts of
  1195.                 the volume, including the superblock, are damaged.
  1196.  
  1197.  Parameters:    n           optional   Start LSN for the search
  1198.  
  1199.  Output:        Search-list starting at the first fnode encountered upto
  1200.                 the fnode for the ROOT directory when found.
  1201.  
  1202.  Remarks:       Specifying a startlsn might be needed if reading at the
  1203.                 start of the volume results in device errors, or if some
  1204.                 fnodes in the sequence are corrupted.
  1205.  
  1206.  
  1207.  fixroot         = Write the root-LSN found with the 'findroot' command back
  1208.  
  1209.  Purpose:       Fix bad Root-LSN pointer, caused by CHKDSK bugs or
  1210.                 other corruption
  1211.  
  1212.  Parameters:    none
  1213.  
  1214.  Output:        none
  1215.  
  1216.  Remarks:       It is better to lock the physical disk before writing to it
  1217.                 See 'lock' and 'unlock' commands
  1218.  
  1219.  
  1220.  fixcp           = Write the CodePage-LSN found with the '0#f c' command back
  1221.  
  1222.  Purpose:       Fix bad CodePage-LSN pointer, caused by CHKDSK bugs or
  1223.                 other corruption
  1224.  
  1225.  Parameters:    none
  1226.  
  1227.  Output:        none
  1228.  
  1229.  Remarks:       It is better to lock the physical disk before writing to it
  1230.                 See 'lock' and 'unlock' commands
  1231.                                                                               
  1232.  fixbs  [clear]  = Update bad-sector table with LSN's from DFS badsec-list
  1233.  
  1234.  Purpose:       Replace the internal HPFS bad-sector list with the DFS
  1235.                 bad-sector list, or clear the liste completely.
  1236.  
  1237.  Parameters:    clear   optional   Make internal and DFS bad-sector list empty
  1238.  
  1239.  Output:        none
  1240.  
  1241.  Remarks:       The DFS bad-sector list is limited to maximum 1023 bad-sectors.
  1242.                 The list can be the result of the "scan", "getbs" or "import b"
  1243.                 commands, allowing modification off-line with an editor.
  1244.                 It is better to lock the physical disk before writing to it
  1245.                 See 'lock' and 'unlock' commands
  1246.  
  1247.  
  1248.  getbs           = Read HPFS bad-sector table into DFS badsec-list
  1249.  
  1250.  Purpose:       Replace the DFS bad-sector list with the internal HPFS
  1251.                 bad-sector list
  1252.  
  1253.  Parameters:    none
  1254.  
  1255.  Output:        none
  1256.  
  1257.  Remarks:       The DFS bad-sector list is limited to maximum 1023 bad-sectors.
  1258.  
  1259.  
  1260.  saveto [dir][l] = Save filedata connected to (current) fnode to a file
  1261.  
  1262.  Purpose:       Recover a file if the fnode can still be found, by making
  1263.                 a low-level sector-by-sector copy of its data to a new file.
  1264.                 (basic functionality to be used for undelete operations)
  1265.  
  1266.  Parameters:    dir         optional   Path to save the file copy (existing!)
  1267.  
  1268.                 l           optional   LSN of the fnode of the file to recover
  1269.                                        default is the current LSN (This)
  1270.  
  1271.  Output:        Progress is reported with output like the "ca" command,
  1272.                 error messages will be given as appropriate
  1273.  
  1274.  Remarks:       Only the file contents is recovered, date&time, attributes
  1275.                 and extended attributes are lost.
  1276.  
  1277.                 If no directory is specified it will default to the last
  1278.                 directory given, or "A:" when it is the first time
  1279.                                                                               
  1280. Diagram of an example HPFS structure
  1281.  
  1282.  Basic HPFS data-structure for Root-directory with AUTOEXEC.BAT, README file,
  1283.  an OS2 subdirectory and lots of other files. The README file has it's data
  1284.  allocated in 2 alloc-chunks.
  1285.  
  1286.  ╔═════════╗                  ╔══════════════════╗       ╔═══════╗
  1287.  ║SUPER    ║              ┌──>║ DIR block        ║   ┌──>║ FNODE ║
  1288.  ║         ║              │   ║                  ║   │   ║       ║
  1289.  ║         ║    ╔═══════╗ │   ║┌────────────────┐║   │   ║       ║  ╔══════════
  1290.  ║Root LSN ────>║ FNODE ║ │   ║│*Special**Start*│║   │   ║ ALLOC ──>║ DIR block
  1291.  ╚═════════╝    ║       ║ │   ║│entry FNODE  LSN│║   │   ╚═══════╝  ║
  1292.                 ║       ║ │   ║│BtreeDownPtr LSN│║   │              ║┌─────────
  1293.                 ║ ALLOC ──┘   ║└────────────────┘║   │              ║│8514.RC
  1294.                 ╚═══════╝     ║┌────────────────┐║   │              ║│entry FNO
  1295.                               ║│OS2 (subdir)    │║   │              ║│BtreeDown
  1296.                               ║│entry FNODE  LSN├────┘              ║└─────────
  1297.  ┌─────────────────────────────┤BtreeDownPtr LSN│║                  ║┌─────────
  1298.  │                            ║└────────────────┘║                  ║│ANSI.EXE
  1299.  │                            ║┌────────────────┐║
  1300.  │                            ║│Special-end     │║
  1301.  │  ╔══════════════════╗      ║│entry FNODE  LSN│║       ╔══════════════════╗
  1302.  └─>║ DIR block        ║      ║│BtreeDownPtr LSN├───────>║ DIR block        ║
  1303.     ║┌────────────────┐║      ║└────────────────┘║       ║┌────────────────┐║
  1304.     ║│*Special**Start*│║      ╚══════════════════╝       ║│*Special**Start*│║
  1305.     ║│entry FNODE  LSN│║                                 ║│entry FNODE  LSN│║
  1306.     ║│BtreeDownPtr LSN│║     ╔═══════╗                   ║│BtreeDownPtr LSN│║
  1307.     ║└────────────────┘║  ┌─>║ FNODE ║                   ║└────────────────┘║
  1308.     ║┌────────────────┐║  │  ║       ║                   ║┌────────────────┐║
  1309.     ║│AUTOEXEC.BAT    │║  │  ║       ║  ╔═══════════     ║│PP... filename  │║
  1310.     ║│entry FNODE  LSN├───┘  ║ ALLOC ──>║┌──────────     ║│entry FNODE  LSN│║
  1311.     ║│BtreeDownPtr LSN│║     ╚═══════╝  ║│ 1st data-     ║│BtreeDownPtr LSN│║
  1312.     ║└────────────────┘║                ║└──────────     ║└────────────────┘║
  1313.     ║┌────────────────┐║                                 ║┌────────────────┐║
  1314.     ║│OS1.. filename  │║                                 ║│README filename │║
  1315.     ║│entry FNODE  LSN│║      ┌───────────────────────────┤entry FNODE  LSN│║
  1316.     ║│BtreeDownPtr LSN│║      │                          ║│BtreeDownPtr LSN│║
  1317.     ║└────────────────┘║      │                          ║└────────────────┘║
  1318.     ║┌────────────────┐║      │                          ║┌────────────────┐║
  1319.     ║│**Special**End**│║      │                          ║│XXX... filename │║
  1320.     ║│entry FNODE  LSN│║      │                          ║│entry FNODE  LSN│║
  1321.     ║│BtreeDownPtr LSN│║      │                          ║│BtreeDownPtr LSN│║
  1322.     ║└────────────────┘║      │                          ║└────────────────┘║
  1323.     ╚══════════════════╝      │                          ║┌────────────────┐║
  1324.                               │                          ║│**Special**End**│║
  1325.                               │                          ║│entry FNODE  LSN│║
  1326.                               │                          ║│BtreeDownPtr LSN│║
  1327.                               │                          ║└────────────────┘║
  1328.                               │                          ╚══════════════════╝
  1329.                               │
  1330.                               │                    ╔════════════════════════╗
  1331.                               │               ┌───>║┌──────────────────────┐║
  1332.                               │               │    ║│ 1st data-sector      │║
  1333.                               │               │    ║└──────────────────────┘║
  1334.                               │               │    ║┌──────────────────────┐║
  1335.                               │  ╔═══════╗    │    ║│ 2nd data-sector      │║
  1336.                               └─>║ FNODE ║    │    ║└──────────────────────┘║
  1337.                                  ║       ║    │    ╚════════════════════════╝
  1338.                                  ║       ─────┘
  1339.                                  ║ ALLOC ║         ╔════════════════════════╗
  1340.                                  ║       ─────────>║┌──────────────────────┐║
  1341.                                  ╚═══════╝         ║│ 3rd data-sector      │║
  1342.                                                    ║└──────────────────────┘║
  1343.     (c) 1995                                       ║┌──────────────────────┐║
  1344.     J. v. Wijk                                     ║│ 4th data-
  1345.                                                                               
  1346. Examples of DFS usage
  1347. ---------------------
  1348.  
  1349.  1) Resolve original name of FILExxxx.CHK files (created by CHKDSK)
  1350.  
  1351.     When CHKDSK recovers files it will place in a FOUND.xxx directory in
  1352.     the root-directory. This directory contains one or more recovered files
  1353.     with names like FILE0001.CHK
  1354.     The original name of the file is still in the Fnode, it can be shown
  1355.     using the following dhpfs commands (assuming drive c:) :
  1356.  
  1357.     Command                            Explanation
  1358.  
  1359.     DFS disks                          Start DFS and scan physical disks
  1360.     part id                            Select partition 'id' (must be HPFS)
  1361.     \found.000\file0001.chk            Search and display Fnode for .CHK
  1362.  
  1363.     Now 15 characters of the original name are shown as "Fnode Name String"
  1364.  
  1365.  2) Show freespace area's (HPFS)
  1366.       "slt $"
  1367.  
  1368.  3) Undelete a file; Find the fnode using:
  1369.       "f z"               find the next deleted fnode
  1370.       "f z   shortname"   next deleted named shortname (case-sensitive)
  1371.       "f$@ z shortname"   next deleted named shortname (case-insensitive)
  1372.  
  1373.       Add a '*' to the find command to do a repeated search (see 'f' command)
  1374.  
  1375.     Then use the "saveto path" command to copy the data for the deleted
  1376.     file to a directory.
  1377.  
  1378.     Notes: - It's best to use a different drive to avoid overwriting
  1379.  
  1380.  4) Save and restore (parts of) a disk
  1381.  
  1382.     The "sim" command can be used to save a complete disk, including partition
  1383.     information to one (very large!) file on a different (network) drive.
  1384.     The save the entire unit (opened disk/partition or volume) use:
  1385.     "sim img-name 0 $"
  1386.  
  1387.     It can be restored using the "wrim" command, if and only if the destination
  1388.     disk has exactly the same geometry as the source disk (heads, sectors cyl).
  1389.     This could be used to clone one workstation to multiple machines.
  1390.  
  1391.  5) List all "undeletable" files
  1392.  
  1393.     Find the FNODES for possibly deleted files using
  1394.       "f* z" or for specific files:  "f*$@ z shortname"
  1395.  
  1396.     Now list them, including PATH and recovery reliability using:
  1397.       "list f+f"
  1398.  
  1399.     Or list just a subset using any combination of wildcards:
  1400.       "list f+f *\testdir\data?.txt
  1401.  
  1402.     Use the .NNN command to select a file to undelete, and then use the
  1403.     "saveto [destination-path]" command to actualy undelete it.
  1404.                                                                               
  1405.  
  1406.  6) Update the bad-sector list with the results of a DFS-scan
  1407.  
  1408.     Find all sectors that are unreadable:
  1409.       "scan"
  1410.  
  1411.     Optionaly: list, export/modify/import the resulting bad-sector list
  1412.       "list b+f"                   (list, including PATH if sector is Fnode)
  1413.       "export b badguys"           (Place in an ASCII file badguys.lsn)
  1414.       Now edit it off-line, save as 'modified.lsn' (maximum of 1023 lines!)
  1415.       "import b modified"
  1416.  
  1417.     Now replace the internal bad-sector list with the new modified one:
  1418.       "fixbs"
  1419.  
  1420.  7) Save a list of currently deleted files on an HPFS volume:
  1421.  
  1422.     Find deleted files (could take quite a while!):
  1423.       "f* z"
  1424.  
  1425.     Save the deleted-Fnode LSN's in a file:
  1426.       "export deleted"
  1427.  
  1428.       - Note that the list-id is not specified, only a filename is given.
  1429.         The id will default to "f" for find-result because that was the
  1430.         last LSN-list used.
  1431.         The explicit command would have been: "export f deleted.lsn"
  1432.  
  1433.     Optionaly, also save PATH info and recovery chances using a logfile:
  1434.       "log deleted"
  1435.       "list f+f"
  1436.       "log"
  1437.  
  1438.       - This will result in a (possibly large!) deleted.log with one line
  1439.         per deleted file with size, recovery percentage and PATH+filename
  1440.  
  1441.                                                                               
  1442. Known limitations and bugs
  1443. --------------------------
  1444.  
  1445. - There is no real support for FAT, NTFS yet besides basic recognition.
  1446.  
  1447. - saveto only saves the basic file-data, no extended attributes yet
  1448.  
  1449. - The various "fix" commands do not update the checksum fields in the
  1450.   super-block yet and they do not set an "last optimized" timestamp.
  1451.  
  1452. - Writing to a volume opened with "vol" (and locked) does not seem to work
  1453.  
  1454.  
  1455. Considered improvements
  1456. -----------------------
  1457.  
  1458.  Automatic detection of inconsistencies (like CHKDSK, FST, HVA and CHKPART)
  1459.  
  1460.    This will show HPFS problems like CHKDSK does, but in more detail and
  1461.    maybe some more types of inconsistencies.
  1462.    Note: Basic HPFS functionality implemented in version 1.62
  1463.          Some partitioning errors implemented in version 1.82
  1464.  
  1465.  
  1466.  Real coverage of other file-systems besides HPFS like FAT, LINUX, NTFS ...
  1467.    The code has been prepared for other file-systems in version 2.21
  1468.  
  1469.  Graphical User Interface
  1470.  
  1471.    This could make the program easier to use, however it also makes
  1472.    the program requirements less attractive becaus it uses PM/WPS
  1473.    or WINxx and makes porting more difficult.
  1474.    A command-line version will allways be available to allow operation
  1475.    from a minimal (diskette) system.
  1476.  
  1477.  
  1478.  Write capability,
  1479.  
  1480.    This will allow recovery operations without using other (third-party)
  1481.    utilities. This will require locking the entire disk so usage is
  1482.    often limited to diskette BOOT.
  1483.  
  1484.    Note: Some write enabled commands have been implemented starting with 1.90
  1485.          Improved volume/disk locking implemented in version 2.25
  1486.  
  1487.  
  1488.  Update of HPFS internal bad-sector list after a DFS 'scan' command
  1489.  
  1490.    This is a low-priority item, disks with many bad-sectors are doomed anyway
  1491.  
  1492.  
  1493.  Recovery for deleted files (undelete), basics implemented in 2.30,
  1494.  most search/list mechanisms implemented in 2.37
  1495.  
  1496.  Recovery for a 'quick format' on HPFS (unformat)
  1497.  
  1498.  Recovery for repartitioning (un-fdisk)
  1499.