Summary: Quick plug in swap space? - PART 3 of 4

From: Daniel_V._D'
Date: Mon Jul 17 1995 - 11:34:30 CDT

From: Ric Anderson <>
Find a drive with adequate free space: lets assume the drive with
enough free space for the swap file is mounted on /export/home7.

        cd /export/home7
        mkdir swap
        cd swap
        mkfile crazysteve 64m
That will create a 64 megabyte swap file named crazysteve. Nothing
magic about naming the directory "swap" either. Just my personal

For SunOS 4.1.x, in /etc/fstab you can add a line
        /export/home7/swap/crazysteve swap swap rw 0 0
then issue the command
        swapon -a
and you should have an additional 64mb swap file.

For Solaris, you add a ine to /etc/vfstab that looks like
        /export/home7/swap/crazysteve - - swap - no -
and then run the command
        swap -a /export/home7/swap/crazysteve

At boot time, /usr/sbin/swapadd should find the vfstab entry
and process it.

Most of this is from memory, so approach with caution.
From: (Michael J. Shon {*Prof Services} Sun
You haven't been at this long enough.
You still leap into action instead of saying
        "so don't do that."

Make him read the man pages for 'ulimit' .
You may be able to prevent the problem from recurring while he gets
the bugs fixed.

Adding more swap will just make it take a little bit
longer before 'ls' fails again.
The program is consuming all available resources. Don't give it any more.

| in the next section, just after
|the micromap to the nearest MegaBurger ( local fast food joint ) is the ultra
|nifty plans to boost swap space on a diskless box simply by adding a
|Is there a way of doing this on Crazy Steve, who is not a diskless

Yes. Further reading should have show that this applies
to all systems.

See the man page for "mkfile" .

But don't do it. Use ulimit and make him fix it.
--------------------------------------------------------------From: (David Steiner)
Yes! Been there, done that....

Essentially the same process:

1. Make a swap file of the desired size (in our example 32MB):

    mkfile 32m /some/dir/filename

   (The Trusty Manual says to use the -n switch with mkfile but I have a
    hand-scrawled note that says not to on a standalone. Can't remember why.)

2. Add entry in /etc/fstab

    /some/dir/filename swap swap ro 0 0

3. Run swapon:

    swapon -a

   (This should be in /etc/rc to take effect on reboot)

There ya go! Works fine for us.
--------------------------------------------------------------From: John
Rosenberg <>
Yeah, find a free partition, and add something like this to your /etc/fstab
(assuming BSD UNIX):

    /dev/sd2h /swap2 swap rw 0 0

cf the man pages for fstab(5) and swapon(8).
From: Rick Niziak <>
Here's how you do it:
        # mkfile some_swap_file_name 100M
        # swapon some_swap_file_name

Thats it !!!
From: Steve Lee <>
cd /somewhere/with/disk/space

mkfile 50m swap50 # This makes a 50MB swap file named swap50

swapon /somewhere/with/disk/space/swap50 # SunOS 4.1.X

swap -a /somewhere/with/disk/space/swap50 # Solaris 2.X

Add the appropriate line in /etc/fstab or /etc/vfstab for the swap file:

/somewhere/with/disk/space - swap swap - - -

/somewhere/with/disk/space swap swap rw 0 0 (fstab)
From: (greg harrison)
        Try this on the sparc 20. Find a partition where you have the space
you would like to create a swap file. I.E. if you want a 50 Mb swap file, it
needs 50 megs free. Then do the following..

# mkfile 50m /home/auxswap (replace 50 with the desired size in
# vi /etc/fstab
        /home/auxswap swap swap rw 0 0 ( add it to the fstab file)
# swapon -a (activae the swap file)
ps. The above works well on a Sparc 20 running sunOs 4.1.x
    I have several of them with a naturaly 200 MB swap partition and then
    an extra 300MB swap file created this way. Works great.

p.p.s. A hint. Place the auxswap file and then make sure you arent backing it
       up during backups...thats a real waste. I place it directly under
        /home and then I only backup from /home/machine_name.
From: (Joe Welfeld)
                   And the answer is .. check out the unix commands:
mkfile and swapon
--------------------------------------------------------------From: (Sandeep Suryavanshi)
You missed to mention one small thing.. which version of SunOS are
you running.

Well, since I have done this countless times on Solaris 2.3, that's what
I am giving below. If you use some other SunOS, let me know, I'll see if
I can help.

Step 1. make a file of the appropriate size on the disk. (You can see
      references to this way of adding swap as Adding Filesystem Swap in
      answer books/manuals).

   # mkfile 100m /dir/filename (same for SunOS 4.x)

   Makes a file of 100Mb in <dir> directory named <filename>.

Step 2. Add entry in to /etc/vfstab file (/etc/fstab on SunOS 4.x)

/dir/filename - - swap - no -

Step 3. Add this file as filesystem swap in the config.

  # swap -a /dir/filename

    Adds 100Mb of swap to your machine.

Step 4. Confirm that swap is added.
  # swap -s
        Summary listing of swap.

  # swap -l
        Long listing giving each swap componant. Your swap should now
        show 2 componants. First, as /dev/dsk/... and second as

From: Ross Leask <>

man swap
man mkfile

Just create yourself a big file (mkfile should do the job), and use
"% swap -a bigfile"

probably best that "bigfile" is on a local file system (swapping over a network
might be a tad ugly).
--------------------------------------------------------------From: Gregory
Bond <>

Yup, will work on any machine:
        mkfile 32m /big/partition/swap
        swapon /big/partition/swap
--------------------------------------------------------------From: (Niall O Broin x 3619)
swapon -a filename
where filename is a file that you've previously created on a local disk with
Further info, man swapon and man mkfile

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:10:29 CDT