Next Previous Contents

2. Basic method

The chapter describes the basic method for installing a new diskimage on a NetWinder. The methods described in the other chapters are variations on the basic method, so this chapter makes for good background reading even if you are using one of the other methods. See the first chapter for an overview of the different installation methods.

2.1 Requirements

This is the simplest method but requires considerable hard drive space - enough to hold the compressed disk image (about 250 MB for build #12) as well as the uncompressed image (about 650 MB). Add to this the space occupied by the existing disk image, and you'll see that this method is practical only on machines with hard disks of 2 GB or more capacity.

A new disk image is also required, of course. It can be downloaded (via FTP) from netwinder.org as a tar.gz archive. Alternatively you might have received the image on CDROM or other media; you should transfer the image onto the NetWinder by some means - FTP, NFS, SMB, HTTP - keep in mind that the image is a binary file.

2.2 Preparation

Some manipulation may be required to free up space on the partition where the new image is to be installed. While it is not strictly necessary for the partition to be empty, subtle problems can arise if old files are mixed with the new image. We recommend clearing the partition completely to avoid trouble. See also section 4.3 for more information on how to free up a partition.

The df command will allow you to check disk usage. Typical output from this command is shown below. Don't be alarmed if the values reported by your system differ.

        Filesystem         1024-blocks  Used Available Capacity Mounted on
        /dev/hda1            1014784  645694   316651     67%   /
        /dev/hda3            2792760   72888  2575451      3%   /home

Here we see that the third partition /dev/hda3 contains only 72 MB of data, whereas there remain 316 MB of free space on the first partition /dev/hda1. If we moved the data from the third partition into the first, then /dev/hda3 would be empty and we could install the new diskimage there. Since unix doesn't allow files to be moved across filesystems, we first copy the data from /dev/hda3 and later delete it. You must be root to run these commands of course.

        cd /
        umount /dev/hda3
        mount /dev/hda3 /mnt/hda3
        cp -ax /mnt/hda3/. /home
        umount /dev/hda3

The data has now been copied to the /home directory, which is now on /dev/hda1. To prevent side effects, you should also edit the /etc/fstab file and comment out the line beginning with /dev/hda3, or delete the entire line. Otherwise, your system may have difficulty trying to mount /dev/hda3 next time you reboot.

The free partition can now be cleared out, either by formatting it or by deleting all the files (rm -rf). Again this isn't strictly necessary but it is recommended. Be sure you give the right partition number otherwise you'll end up formatting the wrong partition. The commands for formatting the third partition, and then mounting it on /mnt/hda3, are as follows.

        mke2fs /dev/hda3
        mount /dev/hda3 /mnt/hda3

Now you're ready to install the new disk image onto /mnt/hda3. You can use the df command to verify the amount of free space if you wish.

Special note: If you are running dm-3.1-15 disk image, then you must pass extra flags to mke2fs otherwise the firmware and kernel won't recognize your filesystem correctly. To format a partition you should use these commands

        mke2fs -O sparse_super /dev/hda3

2.3 Image installation

To install the image, use the tar command to extract files from the compressed image. If you have not yet downloaded the image, do so now (placing it wherever there is enough room). Then use the following commands to expand the archive. The example assumes that your "empty" partition has been mounted on /mnt/hda3 (as in the previous section):

        cd /mnt/hda3
        tar zxpf YourImage.tar.gz

Replace YourImage with the name of the image you downloaded (including the full path, if it's not located in the current directory). This process will take 5 to 10 minutes, on average.

2.4 Updating etc/fstab

The etc/fstab file will need to be edited before the new image can be booted. Using your favourite text editor, open the file /mnt/hda3/etc/fstab. The line that begins with /dev/hda3 should be deleted or commented out. The line that begins with /dev/hda1 should then be changed so that it begins with /dev/hda3 (or whichever partition you've just installed to). Save the modified file and exit the editor. Then unmount the partition in anticipation of rebooting:

        sync
        cd /
        umount /mnt/hda3

While it should not be necessary with official disk images, you might want to check that the file etc/mtab does not exist in your image (before you unmount it). Delete this file if it does exist (for example, rm /mnt/hda3/etc/mtab).

2.5 Firmware settings

The last step is to change the firmware settings so as to boot from the new partition. Reboot the machine (using CTRL-ALT-DEL for example) and then upon reboot, at the `Press any key to abort autoboot' prompt, press a key. Enter the following commands to switch over to /dev/hda3:

        load-defaults
        setenv kerndev /dev/hda3
        setenv rootdev /dev/hda3
        save-all
        boot

The save-all command may be omitted if you just want to test boot the new image (you can re-issue it later on). See the Firmware-HOWTO at http://www.netwinder.org/~ralphs/howto/Firmware-HOWTO.html for more information.

The new disk image should now boot. If not, consult the Troubleshooting chapter at the end of this manual. To access your old disk image (perhaps to copy out some personal files, for example) you can mount it with a command like:

        mount /dev/hda1 /mnt


Next Previous Contents