On Thu, 1 Oct 1998, Jim Peters wrote:
> Hi,
>
> I have many dual pentium pro machines running Linux 2.0.x with SMP
> support enabled and cannot get any of them to use swap space. A sample
> machine configuration follows:
>
> Dual Intel Pentium Pro 200's
> 512M
> Adaptec 2940UW
> Matrox Video (I believe, nothing fancy..could be hardware conflict?)
> 2 Intel Etherexpress 100 network cards
> Linux 2.0.33
Hmm, never heard of swap not working before. Are you sure you are
invoking it correctly? Try the script below. Note that with multiple
SCSI disks, swap will be a bit more efficient if the swapfiles are on
different disks instead of all in one partition. Using swapfiles
instead of swap partitions conserves partitions -- since you need at
least four swap spaces to swap a full 512 MB (linux has a 128 MB limit
per) you would need to break up a single disk into 5+ partitions,
which is a pain.
rgb
Robert G. Brown http://www.phy.duke.edu/~rgb/
Duke University Dept. of Physics, Box 90305
Durham, N.C. 27708-0305
Phone: 1-919-660-2567 Fax: 919-660-2525 email:[EMAIL PROTECTED]
#!/bin/sh
#
# To make four swapfiles in the /swap partition for 512 MB total:
#
# Make an ext2 swap partition BIGGER than 512M (maybe 544 MB).
# Set SWAPDEV to the name of this partition (I assume /dev/sda2)
# Run this script. Run "swapon /swap/swap1", "swapon /swap/swap2"...,
# and then use the "free" command or "cat /proc/meminfo" to make
# sure it works. Then you need to put
# hopefully obvious lines in /etc/fstab to mount /dev/sda2. The
# script itself will try to add lines to /etc/rc.d/rc.local if it
# exists to start swapping at boot time. They should go SOMEWHERE if
# not in rc.local.
SWAPDEV=/dev/sda2
echo "Making four swapfiles in the /swap partition"
# /swap should already exist and not be mounted on diskless systems.
mount $SWAPDEV /swap
if [ ! $? = 0 ]; then
cat << END
Could not mount $SWAPDEV on /swap!
Clean up and try again.
END
exit
fi
for SWAP in swap1 swap2 swap3 swap4
do
echo "Making /swap/$SWAP"
dd if=/dev/zero of=/swap/$SWAP bs=1024 count=130752
mkswap -c /swap/$SWAP 130752
if [ ! $? = 0 ]; then
cat << END
mkswap -c /swap/$SWAP 130752 failed.
Clean up and try again.
END
exit
fi
sync
done
# Add swapfile startup to /etc/rc.d/rc.local
echo "Fix /etc/rc.d/rc.local so it starts swapping on new swapfiles."
cat >> /mnt/etc/rc.d/rc.local << EOT
# Start to swap on all swapfiles in /swap
for SWAP in "/swap/swap*"
do
swapon \$SWAP
done
EOT