Upgrading an Existing System

Upgrading an Existing System

The fact that your computer contains an existing Linux installation presents its own set of problems. When I first started using Linux, none of the distributions did an upgrade in the sense that other OSs did them. In every installation (at that point), the root file system was overwritten (during which all data is lost). If your data is on a different file system, it is “probably” safe. However, all the configurations that you have done in the files on your root file system are gone.

However, that was more of a design than a problem. If you wanted to upgrade the kernel, that’s all you had to do. Most programs did not (and still do not) depend on specific releases of the kernel, so upgrading presented few problems for them. Keep in mind that the newer kernel versions support ELF binaries. If you have an older program that is in a.out format, it will still run on the newer kernels. However, newer ELF binaries won’t run on older kernels.

Also, upgrades to the kernel occur at fairly frequent intervals. These upgrades are not full copies of the newest kernel but rather patches to an existing one. Even if you do replace the entire kernel, you rarely have to do more than replace the /usr/src directory.

When programs or sets of programs (packages) are updated, you only need to upgrade what you want. You can find the latest versions of the packages in several places on the Internet. The most common format is RPM, so you can use the rpm program to install and upgrade your programs. Many distributions have glint, which is a graphical program with which you can remove and install each package.

One advantage of glint is that you can install sets of packages. For example, you have a set of editors, such as emacs and vi. Rather than first installing emacs and then vi, you can install them both at once.

SuSE uses YAST2, which is a very extensive administration tool and which you to not only install the software, but it can check and resolve missing dependencies (packages which are needed to run the one you are trying to install.) Here you can see what it tooks like:

If you don’t like YAST2, you can try Kpackage, which is specifically for the KDE environment. Here you can see what it looks like:

In both cases (YAST2 and Kpackage) you can display the packages group based on their functionality, like editors or networking. In each case, you can see what dependencies this application has, the version and so on.

If you don’t have any of these tools or simply don’t want to use a graphically tool, running rpm from the command line is only slightly more complicated. Although there are a large number of options and arguments, it is fairly straightforward to install something.

If you have an older hard disk (read: smaller), you might run into problems with some of the new distributions. My SuSE 8.2 contains 5 CDs (or two DVDs) and if you decided to install everything (one of the options), you may find yourself running out of space. I created a 3 Gb partition for /opt on my 20 Gb drive (when 20 Gb was a large drive). After about a year of updates and installation of invidual software I started running out of space on /opt.

If you are upgrading your system and find out you are running out of space (or just through normal usage), there is hope. Obviously you will need some place to put it, so we will assume that you have an additional drive. Create partitions on the new drive and mount them to a directory that is not being used. A common place is /mnt, but I often create a new direcotry that is somehow related to what I am trying to move. For example, I might create a /opt2 directory and mount the files system there.

Once mount you can copy (not move) the files to the new filesystem. The cp should have an option -R or -recursive with will copy everything recursively (what else?). In the unlikely event your version of cp does not have a recursive option you can use cpio. Change into the old directory and run:

find . | cpio -pvdum /new_directory

Once the files are copied, you need to change the /etc/fstab to reflect the new filesystem. For example, assuming you want to put the /opt directory on a new disk (let’s say the first partition of the second hard disk), your in /etc/fstab might look like this:

/dev/hdb1 /opt xfs defaults 1 2

Next, rename the old directory (i.e. /opt.old) and then rename the new directory to the original name (i.e. mv /opt2 /opt). Now reboot.

. Note that I did not say to remove the old directory. You want to make sure this worked before destroying anything. When you reboot, the new filesystem will be mounted onto the new /opt directory (in this example). If you run into problems, you can simply change the directory names back to the way they were and then reboot.

You could also simply reboot with out renamed the original /opt directory. This will mount the new filesystem over the top of the original directory. The files will still be intact, but they won’t be accessible.