Linux Know-How provides a collection of introductory texts on often needed Linux skills.

Upgrading Linux

For a full system upgrade (updated distribution CDs, .e.g., RH7.0->RH7.2), "follow the time-honoured principle of upgrading Unix systems: do a fresh, 'clean' install and add back your data. Yes, we're talking about reformatting your partitions and installing from scratch." (the quote from:

Thoughtful partitioning of your hard drive will facilitate future upgrades, because your data files can be preserved in your "home" directory.

A checklist I made for myself when upgrading:

  • Log in as root.

  • Make a copy of the /etc directory to some place where it won't be distroyed (e.g., zipdrive). This will let me have a look at your previous setup in case I encounter problems.

  • Make a backup of any valuable data in the /home directory. This is just in case something went really wrong, for example, if I happened to format a wrong partition.

  • Determine and write down the mountpoints on your file system using the "diskfree" command by typing df. For example, on my system it shows that the /home my home directory is mounted on a separate hard drive partition called /dev/hda9. and the directory /usr/local is on /dev/hda8. I write this info on a back of an old envelope.

  • Perform the installatation of Linux, but tell the installer to mount the partitions /home and /usr/local at their previous (existing) locations. DO NOT re-format these two partitions. This is critical if you want to preserve your data.

  • Boot the new installation and check that it works.

  • For each user on the system, create a login with the old name and old user ID number, for example,

ls /home/maria/* -l (check the user ID for account "maria" in the file listing of her home directory),

useradd maria -u 503 (create a user acount "maria" with with an example uid "503").

The users will have to select new passwords. If I had lots of users, instead of re-creation of all the accounts I would edit the old and new versions of three files: /etc/passwd, /etc/shadow and /etc/group and copy-paste the relevant user information from the old files to their newer versions (one lines per user in each of the two files, one line per group in the third file).

  • From each user home directory, delete the potentialy troublesome setup files, e.g.: ".kde", ".ICE*", etc. Good oportunity to delete any junk too. Some setup files may be troublesome because the new version of kde is likely to perform better with the most recent default settings (it will create them on first startup). E.g.,

cd /home/maria

rm -fr .kde

  • Make sure that each remaining file in the home directories belongs to the appropriate user. For example, I do:

cd /home/maria

chown -R maria *

chgrp -R maria *

Last Update: 2010-12-16