jump to navigation

Howto: Adding Swap file in Linux February 10, 2009

Posted by hasnain110 in Linux.
trackback

To add a swap file:

  1. Determine the size of the new swap file and multiple by 1024 to determine the block size. For example, the block size of a 64 MB swap file is 65536.
  2. At a shell prompt as root, type the following command with count being equal to the desired block size:
    dd if=/dev/zero of=/swapfile bs=1024 count=65536
    
  3. Setup the swap file with the command:
    mkswap /swapfile
  4. To enable the swap file immediately but not automatically at boot time:
    swapon /swapfile
  5. To enable it at boot time, edit /etc/fstab to include:
    /swapfile               swap                    swap    defaults        0 0

    The next time the system boots, it will enable the new swap file.

  6. After adding the new swap file and enabling it, make sure it is enabled by viewing the output of the command cat /proc/swaps or free.
Advertisements

Comments»

1. Breves « Ubuntu Life - February 11, 2009

[…] eLive en version especial con Compiz Publicidad en tus feeds Barra de progreso mediante Ajax Añadiendo el fichero de swap a Linux Instalando […]

2. BlogUbuntu.com - February 11, 2009

Good tip. Thanks.

3. hasnain110 - February 11, 2009

Welcome 🙂

4. Allied Schools - October 4, 2014

Hi there! I realize this is kind of off-topic however I had to ask.
Does operating a well-established website like yours take a lot of work?
I’m brand new to operating a blog however I do write in my journal daily.
I’d like to start a blog so I can share my own experience and thoughts online.
Please let me know if you have any kind of recommendations or tips for new aspiring blog owners.

Thankyou!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: