Adding Swap Space even if you forget to assign the swap partition

I was setting up the redhat cluster. When everything is finished. BAM! I found I forgot the swap partition in the kickstart script. everytime my application take more memory the system hang...

What to do now?

One great thing about linux is flexibility.

You can create a file word as swap space!
do it as follows:

You can create a file of a specified size to use as a swap file. In our example here we will use a 64MB file called /usr/swap0. You can use any name you want, of course.

Example 11-1. Creating a Swapfile on FreeBSD

  1. Be certain that your kernel configuration includes the memory disk driver (md(4)). It is default in GENERIC kernel.

    device   md   # Memory "disks"
  2. Create a swapfile (/usr/swap0):

    # dd if=/dev/zero of=/usr/swap0 bs=1024k count=64
  3. Set proper permissions on (/usr/swap0):

    # chmod 0600 /usr/swap0
  4. Enable the swap file in /etc/rc.conf:

    swapfile="/usr/swap0"   # Set to name of swapfile if aux swapfile desired.
  5. Reboot the machine or to enable the swap file immediately, type:

    # mdconfig -a -t vnode -f /usr/swap0 -u 0 && swapon /dev/md0


Comments

Popular posts from this blog

周末发现的两样东西,和心理有关的。

QStringList related performance