How to Defrag FAT Volumes After Installing OS/2 (Any Version)

Address Comments/Suggestions to: Mercer Harz, 70431,150

All standard disclaimers apply; this procedure works for me, and others, and I've never had to resort to use of the backup I make. However, disaster can strike at any time; be prepared. Although I have followed these directions (more or less) on a regular basis when defragging my systems, and have not experienced any problems as a result, (under OS/2 v1.2, 1.3, and 2.0, and DOS 4.01 and 5.0), you should still be careful. In particular, attempt to run the defragger with as few device drivers loaded as possible (preferably none); no programs that terminate and stay resident (TSRs); no disk caching software; no extended memory managers; etc. The safest way to run a defragger is to make sure that only DOS and the defragging software are executing.

The instructions below assume that you are using OS/2 2.0 and DOS 5.0. If you are using different versions of these operating systems, the procedures in general are still valid, but the particular details concerning file locations, file names and capabilities of the ATTRIB program may vary.

Currently, there is no support under OS/2 for Stacker or similar on-the-fly disk compression systems. This procedure has not been tested on STACKed volumes; it is very unlikely that, as written, it will work properly on them. When an OS/2 version of STACKER is available, and I get it , I'll update this procedure as required.


 * Requirements:

1. The target volume(s) must be formatted for the FAT file system.

2. You must have a bootable DOS diskette (preferably 4.01 or later). The CONFIG.SYS and AUTOEXEC.BAT for this boot diskette should be as simple as possible; don't load any TSRs, cache programs, memory managers, or device drivers (beyond those required for   hard disk access, if any).

3. You must have a disk defragger (optimizer) that preserves the entire directory entry for a file. There are reserved bytes in   each entry of a FAT-formatted directory; these are used to store pointers to extended attributes. A few older programs did not preserve the contents of these reserved bytes when manipulating directory entries. I've used SoftLogic Systems' "Disk Optimzer" (v4.01 and later) and Norton's "Speedisk" (v4.5 and later) successfully. Other products are likely to work successfully as   well. You can run the defragger from the disk being defragged, from another FAT-format hard disk volume, or, if you copy the defragger onto the bootable DOS diskette, from the diskette.

4. You must have the OS/2 2.0 Installation diskette, as well as   diskettes 1 and 2.

5. You must have a DOS utility, such as ATTRIB, or a disk editor, such as Norton's DiskEdit, with which you can change the file attributes of OS/2 system files that are to be defragged. This utility must be   available on the bootable DOS diskette, or in a directory on a hard disk volume. Alternatively, you could perform the ATTRIB steps described below while booted from the OS/2 installation diskettes, by making explicit references to x:\OS2\ATTRIB.EXE, where x: is   the hard disk volume on which OS/2 2.0 is installed. If you need directions for the use of the ATTRIB command, refer to the online OS/2 Command Reference, in the Information folder. Its syntax description is valid for both DOS (5.0) and OS/2.


 * Procedure:

0. Take a full backup of all volumes that you are going to defrag. If you have an OS/2 backup program, all the better; it will handle backing up and restoring extended attributes automatically. If you have a DOS backup program, look in the libraries in IBMOS2 for one of the utilities that allow you to backup and restore the OS/2 extended attributes using DOS backup software. EABK10.ZIP and EAPREP.CMD are two that I know of (I wrote the latter). Also, there is another program that saves the WorkPlace Shell configuration; it is called WPSBK2.ZIP; highly recommended, regardless of the type of backup software you have.

1. Shutdown OS/2 (click the right mouse button on the desktop, then   select "Shut down" from the popup menu).

2. When you see the message informing you that you can either press CTRL+ALT+DEL or turn off the machine, insert the OS/2 2.0 Installation Diskette in drive A:, then press CTRL+ALT+DEL.

3. When prompted, insert OS/2 2.0 diskette 1. A little while after the OS/2 logo is displayed, you will be asked to press ESC to cancel or   ENTER to continue with installation.

4. Press ESC. You will then be dropped out of installation, to an   OS/2 command-line prompt, logged onto drive A:.

5. Insert OS/2 2.0 diskette 2, which contains CHKDSK.

6. Run CHKDSK /F against every volume that you are going to defrag, while still logged onto the A: drive.

Example: If you are going to defrag volumes C:, E: and F:, issue the following commands, from the [A:]> prompt:

CHKDSK C: /F CHKDSK E: /F CHKDSK F: /F

This is necessary, so that there are no errors in the Extended Attribute (EA) pointers prior to the defrag, and to reclaim space from EAs that have been deleted.

The reason you boot from floppy to do this is that CHKDSK cannot fix disk errors on the disk that it is booted from, because of   system integrity issues.

