We have spoken about the configuration of the hard disk partitions and how they can help in maintaining and upgrading a Linux system. Now we will turn our attention to how to backup a Linux system. Once we understand backup strategies, we will look at how to share directories across the network to simplify the backup of the workstations.
Lets start by reviewing what we should backup and what there is no point in saving on a backup device. The short answer is anything which is part of the installation should not be backed up, and anything unique to this machine should be backed up.
Lets start with a list of the common directories as defined in the File System Standard. And add a couple of others which are common on most Linux installs. Here is the list:
The directories I added to the standard were:
Given this strategy what should not be backed up. By directory it would be /bin, /boot, /dev, /lib, /mnt, /sbin, /tmp, /usr, and /var. All these directories contain files which were installed by the original CD’s or later upgrades. In Redhat Linux the upgrades are performed using RPM’s so they are easy to redo. I did not list the root directory since it would contain all the sub directories.
The what should be backed up by directory then: /home, /usr/local, /root, /etc /opt, /storage and /var/spool/mail. This combination of directories would backup all the user created data along with system configuration file and upgrade packages.
Given the backup tape defined above how would you restore a system from say a hard disk crash? Assuming you get the hard ware fixed or a new computer.
The obvious place to start is by reinstalling the Operating System from the initial CD’s. This will give you a running installation from which we can go to the backup tape. If you restore the tape you should put back the the home directories, and the sources for the package upgrades first, directories /home, /usr/local, /root, /opt and /storage. Next you should run the upgrades again. This is don by changing to the /storage directory and using the command rpm -U *.rpm. This will go through all the rpm package files in the directory and update everything. Once the updates are in place, you should run the tape restore again to replace the configuration files in /etc and the /var/spool/mail files. At this point you could simply restart all the services, but it is probably easier to reboot. Yes reboot is useful in Unix since it restarts all the services.
On our home network we had both Linux and windows workstations. Lets look at a strategy to save the user data from our Windows PC to the users home directory on the Linux Server. If you go to Windows explorer and select the tools menu, the Map network drive selection. In the drive box select a convenient drive letter. In the folder box, browse to your Linux server and select the folder containing the user’s name. What you have just done is map the Linux server directory /home/user to a drive letter under Windows, lets call it D:. This allows the windows machines to read and write to the users home directory on Linux. I would normally create a directory named something like edit . I then configure the Windows programs to use a folder under edit to save their data. So, if you are setting up Mozilla for use, configure the folder d:\edit\mozilla as the place to save the address book and bookmarks. This way, when you backup the Linux servers /home directory, you will be backing up the window’s users personal data as well.
So how do you do the same trick for the Linux workstations? This is a little tricker, but not all that hard. Here are the steps:
On the Linux server create the configuration file /etc/export. This file lists what resources are available for NFS mount. This file lists the directories who can access it and the permissions of the mount. So it might look like this:
This says allow the computer 192.168.1.5 to NFS mount the directory /home/frank for read/write access.
Edit the file /etc/fstab and the following line:
wizard:/home/frank /home/frank/edit nfs 0 0
The will tell the computer to make the connection at boot time.
That is all that is needed to allow the Linux workstation to keep the created data on the Server. The advantage to this setup is that if the network went down the workstations are still running but not connected.
You could make the Linux workstation use wizard:/home/frank in place of the local /home/frank. The advantage to this is that if the local Linux workstation was not working, the user could log into the Linux server console and work from there until his/her machine was fixed. The windows user does not have this luxury since his/her programs will not run under Linux. Of course if they are using tools like mozilla and OpenOffice, they could use the Linux server too.
To give you an example why this strategy works well. When one of my sons trash their computer, they do their homework on another computer by telneting into the server and running all the programs from there. This highlights one of Linux’s strengths, since X-windows allows the display and the computer to be on different boxes, you can run Linux programs over the network. If you are really ambitious you can turn the workstations into Thin Clients and run all the applications from the server. But that is another discussion.
So we have learned how a backup strategy can save you time and effort. With some configuration changes, you can do all your backups from the server and still recover the information on the Workstations. By centralizing the information this way you simplify your work.
Written by John F. Moore
Last Revised: Tue Nov 1 20:39:05 EDT 2016