🔔 🔔 🔔 Duyuru: 24. Yılımıza özel indirimler sizleri bekliyor ! Kampanya Kodu : TDATA2024 | Detaylı bilgi için tıklayınız.

How to increase Swap Size


How to increase Swap Size


Linux uses Swap Space to back its physical memory with an overflow area. In most cases the suggested amount is a disk space equal to the amount of physical memory you have installed. You don’t want your system to ever run out of RAM+swap, but you usually would rather have enough RAM in the system. So twice the size of RAM doesn’t need to swap.

The free -m command shows that the swap memory in your current server.

We can increase 4GB of swap size now.

Create Swap file

touch /swapfile

Use the following command to create 4GB of swap file.

# dd if=/dev/zero of=/swapfile bs=1M count=4096

if=/dev/zero : Read from /dev/zero file. /dev/zero is a special file in that provides as many null characters to build storage file called /swapfile.
of=/swapfile1 : Read from /dev/zero write stoage file to /swapfile.
bs=1M : Read and write 1M at a time.
count=4096 : Copy only 4096 input blocks.
This will create a new partition with 4GB space. To make it a swap partition you need to execute the following command.

# mkswap /swapfile

Now the swap file is created.

activate /swapfile file swap space now.

# swapon /swapfile

Add entry on /etc/fstab file to activate after Linux system reboot.

# vi /etc/fstab

/swapfile swap    swap    defaults        0 0

save and close the file.

Now check your swap space now.

# free -m

In order to delete swap.

Run “swapoff /swapfile” command

Remove the entry from /etc/fstab file

Remove /swapfile  file (using rm command)

Bu cevap yeterince yardımcı oldu mu?

Diğer Dökümanlar


  • cPanel security settings checklist

    You always use cpanel recommended Security Settings to avoid hacking and other suspicious activity. These  cPanel Server Hardening & Security tips will help prevent from hacking. cPanel...

  • sendmail Not running with correct effective GID

    Wed Sep 04 04:11:11 2014] [error] [client 11.44.33.22] sendmail: Not running with correct effective GID.  Is sendmail binary setgid mailtrap?, It may be the problem with your sendmail binary...

  • How to enable NAT behind the cpanel ?

    Most of webhosting providers currently used NAT service for their users. When you install cPanel & WHM, the installer will detect whether your server is on a NAT-configured network. If the...

  • Unable to allocate memory for pool

    Warning: Unknown: Unable to allocate memory for pool. in Unknown on line 0 APC or Alternative PHP Cache (APC) is a free and open opcode cache for PHP. APC allows for caching of opcode generated...

  • Install FFmpeg, Mplayer, Mencoder, MP4Box, Flvtool2

    You can use the following tutorial to install ffmpeg and other video modules in your centos server. FFmpeg is an audio/video conversion tool. It includes libavcodec, the leading open source codec...