The magazine of the Melbourne PC User Group

Beginners basics: Part 7
Ron Wilby

G'day to all our readers and may your numbers grow every day. Here we go again, with something to learn and something to enjoy. Last month I threatened you with learning about the startup files, remember? You may think this is an interruption to the smooth flow of the series, but the time has come for you to take control.

Back to last month

In case any of you don't have last month's Beginners' Basics - part 6, I'm going to refer to it briefly.

When you start (boot) your computer, the last in the sequence of boot programs looks for a file called CONFIG.SYS. This is one of the two startup files (the other is AUTOEXEC.BAT). You can modify either of these files to make your computing more fun and we'll show you how.

The CONFIG.SYS file is a plain ASCII text file located in the root directory of the boot disk. That's usually your hard disk, drive C:. What's an ASCII file? See part six of this series for full descriptions. AUTOEXEC.BAT is also a plain ASCII file located in the same directory, but DOS uses them differently. The last boot program looks at CONFIG.SYS and attempts to carry out the commands therein. Control is then handed over to the command processor, COMMAND.COM, which looks for AUTOEXEC.BAT. This is a batch file (more of those later) so DOS carries out the commands in that file one after another. These two files together set up your computer each time you boot up (switch on). The details of this setup depend on what's in the two startup files. A reminder. The startup files are read once only in the booting process. If you change the commands in either of these files, you'll have to reboot (restart) the computer before you'll see the effect of the changes.

Understanding CONFIG.SYS

Although we complain about DOS and sneer at its many shortcomings, there's some pretty clever stuff there too. As you begin to understand this operating system, you'll find you can do some exciting things with the flexibility that has been built into DOS. This means more choices for you to make. We are about to show you how to make those choices in an intelligent way. There's no difficulty here, all you have to do is collect a few commands. Then you put them in a plain ASCII file, using DOS Editor as described last month, reboot, and your changes take effect.

Perhaps you don't have a CONFIG.SYS file at all! It's not essential, the default values from DOS will get you going. But they may not make the best use of your expensive hardware. More likely, someone has made a CONFIG.SYS file for you when you bought your computer, taking an educated (?) guess at what should go in the file. Why don't you have a look? Get to the DOS prompt and issue the command

TYPE CONFIG.SYS

or get into the Editor and look at, but don't edit the file. These startup files aren't essential, your computer can be started without them. What they do is make your PC run exactly the way you want it to run. You'll have a computer different from mine and everybody else's. If you grow tired of the setup you've made, you can change it. Not yet though!

CONFIG.SYS commands

So you've looked, and you're wondering what it's all about. I'll explain. There are fifteen commands you can use in CONFIG.SYS. You type each command on a separate line and DOS obeys them, one after another. These commands enable you to have enhancements to your system. When we've looked at the available commands, you'll be able to create your own CONFIG.SYS file. Hold it right there, do nothing until you have read more! There are some very important precautions to be taken before you interfere with the startup files, or you may be unable to start your computer at all. This happened to me. I made the on-screen lettering the same colour as the background (black). Everything was running, but I couldn't read anything. I soon used my disaster disk to get out of that one.

BREAK is the first CONFIG.SYS command we'll look at. It specifies when DOS is to look for the Ctrl+C or Ctrl+Break sequences. You may already have learned that these two sequences are helpful, but not foolproof, panic buttons. You will have noticed that DOS took a noticeable time to respond to these sequences. This is because most of the time DOS is busy doing other things, and only looks for Ctrl+Break at intervals. What intervals? The default setting for Break is OFF, which means DOS only checks for Ctrl+Break when working with the ports (plugs and sockets) at the back of the computer. I don't find this very useful, so prefer a line in my CONFIG.SYS which reads BREAK=ON. Note that the equals sign is not essential. A minor disadvantage of having Break ON is a slightly slower performance, and occasionally a program will run erratically with Break On. Don't worry about it.

Using BUFFERS

A buffer is a reserved area of RAM (Random Access Memory) set up by DOS to temporarily store information which it has read from disk. If your CONFIG.SYS file has made the number of buffers large enough, DOS will often be able to find the data it wants in buffered memory. This is much faster than having to go back to disk. The use of disk-caching programs has made the Buffers command less important than it was, but you still need to check with the manual for your particular program, putting a line in your CONFIG.SYS file such as

BUFFERS=20

The DOS default setting for the number of Buffers is interesting. For example, if you have more than 128 KB of RAM (yes, one-two-eight), then the default buffer number is five. If you don't have a hard disk, your default number of buffers is two.

Buffers and your memory

