home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1997 December / PCO1297.ISO / FilesBBS / OS2 / DFS241S.ARJ / DFS241S.ZIP / DFS.DOC < prev    next >
Encoding:
Text File  |  1997-10-12  |  69.9 KB  |  1,547 lines

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