579 582




Linux Unleashed, Third Edition:System Administration Basics





-->















Previous
Table of Contents
Next




If the floppy is full before the entire archive has been copied, tar prompts you for another one. It’s important to keep the arguments in the right order. You see that the f is before the k, so the device name must be before the capacity. All the argument keyletters are gathered together instead of being issued one at a time followed by their value, which is one aspect of tar that can be very confusing.
As a last issue in backing up to floppy, it is sometimes necessary to tell the tar program about the blocking used (blocking identifies how many blocks are used for each chunk of information on the device). A floppy usually has a blocking factor of 4, so the command becomes the following:


tar cvfkb /dev/fd0 1440 4 /usr/tparker


A final problem with tar is that it can’t always handle a generic device such as /dev/fd0 and must be specifically told the disk type.
For more complete information on all the options used by tar, check the man pages or, even better, a good system administration book.
You can use tar to archive compressed files, too, in the same manner. You can also compress a tar file without any problems. In these cases, you might get filenames such as the following:


filename.tar.gz


Filenames such as this show that you should run gunzip first to recover the tar file, and then run tar to extract the files in the archive. You can run the commands together with pipes:


gunzip filename.tar.gz | tar xvf -


The hyphen representing the tar filename after the pipe symbol is standard UNIX terminology for taking the input from the pipe (stdin). The tar command has a lot of other options, many of which are obsolete or seldom used. We look at tar in more detail in Chapter 45, “Backups.”
Backups
The three rules of system administration are back up, back up, and back up. This might sound silly and trite, but a backup can save you whenever you do something silly to the file system or when problems occur. With UNIX, most backups are made to a tape device using tar, although many Linux users don’t have tape units available and have to resort to floppies.
Backups are made with the tar utility, as mentioned earlier. The procedure is exactly the same as shown earlier. To back up the entire system on floppy, the command is as follows:


tar cvfbk /dev/fd0 1440 4 /


To back up to a high-capacity tape device larger than the file system (and hence not needing a capacity limit), called /dev/rct0, the command is


tar cvfk /dev/rct0 20 /


In many cases, you won’t want to back up the entire system, because it’s easier to reinstall off a CD-ROM. However, you should back up your user files by either backing up the entire /usr directory or specifically backing up your own home directory.
To restore a backup, you use the tar command again:


tar xvf /dev/rct0


This recovers all files from the tape device /dev/rct0. You can explicitly restore specific files if you need to.
Several commercial products offer automated backups, although you can do this quite easily with the cron command.
Setting Up Your System
You can perform several little tasks to tweak or optimize your Linux system, although in many cases they are dependent on the version you are running and other applications coexisting. We can look at a few of the miscellaneous tasks here.

Setting the System Name
The system name is contained in a file called /etc/HOSTNAME. It is simply the name the system calls itself for identification, which is especially useful if you are networking your Linux machine with others. Your system name (also called a host name) is what other machines will identify your machine as, so make it a unique and descriptive name. You can call the system anything you want.
To set your system name, you can either edit the system files (which should be followed by a reboot to make the changes effective) or use the hostname command. The following command sets the machine’s name to hellfire:


hostname hellfire


Using a Maintenance Disk
Every system should have a maintenance disk that enables you to check the root file system, recover from certain disk problems, and solve simple problems such as forgetting your root password. The emergency disks, also called the boot/root floppies, are created with the setup program in most distributions of Linux when the configuration is changed.
You can usually create an emergency boot disk from the CD-ROM that the system came on, as well as obtain the necessary files from FTP sites.
After you have booted your machine with the emergency disk, you can mount the disk partitions with the mount command.
Forgetting the root Password
This is an embarrassing and annoying problem, but one luckily easily fixed with Linux. (If only other UNIX systems were so easy!) To recover from a problem with the root password, use a boot floppy and boot the system. Mount the root partition, and edit the /etc/passwd file to remove any password for root; then, reboot from the hard disk.
After the system has booted, you can set a password again.

Warning:  This points out one major security problem with Linux: Anyone with a boot floppy can get unrestricted access to your system!

Setting the Login Message
If you have more than one user on the system, you can display information about the system, its maintenance, or changes in a file called /etc/motd (message of the day). The contents of this file are displayed whenever someone logs in.
To change the /etc/motd file, use any text editor and save the contents as ASCII. You can make the contents as long as you want, but readers usually appreciate brevity. The /etc/motd file is useful for informing users of downtime, backups, or new additions. You can also use it to give a more personal feel to your system.



Previous
Table of Contents
Next














Wyszukiwarka

Podobne podstrony:
582 582
2000 10 Szkoła konstruktorówid!579
01 (582)
576 579
576 579
582 (2)
582,39,artykul
README (582)
579 Finanse Przedsiebiorstw co powinienem wiedziec zaoczni
579 (2)
fryzury; ;wlosy;dlugie,artykul,579

więcej podobnych podstron