Modifying Swap

This section describes how to modify the swap size (in MB). It contains the following topics:

Example Procedure: Modifying Swap Size Using modifyjeos

You can modify the current swap size using modifyjeos. In the following example, the default swap size (512 MB) is modified to 1 GB:

Note:

This procedure applies to guest vServers created by using version 2.0.4.x.x (or earlier) of the Exalogic Guest Base Template. For guest vServers creating using v2.0.6.x.x of the Exalogic Guest Base Template, you can manage disks by using LVM commands, as described in Managing LVM Partitions on Guest vServers.

# modifyjeos -f System.img -S 1024

When you start the VM after modifying the swap size, it may start without any active swap. To fix this problem, complete the following steps:

  1. Verify the label by running the following command:

    # cat /etc/fstab

  2. Look for a line starting with LABEL=SWAP and make sure that it is LABEL=SWAP-VM. If not, change it by editing the /etc/fstab file.
  3. Reboot the VM. The swap should become active.

Example Procedure: Adding Swap Manually

To add swap manually (for example, 1 GB), complete the following steps:

Note:

This procedure applies to guest vServers created by using version 2.0.4.x.x (or earlier) of the Exalogic Guest Base Template. For guest vServers creating using v2.0.6.x.x of the Exalogic Guest Base Template, you can manage disks by using LVM commands, as described in Managing LVM Partitions on Guest vServers.

  1. Create a swap file as follows:

    # dd if=/dev/zero of=<path_to_swap_file> bs=1M count=1024

    This example uses a 1 GB swap. You can create a swap file of your desired size.

  2. Run the following commands:

    # mkswap <path_to_swap_file>

    # swapon <path_to_swap_file>

  3. Add an entry to the /etc/fstab file to persist the swap file in the case of reboots:
    <path_to_swap_file>     swap     swap     defaults     0 0