7. At this point, the faint at heart may want to re-boot OS/2 2.0 from the hard disk, just to make sure that everything still works, particularly if errors were found during the CHKDSK execution(s). If OS/2 won't reboot from the hard disk, DO NOT proceed to the next step; instead, seek assistance, and/or restore your hard disk from the backup. If you successfully reboot OS/2 from the hard disk at this point, shutdown again as described in step 1 before continuing with the next step.

8. Insert the DOS boot diskette into drive A: and press CTRL+ALT+DEL to boot into DOS; do not, under any circumstances, try to run a   disk defragger/optimizer in a DOS session, either emulated or    specific, under OS/2 (or Windows, for that matter). A defragger should always run only under native DOS.

9. If you are defragging the volume that contains SWAPPER.DAT, delete the SWAPPER.DAT file. (The drive and directory containing   SWAPPER.DAT is specified by the SWAPPATH entry in the OS/2    CONFIG.SYS.) Deleting SWAPPER.DAT prior to defragging has two benefits: it shortens the defrag time, and, since SWAPPER.DAT is    deleted and reallocated at every bootup, it will ensure that the page dataset is usually contiguous and located at the "end" of the drive.

10. If you are defragging a volume containing a Windows 3.0 or 3.1 SWAPFILE (386SPART.PAR), leave this file alone. Do not unhide or delete it. Windows allocates this file contiguously; it   never needs to be defragged. Of course, there is an exception: should you need to enlarge the Windows SWAPFILE, use the Windows SWAPFILE program (Win3.0) or the 386 Enhanced Mode Control Panel applet (Win3.1) to delete the current 386SPART.PAR prior to   running the defrag procedure, then, after defragging, use the Windows tool to allocate the larger Windows SWAPFILE.

11. Invoke ATTRIB (or use a disk editor) to clear the HIDDEN, SYSTEM and/or READ-ONLY attributes of the following files:

On the OS/2 2.0 boot volume (if formatted for FAT):

File Name                     Normal Attrs -       x:\EA DATA. SF                Hid R-O Sys x:\WP ROOT. SF                Hid     Sys x:\OS2LDR                     Hid R-O Sys x:\OS2KRNL                    Hid R-O Sys x:\OS2BOOT                    Hid R-O Sys * x:\IBMLVL.INI                     R-O x:\OS2\BITMAP\AAAAA.EXE       Hid     Sys x:\OS2\BITMAP\AAAAA.MET       Hid     Sys ** x:\OS2\SYSTEM\BOOT.OS2        Hid R-O (plus any other hidden files you want to defrag)

* Present only if you have installed Extended Services v1.0 ** Present only if you have installed for DualBoot

On all other FAT volumes:

x:\EA DATA. SF                Hid R-O Sys x:\WP ROOT. SF                Hid     Sys (plus any other hidden files you want to defrag)

Depending on other products you may have installed, there may be   other hidden files that you may want to unhide, so that they can be defragged, relocated, or both.

12. To manipulate the files that have spaces embedded in their names, use DOS wildcards, such as the following example, which will clear all the file attributes for these files:

ATTRIB -H -R -S x:\*.?SF

This example resets the file attributes for the WP ROOT. SF file:

ATTRIB +H +S x:\WP?ROOT.?SF

13. If you are set up for DualBoot, and are defragging the boot disk, DO NOT unhide the DOS system files. Some versions of DOS are not sensitive to the location of the system files, but others require the system files to be located directly behind the root directory, where they are normally placed when DOS formats the hard disk and makes it bootable. The files are usually named as follows:

x:\IBMBIO.COM and x:\IBMDOS.COM   (for IBM PC-DOS) x:\IO.SYS and x:\MSDOS.SYS        (for MS-DOS)

If you unhide these files and the defragger relocates them, depending on the version and/or DOS vendor, you may be unable to boot DOS from the hard disk any longer; fixing this problem usually requires reformatting. OS/2 booting will be unaffected, and DOS itself can still be booted from floppy, then run off the hard drive. But it   is safer not to move these files.

OS/2 1.3 and 2.0 system files are not position-dependent. They can be located anywhere on the boot volume; OS/2 uses directory entries to locate these files.

14. Defrag the disk(s). When using Speedisk, I usually opt for full optimization with file/directory reordering, not just defragging.

15. When the defragging is complete, you can (if you want to) use ATTRIB or a disk editor to reset the file attributes you changed in step 11 back to their original values. This is not necessary, however.

16. Remove the bootable DOS diskette from drive A: and press CTRL+ALT+DEL to reboot into OS/2 v2.0.

17. You are done.

=
============== END OF DOCUMENT ============================ �