Mark Whitis's Website Home Page Linux Book: Linux Programming Unleashed My Resume Genealogical Data Contact Info Security About

[HOME(Mark Whitis)] [Contact] [Resume] [Browser Friendly] [No Spam] [FEL] [DBD]

Application note: Moving /usr under redhat linux

This application note details how to install/upgrade RedHat Linux with /usr as a symlink to a directory in another partition.

I have some otheroriginal linux pages, as well.

Typical Configuration

Sample system configuration: With the following links:
   /usr         --> /disk0/usr
   /var         --> /disk0/var
   /tmp         --> /disk0/var/tmp
   /local       --> /disk0/local
   /usr/local   --> /disk0/local
   /home/user1  --> /disk0/home/user1
   /home/user2  --> /disk0/home/user2
   /home/user3  --> /disk0/home/user3
   etc.

Installation

Under 3.3 (if I recall correctly), this was done by simply creating a sybolic link at the right time during the install process in a shell on another console. In subsequent versions, however, one does not necessarily have the ability to interject commands between file system creation and mounting and the rest of the install.

Under Redhat 4.0, install normally but name your big disk partition /usr and then after the install is complete, boot single user and move /usr to /disk0/usr using the script movestuff which must be run in single user mode.

Note that moving /usr on a running system is somewhat dangerous since you are moving some of the tools which the system needs to operate and it needs to operate while moving those tools. I have used this script successfully on many systems. If you type the commands by hand, however, be warned that a single typo can lead to much chaos. The script expects you to confirm each line by pressing return.

Note that the movestuff script creates a couple symbolic links:

   /disk0/etc  --> /etc
   /disk0/etc  --> /bin
These links are workarounds for all the buggy RedHat packages which inappropriately use relative symbolic links over too large a distance. You should not use relative symbolic links which cross the traditional mount points (or even outside a single packages directory tree) as there is a high probability of failure if any directory is moved or happens to be imported from an NFS server. The relative link trick is sometimes used on NFS systems to force a path to be evaluated relative to the filesystem on the server and not the client but what sane person would want that to happen for, in particular, /etc?

Package Upgrades

Package upgrades with "rpm -U" normally work as well as on any other configuration.

Major Upgrade

There have been some significant problems in version 4.1 and 5.0 (which may affect other versions as well) which affect the ability of the upgrade program from working correctly in this environment. I have reported this bug to RedHat. I have developed a work around, which is illustrated below in the form of a sample upgrade.

Sample upgrade

This was initially tested on a system with a JAZ drive and an Adaptec 2940au controller (this controller is incompatible with the normal 2940 which caused install problems on redhat 4.x systems). It had two partitions (not counting swap): a small root ("/") and large "/disk0" with virtually everything.

In real life, performing a major upgrade can be very dangerous. It might go smoothly but if anything goes wrong it can go very wrong. You should have multiple backups (preferrably using more than one backup program) before proceeding with an upgrade; you should expect that your primary copy (hard disk) may effectively be destroyed. Some of the disasters which may occur include symbolic link confusion, and disk full errors. Be sure to check the root partition and the partition which contains /usr to make sure they have enough space for an upgrade. /usr will probably grow by a couple hundred megabytes for a 4.0 to 5.0 upgrade. The root partition may be used for some temporary files, and may grow some due to rpmsaves, new kernels, new /etc files, new files in /bin, /lib, etc.etc. After the sample upgrade, I had 20573 kilobytes used and 27MB free (it may have required somewhat more space during the transition); I don't remember what it started at, so these numbers may not be terribly useful.

This upgrade was from RedHat 4.0 (full install) to RedHat 5.0 (full install except howto-translations). The system was a virgin install except that two scripts had been run( movestuff and services) to reorganize the filesystem as described in this document and disable any unwanted services. (Note that this is an old version of the services script. I have a newer one for RedHat 5.0 systems).

This file is maintained by Mark Whitis (whitis@freelabs.com).

Senior Engineer for hire
Software Development - Electronic Design - Embedded Systems - Device Drivers - System/Network Administration and Security - Motor Control, RobotCNC - Linux/Un*x - 25+ years experience
The author of these pages is looking for a new gig.
[RESUME]

Engineers and electronic hobbyists: The new Open Symbol Project is creating open schematic symbols and PCB footprints for a variety of different CAD packages.

Mark Whitis's Website Home Page Linux Book: Linux Programming Unleashed My Resume Genealogical Data Contact Info Security About

All email messages received must pass the turing test or they will be considered SPAM. If it could have been written by a machine, it was.

Under no circumstances are you to email me with questions regarding windoze, any other microsoft operating system or application, or any software which runs under any form of windoze.

*