PAKIT Operating Instructions. Usage: .PAKIT disk-name:[p,pn]/switches Example: .PAKIT DSK1:/Q Parameters: disk-name - the name of the disk to pack. [p,pn] - optional, the ppn area at which to start the operation. PAKIT will skip searching of the lower ppn's for files to move. /switches - optional, one or more of the following. /D - process directory blocks only /Q - do it in the quick mode /S - process sequential access files only /R - process random access files only At any time in the operation of PAKIT, the program can be terminated (with partial results realized) by hitting control-C. Page 2 PAKIT How It Works PAKIT consolidates all the free space on the disk by moving all the sequential access files (text files, programs, etc.) down to the bottom of the disk and moving all the random access files (data, libraries, etc.) up to the top. This is the natural distribution of these two types of files since that is the way AMOS allocates them when they are created. As you, and your programs, edit and erase files, gaps appear throughout the disk. PAKIT fills in those gaps by moving files adjacent to the largest gap into the smaller gaps. It does this in three phases. 1. It reads all the directories and gathers data for the packing operation. 2. It moves sequential files down to pack against the bottom of the disk. Only those files that are too high are actually moved. 3. It moves random access files up, starting at the highest random access file, and proceeding on down to the lowest. Only those files that will move up are actually moved. Files that are imbedded in the sequential files area are left there; they are already in a good location. In phase 1, PAKIT adds up the sizes of all the sequential files, makes a table of all the random access files, and packs the directory blocks themselves (including all UFDs and the MFD). In phase 2, using the "high-water" value calculated from the sizes of the sequential files as a mark, it moves all sequential access files that are above that mark down under that mark. Then in phase 3 it squeezes out the space in the random access files area by shoving all the random access files up. Page 3 PAKIT Optional Modes of Operation Doing a straight PAKIT, with no switches, as in PAKIT DSK1: will consolidate all free space into one contiguous area. There is nothing else you need to do but wait for it to happen. There are some faster ways to get adequate results, and we will describe them here. 1. /D - The /D switch causes PAKIT to operate only on the directory blocks. It will skip the processing of the files. Although directories do not occupy very many blocks on a disk, just one directory block in the middle of a 400 block space will turn that one large area into two very much smaller areas. /D will get that block out of the way. /D will also give you a directory of all the random access files on the disk, and the count and accumulative space used by the sequential files and the random access files, respectively. 2. /R - The /R option causes PAKIT to operate only on the random access files. It will skip the process of checking the sequential files for position. Directory blocks will be read, but not moved. 3. /S - The /S switch will cause PAKIT to operate only on the sequential files. It will skip the processing and moving of the random access files. Directory blocks will be read, but not moved. (continued) Page 4 PAKIT Optional Modes of Operation (continued) 4. /Q - The /Q switch is the most interesting and useful of the switches. It provides a means of doing an "almost" pack, in a quicker fashion. Since the location of the first block in all sequential files is contained in the directory, you don't need to read a block in order to make a decision on the first block. If we make the assumption, often valid, that the rest of the sequential file will be somewhere nearby, then if the first block does not need to be moved, then very likely neither does the rest of the file (and vice-versa). With the /Q switch on, PAKIT will make a decision based on this assumption and scan the rest of each sequential file only if the assumption justifies it. Additionally, for this decision the high-water mark is moved down to 75% of the normal mode's value. This way some files that are close enough to the boundary will be scanned anyway. 5. [p,pn] - Including a P,Pn specification with your disk specification will cause PAKIT to begin its processing at that P,Pn, skipping the scanning and relocating of any files in P,Pn's below that number. This causes faster but still effective processing because, as experience has shown, most of the editing and erasing of files occurs in a few, higher P,Pn areas. Therefore most of the advantage of relocating files can be found in the files contained in those P,Pn areas. As you use PAKIT more often, the disk that is being packed tends to become "acclimated" to PAKIT. The more frequently you use it, the quicker and more effective will be the /Q mode. This is because your less frequently modified files tend to float to the bottom, and the fewer files that you access frequently will float around on top. It's a process of sedimentation. Use the FREE program included with PAKIT to determine the effectiveness of PAKIT operations in their various modes. You should not need to use PAKIT more than once a day, even in the most active environments. Page 5 PAKIT Bells and Whistles As PAKIT does its work, it will type on the screen certain information about what it is doing. This includes: 1. ' - a quote mark is typed each time PAKIT moves a directory or MFD block. 2. file name - the file name of a sequential file is type as PAKIT scans its structure to determine if blocks within it should be moved. 3. <- - an arrow is typed beside the name of a sequential file when at least one block in that file is being moved. 4. random access file directory - PAKIT lists a directory of all the random access files on the disk before it goes onto process them. 5. file name - again, PAKIT types the name of a file, this time a random access file, as it processes it. 6. ^ and v - to move a random access file, PAKIT reads as many blocks of that file as possible into memory, then writes those blocks back to their new location. This method minimizes the amount of head movement in the disk drive itself. Each time a random access block is read, PAKIT types a v; each time a block is written back, PAKIT types a ^. Page 6 PAKIT ! ! ! ! CAUTION ! ! ! ! It is important that no other jobs be accessing the disk that is being packed. In fact, no other program should have files open on that disk. Since the process of PAKIT is to move files around on the disk, those files will not be where other jobs expect them once PAKIT is finished; the other jobs must look up their files again. So all programs accessing the disk that is being packed must be restarted after PAKIT is finished. One notable example is the DRAVAC software, ANDI and TSASS. These programs keep pointers to files on the disk in their local memory. This is one of the reasons that they can access files and databases so quickly. PAKIT may move one of the files that they are pointing to; then they'll be looking in the wrong place for it. The interesting point about this example is that TSASS is a program that is running all the time! If PAKIT finds it necessary to move a TSASS file, then you will have to reset your system in order to continue properly. So the rule is, 1. Before you run PAKIT, exit all programs that are accessing files on the disk you are going to pack. 2. If you are running TSASS, then do PAKIT on all disks you wish to pack, then reset the system. You should be careful when using PAKIT. This program is operating on the very structure of your disk and files, so an abnormal interrupt of the program can be dangerous. (An interruption by control-C is perfectly safe). If the system fails while PAKIT is running, some file or some directory may be lost. If the system fails while PAKIT is moving a random access file, that file will have bad data in it. If the failure is while PAKIT is processing a sequential file, then the structure of that file may be damaged. If the failure is during the first few moments of PAKIT, while it is operating on the directory blocks, then whole directories may be lost. A DSKANA m_u_s_t_ be executed if the system fails in the middle of a PAKIT operation. .