Summary: Quick plug in swap space? PART 1 of 4

From: Daniel_V._D'
Date: Mon Jul 17 1995 - 11:33:41 CDT

Howdy all!

When will all this slow down????? I owe 5 summaries already!!

Back here at Userland, Our trusty Vermont Developer ( he is from vermont,
not using vermont software ) unleashed a heathen bug ridden program called d.c
( fourth version of the code, and following in house naming conventions ).
This ate a 126 Meg swap space on CrazySteve, a sparc20. ls returns the phrase
-- "not enough memory to run". User returns the phrase "Help me". I leap into

Whipping out my trusty manual, I turn to the page discussing swap. Brushing
aside a set of postitnotes refering to other folks spouses, I find a short
blurb on how to increase swap on a server - back it up and re run sun install.
Woe infests the pages of this historians writings!!

But wait! Can it Be??? YES!!!! YYEESS!!!!! 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 file!!!!!!

Is there a way of doing this on Crazy Steve, who is not a diskless
workstation? Is there a happy ending to this tale of woe, pain and foiled
pasta bombings? is there another way to add swap that does not involve tapes
and formats? Is there hope for human Civilization?? Why does this sound like
something from the Deskpad Devo collectio???

Tune in for the summary!!!!!!

"Fun with Fertilzer will never make it as network show" -dan

From: Tim Hoffman <>
Its all in the manual

mkfile 120M /export/HUGE_BIG_SWAP_FILE or any other partition where it will fit.
swap -a /export/HUGE_BIG_FILE

Can't remember if the swap command has the same syntax on Solaris 1.x
but then who uses it ;-)

Remember to put an entry in your fstab/vfstab if you want the
swap file to be used past a reboot
From: (Jerry Weber CIC-2)
These are run on a Solaris 2.3 system.....
# mkfile 128m SWAP
To make the swap file available:
# swap -a /export/home/Ingres2/SWAP
To list swap files in use:
# swap -l
swapfile dev swaplo blocks free
/dev/dsk/c0t3d0s1 32,25 8 131752 54288
/export/home/disk/SWAP - 8 262136 262136
To see what swap space is available:
# swap -s
total: 40688k bytes allocated + 14232k reserved = 54920k used, 156292k available

If this works out, you can add /export/home/disk/SWAP to vfstab.
From: (Bruce R Baier)
Good Sir:

In reply to your query about increasing swap space,
it *should* be relatively painless to add swap. In
SunOS 4.1.x, add a swap line to /etc/fstab, like

/release/swap/ike swap swap noauto,rw 0 0
(for a swapfile made with mkfile(8))
/dev/sd0a swap swap noauto,rw 0 0
(for a raw partition)

Then type:
swapon -a
to activate all the swap space in /etc/fstab.

This can be easily done on-the-fly. We've used it successfully on
a standalone Sun 630MP with no diskless clients.

If you have Solaris 2.x you can make a swapfile:
mkfile XXm /foobar/swapfile

add it with
swap -a /foobar/swapfile

then verify it with
swap -l

then add an entry to /etc/vfstab like
/foobar/swapfile - - swap - no -

to have it loaded automatically at boot time.

To remove swapfiles, use
swap -d /foobar/swapfile
and remove the entry from /etc/vfstab.

Good luck. Hope this info can be of some help.

Pasta in hand, I await a summary.
From: (Jeff Greer)
Do a man on "mkfile" and "swapon". Use mkfile to make either a local or NFS
mounted swapfile then use swapon to make it active.

This swapfile can be added to /etc/fstab and mounted at boot time or it can
be manually mounted.
From: (Sean Ward)
SunOS -
Run mkfile(8) to create a file of the appropriate size. "mkfile 20m foo" will
create a file named foo which is ~20MB in size.
Use swapon(8) followed by the filename to add your newly created file as a
swap area.

Solaris -
Run mkfile(1M) as above.
Use swap(1M) with the -a option to add the filename.
From: (Pamela S. Pledger)
Yep, I do it all the time. A swap file is
slower than a swap partition, but faster than none.
        Just read the man page ..........
        It goes something like this :
1) Make the swap file specifying the size, i.e. for 16mb :
        mkfile 16m /bigdisk/extraswap
2) Add it to the (v)fstab file, for sunos it would be :
/bigdisk/extraswap swap swap rw 1 3
        for solaris it would be something like :
/bigdisk/extraswap - - swap - no -
3) Then add it. On sunos this is just "swapon -a ", on solaris
        this is "swap -a /bigdisk/extraswap1".

        If you are going to mount it via nfs, there are extra steps :
        SunOS :
0) On the server, make the file and export/share it :
        SunOS :
        mkfile 16m /export/swap/crazysteve
        add the following to /etc/exports
        /export/swap/crazysteve -access=crazysteve,root=crazysteve
        run "exportfs -a"
1) On crazysteve, Add the following to /etc/fstab :
server:/export/swap/crazysteve /extraswap swap rw 0 0

        Solaris :
0) On the server :
        mkfile 16m /export/swap/crazysteve
        add the following to /etc/dfs/sharetab
        share -f nfs -o rw=crazysteve,root=crazysteve /export/swap/crazysteve
        run "shareall"
1) On CrazySteve, Add the following to the /etc/vfstab
server:/export/swap/crazysteve - /extraswap nfs ---
/extraswap - - swap - no -
Check out the man page for swap
From: (Ray Trzaska)
quick swap space - say 100Meg on a file system near you ---

mkfile -v 100m /a/filesystem/near/you/swapname
/usr/sbin/swap -a /a/filesystem/near/you/swapname
From: Todd Michael Kennedy <>
Whoa!! I don't think I've _ever_ heard of having to back up and reinstall
just to increase swap space. I know Sun is pretty bad when it comes to
handing out information, but, I can't believe they'd give such blatent

Here's how I've added swap space on both Solaris2.4 and Sunos4.1.3...

There are two ways you can add swap space. First, if you have a free
partition on CrazySteve, that would be the best way to add extra swap.
(Also a lot faster)

For Solaris, the command is:

        swap -a /dev/dsk/[disk]

On SunOS, you use:

        swapon /dev/[disk]

Now, if you want to create a swapfile over NFS, you will need to use
`mkfile` to create an empty file. Then, use the `swap` or `swapon` commands,
but, replace the "/dev/blah/blahblah" part with the filename that you just

In both cases, the swap space will be gone once the machine reboots. (In the
later instance, you will be left with an unused, multi-megabyte file) So,
to make things more permanant, you might want to add the file or partition
to your (v)fstab...

Hope this helps. You definitely do _not_ need to reinstall the OS in order
to increase swap space. You don't even need to reboot.

Best regards,
Todd Kennedy
CSL Administrator

P.S. To make sure everything is working, you can check on the amount of swap
space that is free. For SunOS, it's `pstat -s` and on Solaris it's either
`swap -l` or `swap -s`.

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