Next Previous Contents

3. Rescue partition installation

This chapter explains how to install and use the `rescue paritition' software package. NetWinder OfficeServer and DM models shipped after October 1999 include this software package by default; older systems need to be retrofitted (or sent back for upgrade) in order to make use of the new package.

3.1 Do I already have it?

If you've received your machine after October 1999, then you should already have the rescue package installed on your system. To be sure, there are two things to check. As root, run the command fdisk -l /dev/hda. This will list the current partition table, which should look something like this:

           Device Boot    Start      End   Blocks   Id  System
        /dev/hda1             1     3895  1963048+  83  Linux native
        /dev/hda2          3896     4026    66024   82  Linux swap
        /dev/hda3          4027     7921  1963080   83  Linux native
        /dev/hda4          7922     7944    11592   83  Linux native

The rescue partition is /dev/hda4, and it's just a bit over 11 Megs in size. This is a pretty sure sign that you have the image, or at least, you have the space for the rescue image. To verify that the data is actually there, you need to mount the partition (temporarily):

        mount /dev/hda4 /mnt
        cd /mnt
        ls

If the mount command fails with `You must specify the filesystem type' then /dev/hda4 probably is not formatted and therefore does not contain the rescue image. Otherwise, you should see a fairly standard directory structure listed:

        bin   dev  lib         mnt   sbin  usr
        boot  etc  lost+found  proc  tmp   var

If you see these directories, then you're all set. Note that from time to time, the rescue package will be updated, so it's a good idea to periodically install a newer version anyways. There currently isn't a way to find out which version of the rescue package you have installed, but in the future, we'll include a README file in the root directory (shown above) that will tell you which version you are looking at.

3.2 Installing the image

The following steps explain how to install the rescue image onto your system (or how to upgrade to a newer rescue image; it's the same proceedure). I'm assuming that you do actually have a /dev/hda4 partition of at least 10 Megs. See below for advice if you do not have this partition.

To install or update the rescue image on /dev/hda4, follow these steps:

  1. Download the latest rescue image by anonymous FTP from ftp://ftp.netwinder.org/pub/netwinder/images/. The filename is rescue.tar.gz or there may be a newer version.
  2. Log in as root or use the su - command to become root.
  3. If you had previously mounted the partition, unmount it with the command umount /dev/hda4.
  4. Format the hda4 partition, then mount it on /mnt:
            mke2fs  /dev/hda4
            mount /dev/hda4 /mnt
    
  5. Change directory to the mount point, and untar the rescue image.
            cd /mnt
            tar zxvpf /root/rescue.tar.gz
    

You will of course need to adjust the pathname on the tar command to reflect the location where you downloaded the rescue image.

3.3 If you don't have /dev/hda4

If you have an older system where the disk is already fully allocated to partitions 1 through 3, then it's a bit difficult to install the rescue system. I would recommend using one of the other rescue methods, which are described in the Disk-Update-HOWTO.html. Instead of installing the full disk image, though, you can repartition the drive and install the rescue package only. Then the rescue package can be used to reinstall everything else.

Another option is to try and merge two partitions together. If there is enough space free, then you can copy e.g. /dev/hda3 over to /dev/hda1, and then can safely split 10MB or so off from /dev/hda3 to be used as the rescue partition. Sadly, there is no way to resize an ext2 partition without erasing the data on it. (There is fips, but that only works for DOS partitions).

Supposing you want to try this, then the first thing to do would be to run df to check how much disk space is available. It should look roughly like so:

        Filesystem   1k-blocks      Used Available Use% Mounted on
        /dev/hda1      1477028    301819   1098880  22% /
        /dev/hda3      1521792   1151033    292110  80% /usr

In this case, there are about 1.15 Gig on hda3 and only 1.09 Gig of space remaining on hda1, so it won't fit on hda1. It could be copied the other way (making hda3 the root filesystem) but in that case you'd need to carefully adjust /etc/fstab to reflect that fact that the root filesystem is then on /dev/hda3, and remember to delete /etc/mtab before shutting down.

To copy the data between the partitions, you would use the following series of commands. Note that in my case, /dev/hda3 was mounted as /usr (as indicated in the output from df above). On the older systems, it was mounted on /home instead. If that is the case for you, then substitute home for usr below.

        umount /dev/hda3
        mount /dev/hda3 /mnt
        cp -avx /mnt /usr
        umount /dev/hda3

Now you have to edit /etc/fstab and comment out (with the # character) the line that begins with /dev/hda3 (You don't have to do this if you plan to move everything right back again, after having re-partitioned. Just don't reboot in the meantime).

You can then safely split /dev/hda3 into two smaller pieces, using fdisk /dev/hda. First delete the entry for partition 3, then create a new primary partition 3. When prompted for the size, put in 10 MB less than you have left. You can either do the math (total cylinders divided by the total drive size times 10 MB) or just fiddle by trial and error.

Then create a 4th primary partition with the remaining 10 MB of space. Save the partition table, and format both partitions. You might also want to copy the stuff from back over from /dev/hda1:

        mke2fs /dev/hda3
        mke2fs /dev/hda4
        # Now copy back /usr back from /dev/hda1 if desired:
        mount /dev/hda3 /mnt
        cp -avx /usr /mnt
        umount /mnt
        rm -rf /usr/.           # Careful with this !!
        mount /dev/hda3 /usr

Don't forget to restore the /etc/fstab file if you changed it. Then you can install the rescue image onto /dev/hda4 as described above.


Next Previous Contents