When you tell DOS to go and get information from a disk, that information is read in whole sector increments. Later DOS versions call these sectors "allocation units." The sector size varies with the size of the disk, it's 2048 bytes on my 250 MB hard drive. DOS reads from the disk in full sectors, and uses a buffer as a holding area. The buffer is a part of your RAM and therefore is accessed much faster than disk. Excess data not required from that sector is left in the buffer. Thus, if it requires that data later, DOS doesn't have to perform another (slow) disk access to get it. It's there already in the buffer.

Similarly, data is held in a buffer when DOS is writing to a disk. When the buffer is full, it is "flushed," which means the data is written to disk and the buffer is ready for use again. Of course, all buffers are flushed when a file is closed.

How many buffers?

We get to specify the number of buffers being used, by putting a line in the CONFIG.SYS file, like BUFFERS=20. This number depends on the type of programs you use, and on the amount of conventional memory you have. Accounting and database work use data in small chunks, so more buffers are needed. Up to 40 is normal, more if you have a large hard disk. Remember that buffers use some of your precious memory, so don't go berserk. Load them into high memory along with the rest of DOS.

Device drivers

If you're a regular reader, you'll have read a lot about device drivers. Printer drivers, for example, are often mentioned. We all use them, they're essential if you want to print any of your work. Let's look at what's available and how you can use it. To install a device driver at boot-up time, you put a line in your CONFIG.SYS file using the DEVICE command. Usually a device driver has a name with the extension .SYS, for example ANSI.SYS. What's that? Tell you later, it'll fill a page or two. To have ANSI.SYS loaded, you'd put

DEVICE=ANSI.SYS

in your CONFIG.SYS file. You can have as many device drivers as you like loaded, but of course they use up your precious RAM. We use CONFIG.SYS to load only those drivers we really need. Note that DOS must be able to find ANSI.SYS before it can load it. You may have to specify a path, e.g. DEVICE=C:\DOS\ANSI.SYS, depending on where ANSI.SYS is located. You don't know much about paths? We haven't really covered that subject, but we will.

Disk caches

If you have DOS 5 or higher, you have a disk cache, called SMARTDRV.SYS. Not everybody uses this, but you should know it's there and what a cache means.

You can think of SMARTDRV.SYS as a large, intelligent buffer. Whether you use buffers or cache, your system is faster because slow disk read/write operations are replaced by much faster memory to memory transfers. Caches are better than buffers because they're smarter. A cache remembers which sections of the disk have been used most frequently. When the cache is full and must be recycled, it keeps the most frequently used areas and discards those not so often used. Compare this with a buffer, which recycles areas depending on how old the buffer is, and takes no account of the amount of use an area has had. DOS versions 5 and 6 have "look-ahead" caches, in which the cache reads more sectors than the program requests. To make use of SMARTDRV.SYS, you need expanded or extended memory. You just can't devote large lumps of ordinary memory to a cache program. You need it all to run your Application programs. A long discussion on the various types of memory might be a help to you at this stage, but that'll have to wait.

The FILES command

You definitely should have a FILES=nn command in your CONFIG.SYS, where nn is a number. This is the number of files that DOS can have open at any one time. The default value is eight, but that definitely isn't enough for modern programs. When you install a new program, it will often modify the number of files specified. Otherwise, a number may be recommended for you to put in your CONFIG.SYS file. FILES=30 seems to work OK for me, although I'm told Windows runs faster with FILES=60. Only way to check this is try it and see, and this means its time for your practical work section.

Practical work

Please follow these instructions carefully. If you don't, you may get into diabolical trouble, and it'll be no good ringing me. The first thing to do is for you to make two disaster disks. You should already have one, but my phone tells me many of you don't.

Making your panic disk

Also known as your disaster recovery disk. Opinions vary as to exactly what is needed here, but the first essential item is that you must have a bootable floppy disk. This is one which, when placed in drive A: before you switch on, will get your computer going. To make this disk, first get to your DOS prompt (see part 1 of this series). If you have the DOS menu on screen, exit by pressing Alt+F4 (for DOS versions 5 or 6).

Your disaster disk

Now, you need a good quality floppy disk of the right size. Unless your computer is pretty old, this will be 1.2 MB for 5.25-inch disks or 1.44 MB for 3.5-inch disks. Put this disk in your floppy drive and type the command A: at the prompt. Press Enter and you'll have a prompt like A:\>. Now type the command

FORMAT A: /S

Check that your prompt actually specifies drive A:. Not any other drive, and especially not C:. Some versions of the FORMAT command remove all data from the drive you format and if that happens to be your C: drive you're in trouble. Press Enter. Formatting will start, and you must wait a minute or two. Note that formatting may be unnecessary if you have bought already formatted disks. In my view, though, it's better to format disks on your own drive. Your hardware may be different from that of the factory that made the disks.

