Linuxtipstricks – Just another /linux/blog

May 2, 2009

How to use a swap file to increase temporarily your swap memory

Filed under: user tipstricks — Antonio Portuesi @ 11:04 pm
Tags: , , , , ,

Sometimes, it can be very useful to increase the available swap memory using a file, so we could have a memory boost in a snap without prepare a dedicated swap partition.
Let’s do it!

The following line would create a swapfile of 4 gigabytes using a blocksize of a megabyte (1048576).
user@pc:~$ dd if=/dev/zero of=/swapfile bs=4194304 count=1000

Then make the file as a swapfile
user@pc:~$ mkswp /swapfile

Now we have to activate the swapfile…
user@pc:~$ swapon /swapfile

…and verify that the same has been activated.
user@pc:~$ swapon -s

That’s all!

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

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

Blog at WordPress.com.

%d bloggers like this: