How to Use the DOS BACKUP Command by the Disk Doctor -------------------------------------------- Copyright (C) 1987, the Disk Doctor. First published in the Rochester (PC)^3 News: Picture City PC Programming Club PO BOX 20342 Rochester, NY 14602 The Disk Doctor may be contacted at this address, or via CIS [73147,414]. This material may be reproduced for internal use by other not-for-profit groups, provided this copyright notice is included. ---------------------------------------------- [Don't let a mistake or a power glitch wipe out all your data. Regular, intelligent backups are the best protection against all forms of disk damage.] A backup is a copy of a program or data that is made to safeguard against damage to the program or data by accidental means. This backup procedure was written with IBM Personal Computers as a basis. All commands referenced in this procedure are found in the DOS manual. The reasons for backing-up disks and files relate to any brand of personal computer. Why do Backups? Your programs and data disks should be backed up because accidents will happen. Your disks may be damaged from incidents beyond your control. If you have established a plan for backing up your data and programs then when something does happen you are protected. If you wait until something happens to your data then it will be too late. You can't use a backup that you don't have. "If you can't afford to lose it, you can't afford not to back it up". What Should I Backup? Everyone who uses a personal computer should backup the data and programs that are used. Purchased Programs: Used on a Hard Disk (PC-XT or PC-AT) Programs that are copied to a hard disk and run from the hard disk do not need to be backed up. You already have backed up the program by initially copying it to the hard disk. Used on a Two Floppy Diskette System (PC) Programs that are run on a PC using one or more floppy diskettes should be backed up to protect against damage to the program disk. Most purchased, copy protected software will come with an additional copy of the program disk or a special procedure for making a backup. If it comes with the additional copy than a backup is not necessary. You should read the directions that accompany purchased software very carefully to insure that you are backing up the software correctly. User Written Programs All user written programs should be backed up whenever changes are made. Data Files and Disks All data files should be backed up on a regular and consistent basis to safeguard against loss of data. The frequency of back ups depends on the individual application. How Often Should I Backup? When to backup data disks depends upon the difficulty of reconstructing the data once it is lost and the need to reconstruct the data when it is lost. Some variables that will influence the decision of when to backup a data disk are: 1. How often are changes made ? 2. How much data was changed ? 3. Are other sources of the data readably available ? 4. How important is the data? 5. How much time will you spend reconstructing the data? ----------------------------------------- How to Do a Backup? There are several ways to backup data depending on the type of system you are using. The following commands are for IBM or MS-DOS computers. COPY This is a DOS command that is used to make copies of files. It can be used to backup a floppy disk by placing a formatted disk in drive B: (the "target") and inserting the disk you are going to make a backup of in drive A: (the "source"). You then issue the command "COPY A:*.* B:". This command will copy all files from the current directory (see your DOS manual for more on directories) on the disk in drive A:, appending them to the disk in drive B:, if there is room. This command may also be used to make copies of files from a hard disk to a floppy disk. The command is issued from the directory containing the files that are to be backed up. For example, COPY *.* A: This would copy all files in the current directory of the hard disk to the floppy disk in drive a, if there is room on the floppy disk in drive a. A verify option is available for use with this command. This insures that all files were written to the disk correctly. More information on this command can be found in the DOS manual. DISKCOPY This is a DOS command that can be used to make a backup of a floppy diskette. Place a disk in drive B: (the "target") and the DOS disk in drive A:, then issue the command DISKCOPY A: B: You will be prompted to place your source disk in drive A:, (the disk you want to copy). ALL FILES ON THE TARGET DISK WILL BE LOST when you execute this command. This command will make an exact copy of the source disk. More information on this command can be found in the DOS manual. It is a good idea to use a write protect tab on the disk you wish to copy. It will prevent the accidental erasure of a data disk if you make a mistake when issuing the command. DISKCOMP This command is used to compare two diskettes after using the diskcopy command. It is a good practice to compare the original to the copy after using the diskcopy command. This command is not meaningful when used after the copy command. BACKUP (FOR Hard Disks -- PC-XTs AND ATs) This command can only be used for backing up files from a hard disk. You should have plenty of empty, formatted disks available before issuing this command. To determine the number of disks necessary, issue a directory command (DIR) for the hard disk. At the end of the listing of files you will be shown the available bytes. If you have a 10 Meg hard disk, subtract the available bytes figure from 10,500,00 and divide by 350,000 to arrive at an approximate number of disks necessary. For example, if the system indicates that there are 6,500,000 bytes available then you subtract 6,500,000 from 10,500,000 to arrive at a figure of 4,000,000. Then divide this by 350,000 to arrive at a figure of 11.4 or 12 disks. This figure represents the maximum number disks necessary to backup the hard disk. The backup command has several options that let you choose which files are to be backed up so you may not need all the disks. It important to have enough disks available before you start. If you don't then you have to start over from the beginning. Once you have determined the number of disks needed to perform the backup you should number them, starting at 1. This is important, if you have to restore these files to the hard disk you must do it in the same order that you backed them up. When you have the necessary number of disks available issue the command BACKUP C:\ /s A: The letter (C:) must be the drive indicator of your hard disk. The "\" says to start at the ROOT directory. The "/s" indicates that you want to backup all subdirectories of the ROOT directory. The "A:" represents the target drive that you are backing up the files to. There are many switches that may be used with this command ("/s" is an switch). These options allow you to backup only those files that have been changed since the last backup. Another option allows you backup files created since a specific date. A third option lets you append files to a previous backup disk. Please refer to you DOS manual to get an explanation of these switches. RESTORE This command is used to restore your files to the hard disk in the event that the hard disk has been damaged. You should refer to the DOS manual for more information about this command. To use this command you must have "backed up your hard disk by using the "backup" command. Final Notes There are a number of commercial and public domain utilities that improve on the DOS BACKUP command. This article describes only those commands in native DOS. If you exercise good judgement in backing up your files you will save yourself time and aggravation if something does happen to your disks. Your individual situation will dictate how frequently you should backup your files. For some people it may be once a day, for others once a week and still for others once every two weeks. Backups take time, but compare it with the time it will take to reconstruct the disks with no backup. Take care of your backup diskettes. They won't do you any good if they are lost or damaged when you go to use them. The single best insurance against any type of disk problem is frequent, intelligent backups.