DOS versions 5 and 6 perform "safe" formats, which means you can use the UNFORMAT command to recover from an accidental loss of data. Earlier versions destroy all data when FORMAT is used. After formatting, DOS will tell you

System transferred

and invite you to give the disk a volume label. Just type the name you want and press Enter. DOS will then give you details about the format, such as:

1,213,952 bytes total disk space 
(or 1,457,664 for a 3.5-inch disk) 
1,213,952 bytes available on disk 
(or 1,457,664 for a 3.5-inch disk)

512 bytes in each allocation unit 2371 
(or 2459 for 3.5-inch disk) allocation units available on disk

Watch for bad sectors (parts of the disk that cannot be used) at this point. If there are any, throw the disk away or return it to the shop for a refund.

Putting this disk in drive A: and switching on will start your computer. However, we can improve on that a bit. DOS will ask you to enter the date and time, but if your clock is still OK just press Enter at both of those. You should now be looking at the prompt A:\>. If your disaster includes the total loss of data from your hard disk, you may need to FORMAT the hard disk first from your disaster disk, using the command FORMAT C: /S. Note that this command will destroy any data which is on your hard disk (UNFORMAT may be able to recover it). The format program will be on your disaster disk (see below). From this point you can reconstruct a totally blank hard disk by following the installation procedures given in the manuals of your programs. Start by reinstalling DOS so that you have available all the basic commands such as COPY, DIR, and DISKCOPY.

Copying files to your disaster disk

Whatever files you need to restore your application programs you can copy from the original program disks you bought. You'll need to read the manuals and go through the installation process to get your applications running. Your hard work in the form of documents, database or spreadsheet will have to be restored from your backup system, whatever it may be. If you have used DOS Backup and Restore then you will be able to restore your data. If you are using another backup, such as PC Tools, then you must have the files that backup method needs for restoration already on your disaster disk. Some other files which may be helpful to have already on your disk include basic versions of your "startup files," CONFIG.SYS and AUTOEXEC.BAT. These are put there by MS DOS setup from your original DOS disks. Your old files can't be used yet because after a total loss of hard disk data not all the files they call for would be available at first.

I suggest you get your C:\> prompt and with your disk in A:, type

COPY CONFIG.SYS A:

and press Enter. You should get a message

1 file(s) copied.

Now type

COPY AUTOEXEC.BAT A:

and that file will be copied too.

We must now RENAME these two files so that DOS will not use them as "startup" files, but they will be available for you to copy to your hard disk later in the recovery process.

So, type A: and press Enter at your prompt, and you should see your prompt change to A:\>. Then type

REN CONFIG.SYS CONFIG.OLD

and press Enter. Then, type

REN AUTOEXEC.BAT AUTOEXEC.OLD

and press Enter.

Type DIR to give you a directory (list) of the files on your disaster disk to check that the whole process has been successful. If you're restoring DOS versions 5 or 6.x (and you wouldn't restore anything older, would you?), the MS-DOS setup procedure will put versions of CONFIG.SYS and AUTOEXEC.BAT in your hard disk root directory. These will get you started, then you can copy CONFIG.OLD and AUTOEXEC.OLD from your disaster disk to your newly restored hard disk. Of course you must use REN to rename both these files.

Other useful files to copy to your disk are:

QBASIC.EXE 
EDIT.COM 
FORMAT.COM 
FDISK.EXE 
UNFORMAT.COM 
SYS.EXE 
XCOPY.EXE 
UNDELETE.EXE


These files will reside on your hard disk, probably in C:\DOS, so you just copy them to your disaster disk as described above for CONFIG.SYS and AUTOEXEC.BAT.

Depending on the exact disaster, you may need to restore the CMOS settings you are currently using. A disk from the shareware library, Melb 1977, should be used to make a copy of your current CMOS settings. This is important, keep it safe. If you are a real beginner, you may need some help here, but beware of friends with good intentions but little knowledge. Alternatively, PC Tools makes a recovery disk for you.

Last task. Use XCOPY or DISKCOPY to make another disaster disk which you store off-site (means in another building somewhere). Now, put one of your disaster disks in drive A: and restart your computer. Your opening screen won't be what you're used to, but you should be up and running with a prompt something like A:\>. If so, you've got yourself a vital item for recovery from a hard disk crash or similar catastrophe. Check that your other disaster disk works OK, too.

This month I'd wanted to tell you how to change your CONFIG.SYS and AUTOEXEC.BAT files. Well, I've lots more to tell you on all this, but I've run out of time and we're taking up a large amount of PC Update real estate already. So, as usual, we'll have to continue next month. The Dial Help pages may be best if your query is program-specific, but please read the rules. 

Till next time...

Reprinted from the May 1995 issue of PC Update, the magazine of Melbourne PC User Group, Australia

[About Melbourne PC User Group]