home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 26 / CD_ASCQ_26_1295.iso / vrac / doslfn10.zip / DOSLFNBK.TXT < prev    next >
Text File  |  1995-10-05  |  21KB  |  455 lines

  1. DOSLFNBK v 1.0 - Backs up/restores Win95 long filenames in DOS
  2.  
  3. Copyright (c) 1995 D.J. Murdoch.
  4.  
  5. 0. Contents of this file
  6.  
  7.    1. Syntax
  8.    2. Description
  9.    3. Details
  10.    4. Memory Limitations
  11.    5. Safety
  12.    6. Recovery from Total Disk Failure
  13.    7. License
  14.    8. Release History
  15.    9. Acknowledgments
  16.  
  17. 1. Syntax:
  18.  
  19.       DOSLFNBK directory [options]
  20.  
  21.         will back up all the long filename records in the named
  22.         directory and subdirectories of it to a file called
  23.         BACKUP.LFN.
  24.  
  25.       Options:
  26.         /f filename  Back up to this file instead (default .LFN
  27.                      extension)
  28.         /force       Force DOSLFNBK to go ahead without asking questions,
  29.                      even when it may be unsafe
  30.         /nr          No recursive:  don't do subdirectories
  31.         /nt          Don't restore times from LFN backup
  32.         /p           Prompt before each filename restore (ignored
  33.                      during saves)
  34.         /r           Restore from existing backup
  35.         /v           Give running status report
  36.         /d filename  Write a detailed debugging log to filename
  37.  
  38.       Examples:
  39.  
  40.         For recovery from a total disk failure, see below.
  41.  
  42.         To back up every long filename on the disk into BACKUP.LFN:
  43.  
  44.            doslfnbk c:\
  45.  
  46.         To restore just the Windows directory and subdirectories:
  47.  
  48.            lock c:
  49.            doslfnbk c:\windows /r
  50.            unlock c:
  51.  
  52.         To restore just the root directory, but no subdirectories:
  53.  
  54.            lock c:
  55.            doslfnbk c:\ /r /nr
  56.            unlock c:
  57.  
  58.         The following is not allowed; you need a full path:
  59.  
  60.            doslfnbk .  <---- Error!
  61.  
  62.         To restore the "Program Files" directory name and its
  63.         subdirectories, you need two runs:
  64.  
  65.            lock c:
  66.            doslfnbk c:\PROGRA~1 /r
  67.            doslfnbk c:\ /r /p /nr
  68.            unlock c:
  69.  
  70.         On the second run, you'll be prompted for each name to restore;
  71.         just say yes when you see "Program Files".
  72.  
  73. 2. Description:
  74.  
  75.         Microsoft's Windows 95 introduces long filenames (LFNs), and
  76.         they are mostly compatible with old software.  However, there
  77.         are some problems.  Old backup programs don't recognize LFNs, so
  78.         they don't get properly backed up.  Worse, the Win95 backup
  79.         program doesn't support a lot of common backup hardware (e.g.
  80.         Colorado Memory Systems tape drives using accelerator cards) and
  81.         won't run in DOS mode, so recovery from a catastrophic disk
  82.         failure can be really difficult.
  83.  
  84.         To address this problem, Microsoft put a program called LFNBK on
  85.         the Win95 CD ROM to back up your LFNs.  However, it's very
  86.         inconvenient to use.  It requires changes to your Control Panel
  87.         settings before and after use, and it works by stripping all the
  88.         LFNs off your disk --- so you need to restore them again after
  89.         you've done your backup to tape.  It will only run after Win95
  90.         has booted, so again you've got big problems after a
  91.         catastrophic disk failure.  If you've got a program that is
  92.         completely incompatible with LFNs then you might want to use
  93.         LFNBK, but for routine system backups it's too much of a pain.
  94.  
  95.         I wrote DOSLFNBK to address these problems.  It runs in any
  96.         version of DOS that can see your disk, and can both backup and
  97.         restore your files there.  During backup, it makes no changes to
  98.         the names, so you can routinely run it just before a tape backup
  99.         and not have to undo the damage afterwards.  It also allows
  100.         partial backups and partial restores; I'm pretty sure LFNBK is
  101.         an all-or-nothing affair.
  102.  
  103.         The downside of DOSLFNBK is that it has to work on the disk
  104.         below the file system level.  This means that if other programs
  105.         are running simultaneously, it can get confused, and may cause
  106.         errors in the backup or even errors on the disk itself.  I
  107.         recommend running it only in a single-tasking DOS session,
  108.         unless you're quite sure no other program is writing to the
  109.         disk.
  110.  
  111. 3. Details:
  112.  
  113.         When doing a backup, DOSLFNBK reads the directories on the disk
  114.         and writes copies of all of the LFN records to the BACKUP.LFN
  115.         file (or whatever file you specify with /f).  If you use the /nr
  116.         option, it will work only on the specified directory; otherwise,
  117.         it saves those entries as well as everything in any subdirectory
  118.         below it.
  119.  
  120.         You'll get a warning if you run it in Windows mode, since other
  121.         programs might change the directories while DOSLFNBK is running
  122.         and cause it to store and/or restore garbage.
  123.  
  124.         The /force option tells DOSLFNBK to go ahead without stopping
  125.         for this warning, or several others (e.g. overwriting the backup
  126.         file).  Use it in a batch file only when you're sure you always
  127.         want it to go ahead.
  128.  
  129.         You *must* give the drive letter and a full path to the
  130.         directory; relative directory specifications are not supported.
  131.         Note that the directory name itself won't be backed up or
  132.         restored; only the files and subdirectories within it.  There is
  133.         no way to specify a subset of the files; you have to use the /p
  134.         prompting option if you want this.
  135.  
  136.         The original drive letter is not stored in BACKUP.LFN, so you
  137.         can use DOSLFNBK to save the long filenames on one drive, use a
  138.         DOS utility to move them to another drive, and then restore the
  139.         filenames there.
  140.  
  141.         During a restore, you should use the DOS command LOCK to give
  142.         DOSLFNBK access to the disk at a low level.  I can't find
  143.         documentation for LOCK anywhere, but perhaps it would also make
  144.         it safe to run DOSLFNBK in a multitasking environment.
  145.  
  146.         DOSLFNBK will normally not overwrite an existing LFN with a
  147.         different one; you should rename the file to its 8.3 alias
  148.         before running if you want to restore an old name, or run with
  149.         the /p option for individual prompting.
  150.  
  151.         Normally, DOSLFNBK will restore the backed up date information,
  152.         since older DOS versions and DOS utilities probably don't save
  153.         this properly.  You can override this behaviour by using the /nt
  154.         switch.
  155.  
  156.         If during a restore, DOSLFNBK detects that the file size has
  157.         changed, you'll be prompted as to whether you want to restore
  158.         the LFN or not.  If you choose to restore it, the date
  159.         information will *not* be restored, as it is probably incorrect.
  160.  
  161.         During a restore, the file attributes of the file on the disk
  162.         will be kept.
  163.  
  164.         To show you the progress of a run, DOSLFNBK prints a dot for
  165.         about every 10 directories examined or (in /v mode) prints the
  166.         directory and file names.  If it stops printing for more than a
  167.         few seconds, something is probably wrong.  Try running again
  168.         with the /d debug log option, and if it stops again, please
  169.         email me (dmurdoch@mast.queensu.ca) a copy of your log, along
  170.         with a description of your system.  I'm very interested in
  171.         making DOSLFNBK as bug-free as possible.
  172.  
  173.         When a run is successful, DOSLFNBK exits with ERRORLEVEL 0.
  174.         When something goes wrong, it prints an error message and exits
  175.         with a higher errorlevel. The currently defined error levels
  176.         are:
  177.  
  178.          99 = Syntax error
  179.          98 = Error initializing disk
  180.          97 = Error reading disk
  181.          96 = Error writing disk
  182.          95 = Error in directory on disk
  183.          94 = Error setting up directory
  184.          93 = Error opening backup
  185.          92 = Error reading backup
  186.          91 = Error writing backup
  187.          90 = Error closing backup
  188.          89 = Memory error
  189.          88 = Multitasker running
  190.          87 = Backup file exists
  191.          86 = Debug log problem
  192.  
  193. 4. Memory Limitations:
  194.  
  195.         When running, DOSLFNBK keeps copies of several directories in
  196.         memory at once.  It is written as a real mode DOS program and
  197.         keeps all of this data in the low 640K of memory.  This means
  198.         that in a typical DOS session with 500K of memory available,
  199.         DOSLFNBK will run out of memory when about 15,000 directory
  200.         entries are in memory.  On a restore, up to 3 copies of each
  201.         directory entry may be in memory at once, limiting DOSLFNBK to
  202.         disks with fewer than 5000 directory entries in any branch of
  203.         the directory tree.  (The total number of files on the disk
  204.         doesn't matter; what matters is the number of entries in a
  205.         directory, its parent, grandparent etc., back to the root.)
  206.  
  207.         I think disks approaching this limit are very unusual. However,
  208.         it *is* possible to have such a disk, and here's how to find
  209.         out if you do:
  210.  
  211.         Run your backup with the /V verbose option.  At the end, it
  212.         will print a message something like
  213.  
  214.            Used 255K; restore will require about 264K in DOS session.
  215.  
  216.         If the amount of memory estimated for the restore is more than
  217.         you have available (as reported by the DOS MEM command), you
  218.         might have problems.  You might not; the number reported is
  219.         usually an overestimate.
  220.  
  221.         If it ever turns out that you do run out of memory during a
  222.         restore, you can still restore the LFNs by breaking up the
  223.         restore operation into several steps, restoring different parts
  224.         of your subdirectory tree separately.  In the worst case (more
  225.         than 5000 entries in a single subdirectory), you may have to
  226.         temporarily move files out of the directory and restore the LFNs
  227.         a few thousand (!!) at a time.
  228.  
  229. 5. Safety:
  230.  
  231.         DOSLFNBK works with your disk at a level below the file system,
  232.         so if things go wrong during an LFN restore, it's conceivable
  233.         that you could lose whole files or directories.  I've tried to
  234.         make it as safe as I can, but you should follow some simple
  235.         precautions:
  236.  
  237.           - If you aren't sure of the integrity of your file system, run
  238.           Scandisk before DOSLFNBK and get it to fix any errors.  In
  239.           particular, if you've run other low level software (e.g. a
  240.           defragger or a directory sorter) that may have messed up the
  241.           LFNs, run Scandisk first.
  242.  
  243.           - If you choose to run in Windows despite the warning about
  244.           the multitasker, then definitely don't make changes to files
  245.           in the directories where DOSLFNBK is currently restoring LFNs.
  246.           You're *very* likely to lose your new work.
  247.  
  248.           - Don't turn off or reboot your PC in the middle of a DOSLFNBK
  249.           run.  If there's a power failure or (horrors!) a bug in
  250.           DOSLFNBK forces you to reboot, then Scandisk should be able to
  251.           repair much of the damage.  You may lose some filenames, but
  252.           Scandisk should be able to recover the files themselves.
  253.  
  254.           - If you hit Ctrl-Break or Ctrl-C during a DOSLFNBK restore,
  255.           it shouldn't do any damage other than giving you only a
  256.           partial restore of your LFNs --- but this is *not* a
  257.           well-tested feature, and there may be conditions under which
  258.           you'll suffer worse damage.  Again, Scandisk should be able to
  259.           repair most of it.
  260.  
  261.           - DOSLFNBK was written for version 4.00.950 of Windows 95 (the
  262.           August 1995 release).  It hasn't been tested on the earlier
  263.           beta test versions or on any later releases.  If the VFAT file
  264.           structure isn't what DOSLFNBK is written for, it could do some
  265.           real damage.
  266.  
  267.           - This is the first release of DOSLFNBK to the public.  There
  268.           may still be special conditions on your system that it doesn't
  269.           handle.  If you can, try it out when you've got a good second
  270.           backup to make sure it works.  If it doesn't, *please* send me
  271.           details, and I'll attempt to fix it.
  272.  
  273. 6. Recovery from total disk failure:
  274.  
  275.         If your boot disk fails, or you decide to repartition it, then
  276.         you may need to do a full restore from a backup tape.
  277.         Unfortunately, the Win95 backup program provides *no way* to do
  278.         this without re-installing Win95 from the original disks or CD
  279.         ROM.  From reports I've heard, the same is true of the
  280.         just-released Win95 version of Colorado Memory System's backup
  281.         program and some other commercial backup programs.
  282.  
  283.         However, if you have a reliable DOS-based backup program,
  284.         DOSLFNBK will let you do a complete restore from a backup.  I've
  285.         only had to do this once, so these instructions aren't
  286.         guaranteed to cover everything for every system, but they worked
  287.         on mine.
  288.  
  289.         ADVANCE PREPARATIONS:
  290.  
  291.         Before your disk fails (i.e. right now! :-), you need to prepare
  292.         the following:
  293.  
  294.           1. A Win95 startup disk.  If you didn't create one when you
  295.           installed Win95, start the Add/Remove Programs option in
  296.           Control Panel, and click the Startup Disk tab. Then click the
  297.           Create Disk button, and follow the instructions on-screen.
  298.  
  299.           2. A copy of your DOS-based backup/restore program on a floppy
  300.           disk.  It may require EMS memory; if so, you should put
  301.           HIMEM.SYS and EMM386.EXE on your startup disk, and load them
  302.           via CONFIG.SYS.
  303.  
  304.           3. If you use Drivespace disk compression, then you should also
  305.           make sure that the MINI.CAB file from the installation disks
  306.           or the CD ROM is in your Windows directory.
  307.  
  308.           4. A full backup of your disk(s).  Just before creating this,
  309.           run DOSLFNBK to save all of your long filenames.  You'll need
  310.           to create one backup file for each disk.  It's fine to leave
  311.           this on the hard disk so that it ends up on the backup; you
  312.           don't need to have it on floppy disk.
  313.  
  314.         WHEN YOUR DISK FAILS:
  315.  
  316.         Depending on the reason for your disk failure, you may be able
  317.         to skip some of the early steps here.  Read them over, and
  318.         figure out where to start.  If you have to, you can start again,
  319.         so the only thing you lose by starting too far down is time.
  320.  
  321.           1. Make any necessary repairs to your hardware.
  322.  
  323.           2. Boot from your Startup disk, and use FDISK to partition
  324.           your disk.  Use "FORMAT c: /s" to reformat the disk and
  325.           transfer the system files to it.
  326.  
  327.           3. (Optional) Transfer your tape backup software to your hard
  328.           disk.
  329.  
  330.           4. If you're not planning to use Drivespace, you can skip down
  331.           to step 8.
  332.  
  333.           5. If you want to compress your drive, you need to restore
  334.           enough of Win95 to run Drivespace.  Don't restore the whole
  335.           disk; you might not have room for it.  For most people,
  336.           restoring the files in the root directory and the files in the
  337.           Windows directory should be enough.  If you have any essential
  338.           drivers in other directories, you'll need to restore them too.
  339.           Finally, you should restore DOSLFNBK and the data file(s)
  340.           containing the backed up long filenames.
  341.  
  342.           IMPORTANT:  You should not overwrite IO.SYS, but you *should*
  343.           overwrite MSDOS.SYS.  It is a hidden read-only file in your
  344.           root directory.  A good way is to erase MSDOS.SYS before
  345.           starting the restore (use ATTRIB from the Startup disk to
  346.           remove the System, Hidden, Read-only attributes), and then
  347.           telling your restore program not to overwrite existing files.
  348.  
  349.           Restore all those files now.
  350.  
  351.           6. Restore the long filenames by running
  352.  
  353.              LOCK C:
  354.              DOSLFNBK c:\ /R /V /F backupfilename
  355.  
  356.           7. Remove the Startup disk, and reboot your system.  You may
  357.           get some errors about missing drivers (e.g. no sound card
  358.           drivers), but things should basically work.  Run DriveSpace to
  359.           compress your drives the way you want.
  360.  
  361.           8. Reboot your system in DOS mode or from the Startup disk.
  362.  
  363.           9. Restore all rest of the files on all of your disks from the
  364.           backup now.  See the "IMPORTANT" note in step 5 about
  365.           MSDOS.SYS and IO.SYS.
  366.  
  367. +          10. Restore all the rest of your long filenames by running
  368.  
  369.              LOCK C:
  370.              DOSLFNBK c:\ /R /V /F backupfilename
  371.  
  372.           and if you've also got a D: partition,
  373.  
  374.              LOCK D:
  375.              DOSLFNBK d:\ /R /V /F backupfilename
  376.  
  377.           You may get messages about some long filenames already
  378.           existing from your first restore; don't worry about those.
  379.  
  380.           11. Some restore programs set the archive bit on all restored
  381.           files; you might want to turn it off (since you've still got
  382.           those files backed up) at this point.
  383.  
  384.         Reboot your system, and things should be back as they were when
  385.         you did your backup!
  386.  
  387. 7. License:
  388.  
  389.         DOSLFNBK is *not* public domain software, but you may use it at
  390.         no charge.  You may distribute unmodified copies of the complete
  391.         DOSLFNBK package, provided your total charge is no more than $1.
  392.         The total cost of a compilation (e.g. a CD ROM) including
  393.         DOSLFNBK must be no more than $1 per package in the compilation.
  394.  
  395.         DOSLFNBK was written in Borland Pascal 7.01, using the excellent
  396.         Object Professional library from TurboPower Software.  You can
  397.         obtain the source code (including an object-oriented low-level
  398.         disk access unit and a huge memory support unit, but not Opro)
  399.         by sending a cheque or money order for $50 (in Canadian or US
  400.         dollars, or the UKP equivalent of $50US) to:
  401.  
  402.          Duncan Murdoch
  403.          337 Willingdon Ave.
  404.          Kingston, Ontario, Canada.
  405.          K7L 4J3
  406.  
  407.         You can also order source code from the Public (software) Library
  408.         (PsL) using MC, Visa, AmEx, or Discover card:
  409.          - by calling 800-242-4775 (US only)
  410.          - by calling 713-524-6394
  411.          - by faxing your order to 713-524-6398
  412.          - by sending your order by Compuserve to 71355,470.
  413.          - by sending your order by Internet to 71355.470@compuserve.com
  414.         PsL only accepts payment in US dollars.  Please give PsL your
  415.         name exactly as it appears on the card, and tell them your
  416.         card's expiry date.  DOSLFNBK is PsL product #14247.
  417.  
  418.         The PsL numbers are for ordering only.  I *cannot* be reached at
  419.         the PsL numbers.  To contact me for information about dealer
  420.         pricing, volume discounts, site licensing, the status of
  421.         shipment of the product, the latest version number or for
  422.         technical information write to me at the address above or at one
  423.         of the email addresses below.  I'd especially like to hear bug
  424.         reports and suggestions for improvements.
  425.  
  426.          Fidonet:    DJ Murdoch at 1:249/99.5
  427.          Internet:   dmurdoch@mast.queensu.ca
  428.          Compuserve: 71631,122
  429.  
  430. 8. Release history:
  431.  
  432.        0.0 - first beta test version
  433.        0.1 - kept file attributes of existing file during restore.
  434.        0.2 - made messages more informative; fixed bug in handling
  435.              erased file entries; added check of overwrite of backup
  436.              file; changed default name of backup file to BACKUP.LFN and
  437.              made LFN the default backup extension; added /P option.
  438.        0.3 - fixed memory leak that caused run-time error 203 on large
  439.              restore
  440.        0.4 - added check for successful write of backup file, added
  441.              /force option.
  442.        0.5 - added report of memory use, /d option, many debugging messages
  443.        0.6 - cleaned up messages and debug log, removed disk size
  444.              restriction, added progress dots for non-verbose runs.
  445.        1.0 - first public release --- same as 0.6
  446.  
  447. 9. Acknowledgments
  448.  
  449.         DOSLFNBK was written based on the information in Robert Hummel's
  450.         article on Win95 long filenames in the June/July 1995 issue of
  451.         PC Techniques Magazine.  Thanks are due to the beta testers, who
  452.         suggested many improvements, and several of whom were put to
  453.         considerable inconvenience by early versions that messed up
  454.         their disks.
  455.