Disk Partitions and Backups 233 Putting data on backup tapes is only half the job. For getting it back, Berke- ley Unix blesses us with its restore program. Restore has a wonderful interactive mode that lets you chdir around a phantom file system and tag the files you want retrieved, then type a magic command to set the tapes spinning. But if you want to restore the files from the command line, like a real Unix guru, beware. Date: Thu, 30 May 91 18:35:57 PDT From: Gumby Vinayak Wallace gumby@cygnus.com To: UNIX-HATERS Subject: Unix’s Berkeley FFS Have you ever had the misfortune of trying to retrieve a file from backup? Apart from being slow and painful, someone here discov- ered to his misfortune that a wildcard, when passed to the restore pro- gram, retrieves only the first file it matches, not every matching file! But maybe that’s considered featureful “minimalism” for a file sys- tem without backup bits. More Sticky Tape Suppose that you wanted to copy a 500-page document. You want a perfect copy, so you buy a new ream of paper, and copy the document one page at a time, making sure each page is perfect. What do you do if you find a page with a smudge? If you have more intelligence than a bowling ball, you recopy the page and continue. If you are Unix, you give up completely, buy a new ream of paper, and start over. No kidding. Even if the document is 500 pages long, and you've successfully copied the first 499 pages. Unix uses magnetic tape to make copies of its disks, not paper, but the analogy is extremely apt. Occasionally, there will be a small imperfection on a tape that can't be written on. Sometimes Unix discovers this after spending a few hours to dump 2 gigabytes. Unix happily reports the bad spot, asks you to replace the tape with a new one, destroy the evil tape, and start over. Yep, Unix considers an entire tape unusable if it can’t write on one inch of it. Other, more robust operating systems, can use these “bad” tapes. They skip over the bad spot when they reach it and continue. The Unix way translates into lost time and money. Unix names a tape many ways. You might think that something as simple as /dev/tape would be used. Not a chance in the Berkeley version of Unix. It encodes specific parameters of tape drives into the name of the device specifier. Instead of a single name like “tape,” Unix uses a different name
234 System Administration for each kind of tape drive interface available, yielding names like /dev/mt, /dev/xt, and /dev/st. Change the interface and your sysadmin earns a few more dollars changing all his dump scripts. Dump scripts? Yes, every Unix site uses custom scripts to do their dumps, because vendors frequently use different tape drive names, and no one can remember the proper options to make the dump program work. So much for portability. To those names, Unix appends a unit number, like /dev/st0 or /dev/st1. However, don’t let these numbers fool you /dev/st8 is actually /dev/st0, and /dev/st9 is /dev/st1. The recording density is selected by adding a certain offset to the unit number. Same drive, different name. But wait, there’s more! Prefix the name with an “n” and it tells the driver not to rewind the tape when it is closed. Prefix the name with an “r” and it tells the driver it is a raw device instead of a block mode device. So, the names /dev/st0, /dev/rst0, /dev/nrst0, /dev/nrst8, and /dev/st16 all refer to the same device. Mind boggling, huh? Because Unix doesn’t provide exclusive access to devices, programs play “dueling resources,” a game where no one ever comes out alive. As a sim- ple example, suppose your system has two tape drives, called /dev/rst0 and /dev/rst1. You or your sysadmin may have just spent an hour or two creat- ing a tar or dump tape of some very important files on drive 0. Mr. J. Q. Random down the hall has a tape in drive 1. He mistypes a 0 instead of a 1 and does a short dump onto drive 0, destroying your dump! Why does this happen? Because Unix doesn’t allow a user to gain exclusive access to a tape drive. A program opens and closes the tape device many times during a dump. Each time the file is closed, any other user on the system can use the tape drive. Unix “security” controls are completely bypassed in this manner. A tape online with private files can be read by anybody on the sys- tem until taken off the drive. The only way around this is to deny every- body other than the system operator access to the tape drive. Configuration Files Sysadmins manage a large assortment of configuration files. Those allergic to Microsoft Windows with its four system configuration files shouldn’t get near Unix, lest they risk anaphylactic shock. Unix boasts dozens of files, each requiring an exact combination of letters and hieroglyphics for proper system configuration and operation. Each Unix configuration file controls a different process or resource, and each has its own unique syntax. Field separators are sometimes colons, sometimes spaces, sometimes (undocumented) tabs, and, if you are very
Previous Page Next Page