Technical article 118382

I need to increase the swap size, what are the swap limits?

OpenServer 6.0.0UnixWare 7.0.0UnixWare 7.0.1UnixWare 7.1.0UnixWare 7.1.1UnixWare 7.1.2UnixWare 7.1.3UnixWare 7.1.4Open UNIX 8

Written · Last revised

Problem

I need to increase the swap size, what are the swap limits?

Solution

The swap size at ISL time was limited to 2GB until UnixWare 7.1.4.

If you want to add more swap, you will need to edit

/etc/swaptab

and add up to 256 entries in this file.

A line in the file is defined as:

Device_name start_offset size

Device_name can be either a block device or standard file.

The Device_name must be specified by a full pathname.

size (in 512-bytes blocks) can be up to 2GB maximum.

If the Device_name is a block device, you can use a "-" meaning that
the entire size of the Device_name will be used.  Note that in this
case the size of the block device cannot exceed 2GB.

If you have specified a standard file as a swap file, you will need to create an empty file with at least the size of blocks specified in /etc/swaptab (If size was "-", make sure that the file will be created with less than 2GB size).

Use the following commands (as superuser) to create the empty file:

ulimit unlimited
dd if=/dev/null of=<<File_name>> bs=1024k oseek=<<size in MB>
swap -c
The modification made on /etc/swaptab will only be used after the
reboot of the system.  If you want to you the new added swap, use the
following command:
swap -a <<File_name>> [ [swaplow] swaplen]
WORKED EXAMPLE:

I wish to create a file to add a maximum 1GB of swap to my server:

1.  Establish how much swap is in use first:

a) Run "swap -l" or Skunkware "top" to determine the amount of free swap there currently is, eg.

From "swap -l":
path                        dev  swaplo blocks   free
/dev/swap                7679,2       0 2104512 2104512

This is in 512 blocks (ie. 2104512*0.512 / 1024) ie. 1052Mb approx.

From top:
Memory: 512M phys, 512M used, 1028M swapFree

b) To add, say, a file to potentially provide a 1GB of swap:

# dfspace
/   :  Disk space: 4160.12 MB of 6408.74 MB available (64.91%)
# mkdir /local

Use dd to create a null packed file to be used for swap:

# dd if=/dev/null of=/local/swap bs=1024 oseek=1000000
0+0 records in
0+0 records out

NOTE: For OpenServer6, use /u95/bin/dd to create a null packed file:

# /u95/bin/dd if=/dev/null of=/local/swap bs=1024 oseek=1000000
0+0 records in
0+0 records out
# l /local/swap
-rw-------    1 root  sys  1024000000 Jan 25 17:03 /local/swap
# dfspace
/   :  Disk space: 4160.12 MB of 6408.74 MB available (64.91%)

ie. the file will not consume disk space unless swap is used.

c) Add the swap:
# swap -c
# swap -a /local/swap
# swap -l
path                           dev  swaplo blocks   free
/dev/swap                   7679,2       0 2104512 2104512
/local/swap                 7679,1       0 2000000 2000000
From top:
Memory: 512M phys, 512M used, 2004M swapFree

d) To make it permanent for after a reboot:

Change /etc/swaptab from:
#swapname               offset(in blocks)    size(in  blocks)
/dev/swap               0                    -
to:
#swapname               offset(in blocks)    size(in  blocks)
/dev/swap               0                    -
/local/swap             0                    -
Then re-boot.

See also

swap(1M) and swaptab(4) manpages
http://uw714doc.xinuos.com/en/FEATS/features_714.html#713up3_4gbswap

From the Xinuos technical article database, record 118382. Reproduced with permission. The original is at www.sco.com/ta/118382, which is reachable but blocked from search engines.

Next step

Need this fixed rather than explained?

Tell us the release, what the system runs and what it is doing. We will reply by email with what we would do next.

  • You deal with the people who do the work
  • No obligation, and no upgrade required before we will help
  • We tell you plainly if something is not worth doing

Send an enquiry

We reply by email. If a server is down, say so in the first line. You can also write to help@scoexpert.com.