home *** CD-ROM | disk | FTP | other *** search
/ Phoenix CD 2.0 / Phoenix_CD.cdr / 11a / diskprep.zip / DISKPREP.DOC < prev   
Text File  |  1987-04-23  |  10KB  |  182 lines

  1.      From PC-Magazine Volume 5, Number 21, December 9, 1986
  2.      PROGRAMMING/UTILITIES, Jeff Prosise, pages 303-324
  3.  
  4.      RETROFITTING A DOS SYSTEM
  5.  
  6.      Every time you get out a new floppy disk, you face the choice of
  7.      whether to format it with or without the DOS system files.  Having the
  8.      system on the disk is often handy, especially at boot time or when the
  9.      transient portion of COMMAND.COM gets overlayed.  But space is
  10.      precious on a 360K disk, and the two hidden system files, together
  11.      with the command processor COMMAND.COM, eat up almost 40K of that
  12.      space in DOS 2.1, 68K in DOS 3.2.
  13.  
  14.      Inevitably, you occasionally leave off the system files only to wish
  15.      later that you hadn't.  The DOS SYS command doesn't help at this
  16.      point, since it can add a system only if the disk is blank or if
  17.      certain critical areas of the disk were initially reserved by using
  18.      the FORMAT/B option.  Of course, if you'd had the foresight to reserve
  19.      the space, you'd have installed the system to begin with.  (The /B
  20.      switch was included with DOS simply so that non-IBM software vendors,
  21.      who could not legally sell disks with copyrighted system files
  22.      included, could reserve room for users to add the system after
  23.      purchase.)  Usually, your only recourse is to format a fresh disk with
  24.      FORMAT/S and copy everything from the old disk onto the new one.
  25.  
  26.      DISKPREP.COM provides a better solution.  DISKPREP rearranges the data
  27.      clusters, the file allocation table, and the directory of a nonsystem
  28.      disk so that the SYS command will successfully add the system even if
  29.      some of the disk files presently occupy territory needed by the
  30.      system files.  It also lets you delete existing system files and
  31.      replace them with more current ones.
  32.  
  33.      Transforming a nonsystem disk into a system disk is a three-step
  34.      process that begins by preparing the disk with DISKPREP.  The syntax
  35.      for DISKPREP is simply
  36.  
  37.           DISKPREP [d:]
  38.  
  39.      where d: is an optional drive specifier for use if the target disk is
  40.      not in the default drive.  Up to 44K of free disk space, depending on
  41.      the version of DOS you use, are required for SYS.COM to add the two
  42.      hidden system files.  In addition, at least two entries in your disk's
  43.      root directory must be unused.
  44.  
  45.      If DISKPREP finds that your disk has less than adequate space, it will
  46.      abort with a message indicating as much.  If that happens, delete one
  47.      or more files to free up some room and try again.  If the disk your're
  48.      prepping is already system formatted, the program will display the
  49.      message "System already installed - Delete old system (Y/N)?" and
  50.      await your keypress.  If you respond with a Y, the old system will be
  51.      erased; if you answer N, execution will terminate harmlessly.  In the
  52.      unlikely event that DISKPREP encounters an error condition such as a
  53.      lost cluster when traversing an allocation chain, it will abort with
  54.      an "Allocation chain error" message and leave you to your own devices.
  55.      Another possible but unlikely occurrence is that DISKPREP will find
  56.      one or more bad sectors in the area of the disk where the system is to
  57.      be installed.  If that happens, the message "Bad sector in system
  58.      area" is issued and execution is aborted.
  59.  
  60.      Once DISKPREP has finished, you use the SYS.COM program supplied with
  61.      DOS to install the system on the disk.  This simply involves copying a
  62.      pair of hidden system files from one disk to another and ensuring that
  63.      they occupy certain areas in the directory and the data space.
  64.      Fortunately, SYS takes care of that task.  SYS's syntax is almost
  65.      identical to that of DISKPREP and is detailed in your DOS manual.
  66.      Note that if you try to use the disk after DISKPREPing but before
  67.      SYStemizing, DOS will think that it's dealing with a newly formatted
  68.      disk and will respond to a DIR request with a "File not found"
  69.      message.  Likewise, using CHKDSK to analyze a disk that has been
  70.      prepared but not yet SYStemized may produce some strange results.
  71.      Have faith: as soon as SYS.COM is run, your files will reappear intact
  72.      and the disk will be ready for use again.
  73.  
  74.      The final step in transforming your disk into a complete system disk
  75.      is to copy the file COMMAND.COM from your DOS disk to the target disk.
  76.      This is necessary because, unlike FORMAT/S, SYS does not automatically
  77.      add COMMAND.COM for you.  You simply use the DOS COPY command to
  78.      perform the transfer.
  79.  
  80.      The three steps involved in the SYStemization process are natural
  81.      candidates for a batch file, and to facilitate just that use, DISKPREP
  82.      terminates with a return code that can be read by the conditional
  83.      parameter ERRORLEVEL.  If the disk prepping process was successful,
  84.      ERRORLEVEL is set to zero.  If the prepping process was not
  85.      successful for any reason, DISKPREP executes its normal abort routine
  86.      complete with a message revealing the nature of the error and sets the
  87.      ERRORLEVEL return code to 1.  A suitable batch file (you might call it
  88.      SYSTEM.BAT) is listed below.  It assumes that the program disk is in
  89.      the default drive and that the target disk is in drive B:
  90.  
  91.           DISKPREP B:
  92.           IF ERRORLEVEL 1 GOTO END
  93.           SYS B:
  94.           COPY COMMAND.COM B:
  95.           :END
  96.  
  97.      DISKPREP works on floppy disks of the 40-track variety with one or two
  98.      sides and eight or nine sectors per track.  This covers all four 5 1/4
  99.      inch disk formats supported by versions of DOS prior to 3.0 but
  100.      excludes hard disks, high-capacity (1.2-meg) floppies like those used
  101.      by the AT, and the 3 1/2 inch disk cartridges used by a number of
  102.      laptop portables.  Attempting to process one of the latter types of
  103.      disks isn't harmful: the program will quickly recognize the
  104.      unsupported format and abort with an "Illegal disk format" message.
  105.  
  106.      Two cautions are in order.  First, do not use DISKPREP on a disk that
  107.      contains subdirectories.  While sometimes subdirectories will not
  108.      interfere with the reallocation process, at other times their presence
  109.      may cause an "Allocation chain error" message, prevent existing system
  110.      files from being deleted (resulting in the error message "Cannot
  111.      delete system files"), or result in a damaged file allocation table.
  112.      Fortunately, there's little use for tree-structured directories on a
  113.      floppy, anyway, so this limitation is not too serious.  Second, it's
  114.      risky to try to prep a copy-protected disk, since many copy protection
  115.      schemes alter the disk format.  DISKPREP should work with any current
  116.      release of DOS but may or may not be compatible with future versions.
  117.  
  118.      If you run SYS.COM on a nonsystem disk that isn't empty without
  119.      first running DISKPREP, SYS will usually respond with a "No room for
  120.      system on destination disk" message.  In some cases, however, SYS may
  121.      appear to add the files successfully, though you'll find that the disk
  122.      won't boot even though SYS apparently succeeded.  So, check any disk
  123.      you SYStemize by booting your PC with it.  If you have a disk with an
  124.      improperly installed system, DISKPREP can be used to correct it.  The
  125.      program's ability to delete system files works just as well with a
  126.      faulty system as with one added properly.  Even DISKPREP will
  127.      sometimes fail if you delete a system installed under DOS 3.1 and
  128.      resystemized with the DOS 2.1 version of SYS.  If you encounter this
  129.      problem, don't dispair; DISKPREPing the disk a second time and running
  130.      DOS 3.1 SYS will restore it unharmed.  There seems to be no problems
  131.      with replacing system files with a system of the same version of DOS
  132.      or later, which is the normal requirement.
  133.  
  134.      DISKPREP begins by parsing the command line for a drive specifier.
  135.      If no drive is specified, DISKPREP uses DOS function call 19h to get
  136.      the default drive and thereafter uses the default as the target drive.
  137.      The drive identifier, whether input explicitly or by default, is
  138.      checked, and execution terminates if comething other than drive A: or
  139.      B: is specified.  This provides one measure of assurance that DISKPREP
  140.      won't try to reallocate space on a hard disk.
  141.  
  142.      Be aware that any program, no matter how extensive its testing and
  143.      use, may fall prey to hidden bugs or anomalies.  [One user has
  144.      cautioned that ProKey should not be loaded in advance of using
  145.      DISKPREP, for example.]  It's always prudent to keep backup copies of
  146.      important files and disks.  But when you need to add a system to a
  147.      disk in use, DISKPREP's the easy way to go.
  148.  
  149.  
  150.  
  151.  
  152.          ----------------end-of-author's-documentation---------------
  153.  
  154.                         Software Library Information:
  155.  
  156.                    This disk copy provided as a service of
  157.  
  158.                         The Public (Software) Library
  159.  
  160.                   Disks in the library are updated monthly.
  161.          For a copy of the latest monthly software library newsletter
  162.           and a list of the 800+ disks in the library, call or write
  163.  
  164.                         The Public (Software) Library
  165.                                P.O.Box 35705 K
  166.                            Houston, TX 77235-5705
  167.                                (713) 721-6104
  168.  
  169.          We are not the authors of this program, nor are we associated
  170.          with the author in any way other than as a distributor of the
  171.          program in accordance with the author's terms of distribution.
  172.  
  173.          Please direct shareware payments and specific questions about
  174.          this program to the author of the program, whose name appears
  175.          elsewhere in  this documentation. If you have trouble getting
  176.          in touch with the author,  we will do whatever we can to help
  177.          you with your questions. All programs have been tested and do
  178.          run.  To report problems,  please use the form that is in the
  179.          file PROBLEM.DOC on many of our disks or in other written for-
  180.          mat with screen printouts, if possible.
  181.  
  182.