ChorusOS 5.0 System Administrator's Guide

Creating and Activating a Swap Partition

The following example sets up a swap partition on a local IDE disk. This example builds on "Activating a Swap Partition". It is assumed that you have already successfully completed "Creating a File System on a Target System Hard Disk" and that your system is properly configured to support UFS file systems on the hard disk. It is also assumed that no valuable data has been written to the disk. If you have important data on the hard disk, you must back it up before trying this example.

Before you can activate swap on the disk, you must configure the system image to support the virtual memory. Following "Creating a File System on a Target System Hard Disk", you can do so as follows:


$ cd build_dir
$ configurator -c conf/ChorusOS.xml -set ON_DEMAND_PAGING=true
$ configurator -c conf/ChorusOS.xml -set VIRTUAL_ADDRESS_SPACE=true
$ configurator -c conf/ChorusOS.xml -set FS_MAPPER=true
$ make chorus
$ cp chorus.bmon /tftpboot
$ rsh target reboot

For the purposes of this example, it is assumed that the hard disk is bare and that you need to start by labeling the disk. In order to label the disk, you must first create an appropriate entry in disktab(4CC). The following example disktab fragment can be used with an ST34311A IDE disk to create two partitions, one small swap partition and one large partition to house a UFS file system:

ST34311A_S:\
        :dt=ST506:ty=fixed:se#512:nt#15:ns#63:nc#8944:sf \
        :pa#60480:oa#0:ta=swap: \
        :pb#8391600:ob#60480:tb=4.4LFS: \
        :pc#8452080:oc#0:tc=unused:

Once the disktab file contains the entry describing the disk geometry, you can proceed to label the disk. For example:


$ rsh target  disklabel -w -r hd0 ST34311A_S

After the disk is labelled, create a mount point for the swap partition, mount the partition as type swap and activate it:


$ cd target_root_dir
$ mkdir swap
$ rsh target mount -t swap /dev/hd0a /swap
$ rsh target swapon /swap

The swap partition is now active.