The magazine of the Melbourne PC User Group
Beginners' Basics Part 3
Ron Wilby
|
 |
This month, we start as usual with some wordy stuff to fill up the pages (usually called introductory explanations), then we'll have some more practical work, same as we did last month. Quite a few callers have praised this approach. I wonder if I can keep it up. Let's try.
What Are These Files Anyway?
This morning I had a call from a reader who seemed uncertain about the files he is "pushing about," to use his words. What can these DOS files contain?
A file is only a collection of information with a file name for reference, so that DOS can find it. It may contain data or programs or both. The programs are instructions that guide the computer to do what you tell it. The data is information, some of which you have put in, as in writing a letter. Some will be the result of the computer having processed what you put in, as when working with numbers.
Why are we pushing these files about? To get the results we want from the computer. These results can be as simple as the printing of a letter you have written to your friendly neighbourhood grog shop. They can be complex alterations to a spreadsheet or database affecting thousands of entries. They can be information which you want to extract from the computer, such as how many bottles of the '78 Cab Shiraz you have left in the cellar (or under the bed).
Large Application programs contain many files, designed to work together. For example a word processor may use a system file, a help file, and other auxiliary files to enable you to create documents and process them.
The DOS File System
Whatever operating system or environment you use, yes, even Windows, you need to know about files.
A big job for any operating system is to provide an organising system to store data. In most systems, this data is in the form of files. These files will usually be stored on some kind of disk, although many people are now using tapes as backup storage. For example, you save a memo or letter from your word processor and there is a new file on your hard disk. You don't have to bother with the details of how that is done, DOS does the hard bits. It takes responsibility for moving data (files) to or from disks. It decides how your data is organised on those disks and provides commands for manipulating it. Each file is a named group of bits of binary data (means it consists of Os and ls) that DOS appears to move around as though it was one continuous unit. However, many files end up as a number of fragments, scattered on your hard disk. This occurs when you work on a file many times. You create the file in fragments, and DOS cannot put these fragments end to end in a nice tidy manner. DOS sticks the bits in any old spot which happens to be empty. It is up to you to tidy up this mess from time to time. I'll come back to that.
What we never see is the way in which DOS keeps track of these fragments and the internal tables that record the details of the file organisation which is required.
DOS imposes no structure on a file. Each file is to DOS a stream of binary information, and it has no way of knowing whether the file is part of a database or just an unimportant memo. It is important to understand that it is your application program which applies structure to files. This means that a file created by, say, WordPerfect, can only be read by WordPerfect. There are some exceptions to this rule but generally you need the application to read the file it created. Thus you can't send a Word- Perfect file on a disk to a friend who uses only MS Word.
Disks and Diskettes
The original floppy disks were 8 inches in diameter (they didn't hold much data for their size either). Officially, the sizes we now use, 5.25-inch and 3.5-inch, are called diskettes. The larger one is a minifloppy, the other a microfloppy. Don't worry about it, they're all floppy disks or just floppies, when you go to buy some.
You write-protect your floppies by putting a piece of opaque material over the notch (5.25-inch) or sliding a little tab away from a hole (3.5-inch). Write-protect means you prevent the disk drives from writing any new information and thus destroying what's already there. Note that you cover the hole for 5.25-inch and uncover it for 3.5-inch disks.
The File Allocation Table
The tracks of disks, floppy and hard, are divided into short sections of 512 byte capacity called sectors. You can think of the sectors on a disk, hard or floppy, as storage bins for lumps of data. Large files require a great number of these storage bins. Not all the sectors can be used for data. Usually the sectors of track 0 are reserved for DOS's own "bookkeeping" space. In this space DOS keeps a log (record) of all used and unused disk sectors. This log is called the File Allocation Table, often referred to as the FAT. There are usually two copies of the FAT stored on a disk.
DOS may assign sectors one by one or in groups of two, four or even more adjacent sectors. These groups are called clusters or in later DOS versions allocation units. My hard disk has 4-sector allocation units. Because computers like to work with numbers which are powers of two (means 2, 4, 8, 16, 32 and so on), the number of sectors per allocation unit is always a power of two. If you type CHKDSK at your C:\> prompt you'll get that information about your hard disk.
The FAT will list allocation units rather than sectors, thus reducing the space it
takes up. This makes DOS more efficient. However, this does waste some disk space. On my disk, a file of only one byte must be given one allocation unit of 2048 bytes. Small files are therefore uneconomical with your precious hard disk real estate.
After you erase a file, the actual data remains in position. DOS simply removes the appropriate allocation units from the FAT, which makes them available for reuse. Because the data remains, we can use the UNDELETE command to recover the "erased" files, provided they haven't been written over since they were "erased."
The Breeding Ground - Files and Floppies
It is usual, but definitely not essential, to divide up your hard disk into directories. Why bother, why not just save each file as it's created and shovel it off to the hard disk. DOS will be able to find it again. Two reasons. One, so DOS can find your file much more quickly because it has only to search the files in one directory instead of the whole hard disk. Two, you may have some hope of finding that file you created three weeks ago if you only have to search through one directory. If you're a new user, you may only have 100 files on your hard disk, so what's the problem, you say? Well, it's this breeding business. You'll soon have hundreds or even thousands of files on your disk, they breed you see, while you're asleep. High class fertiliser for this is provided by installing new or updated applications, which breed many new programs. How many files do you have on your disk? I have 1790, would you believe, and fm sure many members have more than that. My directory for these columns has more than fifty files. And those floppies! They breed too. I started with two packets of 5.25-inch disks and a nice disk box beside the monitor. It held 50 disks, should last a fair while. Now I have seven larger boxes and another for the 3.5-inch disks and there are floppies lying around everywhere.
A Word About Help
I'm getting lots of calls from readers and fm really pleased about that. Unfortunately there are limits to what I can do over the phone. Some problems need an expert to help, running diagnostic tests on your computer. Some problems are specific to particular software, and you need someone who is knowledgeable with that software. For example, someone rang recently with a problem with MS Word, a program I've never used. Better and quicker help would have come from any of the six people listed under Word in our Dial Help pages. Last gripe. Would everybody please keep to the rules published for Dial Help volunteers? Please don't expect me to return calls. Try again or ring someone else. Remember, fm a volunteer, with many interests and commitments. I'd like to help but I just don't have the time to return your calls.
Some Practical Work
Now, start up your computer and let's actually Do Something! Earlier I was talking about fragmentation of your files. I said it's up to you to tidy up the mess on your hard disk from time to time. How often is that? Depends on how much work you do. Once a week would be plenty for most people, once a fortnight OK for many. 1b see where you stand, get to the good old DOS prompt and type the command
CHKDSK *.*
and press Enter. You'll see something like this:
Volume DOG created 21-01-94 6:22p
Volume Serial Number is 1CF9-A4F0
127,690,752 bytes total disk space
81,920 bytes in 3 hidden files
98,304 bytes in 37 directories
52,563,968 bytes in 1790 user files
74,946,560 bytes available on disk
2,048 bytes each alloc. unit
62,349 total allocation units
655,360 total bytes memory
346,784 bytes free
If you have fragmented files, CHKDSK will tell you about them at this point. Now you may run your defragmentation program. Other names for this may be disk optimiser, unfrag etc. Where do you get it? Well, PC Tools, Norton and other collections of utilities have defrag programs included.
Otherwise, if you have DOS 6.x, read your manual. Particularly important is to exit any programs that are running. Be especially careful to exit Windows, which may be running in the background without your being aware of it. Then, simply type DEFRAG at the command prompt and you'll see a screen allowing you to select the drive to DEFRAG. Select your C: drive, sit back and watch DEFRAG work-quite interesting. When finished, and this may take twenty or thirty minutes if you have a lot of fragmentation, you'll be pleased to see that everything runs noticeably faster. This is good housekeeping. Try to remember to do it sometimes.
Using an Unfamiliar Disk
Do you have a disk from the Club's Shareware library (or anywhere else) that you're not certain how to use? If you know what to do, you are reasonably expert and can skip this part.
First run a virus check on the disk before you do anything. DOS 6 has Microsoft's Anti-Virus, obtained by issuing the command MSAV at the prompt. I found it clanky and slow, but it does work. A better alternative is to obtain McAfee's SCAN anti-virus suite from our shareware library.
Next issue a command to get a directory of the files on the disk. The commands are DIR/P to get the files
listed one screen at a time or DIR/W to get them listed in columns. If there are files with names like README.1ST or README.NOW then look at those first. They may have useful instructions on using the disk's programs. Issue the command TYPE README I MORE or README.1ST I MORE and press Enter. The addition of the vertical slash and the MORE command displays the file one screen at a time. The vertical slash " I " is the top of the backslash "\" key, at the bottom right of my keyboard.
[Ed: but at the top right of mine, wouldn't true compatibility be a wonderful thing? PS)
Third be aware that files with the extension .COM, .EXE or .BAT will run (means do something) if you type only their name without the extension and press Enter. Look for files like GO.BAT or STARTBAT.
Just type GO or START and you're off.
Often you will find the disk contains a large file with the extension .LZH. This is an archived or compressed file and you have to decompress (expand) it first. Usually the expansion utility is also on the disk. For LZH files, it is LHA.EXE, so you just type LHA and enter, then follow the instructions. Get a copy of ARCMASTER or SHEZ from our library, they will help with this unarchiving business.
That's it for this month but I'll be back.
Reprinted from the November 1994 issue of PC Update, the magazine of Melbourne PC User Group, Australia
|