Sun Studio 12 Update 1 Installation Guide

Appendix B Adding Swap Space

Adding Swap Space

If the system on which you are installing the software does not have the required minimum 1 GB of swap space, add swap space by doing the following.

ProcedureAdding Swap Space on a Solaris System

  1. Become a superuser (root) by typing:


    % su
    Password: root-password
    
  2. Create a file in a selected directory to add swap space by typing:


    mkfile number[m|k|b] /directory/swap-file-name
    

    where number is an amount of swap space, followed by either m for megabyte, k for kilobyte, or b for block. The directory is a directory in which you have permission to add swap space. The swap-file-nameis the name of the swap file you are creating.

    For example, to create a 16-megabyte swap file named 16mswapin the foodirectory, type the following:


    mkfile 16m /foo/16mswap
    

    See the mkfile(1M) man page for more information.

  3. Verify that the file was created by typing:


    ls -l /directory/swap-file-name
    

    The new file appears in the directory. For example:


    ls -l /foo/16mswap
    -rw------T   1 root     other    16777216 Dec 12 14:24 /foo/16mswap
  4. Run the swap command to specify the additional swap space by typing:


    swap -a /directory/swap-file-name
    
  5. Verify that the extra swap space was added by typing:


    swap -s
    

    The output shows the allocated swap space. For example:


    swap -s
    total: 289336k bytes allocated + 27008k reserved = 316344k used, 298336k available

ProcedureAdding Swap Space on a Linux System

  1. Become a superuser (root) by typing:


    % su
    Password: root-password
    
  2. Create a file in a selected directory to add swap space by typing:


    dd if=/dev/zero of=/dir/myswapfile bs=1024 count=number_blocks_needed
    

    where dir is a directory in which you have permission to add swap space. The myswapfile is the name of the swap file you are creating. The number_blocks_needed is an amount of 1024-byte blocks you want to create. See the dd(1) man page for more information.

  3. Verify that the file was created by typing:


    ls -l /dir/myswapfile
    

    The new file appears in the directory.

  4. Initialize the new swap area by typing:


    mkswap /dir/myswapfile
    

    See the mkswap(8) man page for more detailed information.

  5. Run the swapon command to enable the new swap space for paging and swapping by typing the following:


    swapon -a /dir/myswapfile
    
  6. Verify that the extra swap space was added by typing:


    swapon -s
    

    The output shows the allocated swap space.