Emergency Swapfile: when your memory fills up

FAIL (the browser should render some flash content, not this).

How to make a swapfile when you run out of memory.

Download in .ogv format

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Linux can handle more than 1 swap space

mogwai's picture

See here about multiple swap spaces and how to manage their priority.
http://www.brighthub.com/computing/linux/articles/37236.aspx

swapfile initialization takes long time

Artem's picture

Hi,

So I created a swap file of 16GB in an ext3 file systems, but it took several hours to complete swapon. And this happens every time the machine reboots. IS there a way to speed up this process?

cheers
artem.

Swap FILES tend to be slow. Try a swap partition instead.

Silver Knight's picture

The original post is about swap files rather than swap partitions. Both are used for the same purpose, but as stated in the post title "Emergency Swapfile", swap files tend to be best used for emergency situations or specialty needs (for example, when partitioning the drive is not possible for one reason or another). If you ARE able to re-partition the drive space, then far more efficient performance-wise is the swap partition (or even better yet, a swap DRIVE if you have a speedy but small-ish spare drive laying about somewhere). This will surely give much better performance than using a swap file, especially when dealing with sizes in the multi-gigabyte ranges. Of course, as the other reply to this post states, you should also consider carefully the size of your required swap space as well. 16 gigabytes does seem a bit extreme unless you are using insane amounts of RAM for some really intense application.

> far more efficient

Anonymous's picture

> far more efficient performance-wise is the swap partition

Mainly untrue. See Andrew Morton in
http://lkml.org/lkml/2005/7/7/326

RE: 16Gb Swap File

jacksinn's picture

Unless you are running on 4GB of RAM or more, I'd suggest going with a lower swap size. I like to keep mine about twice the size of the amount of RAM I have. General practice usually ranges from 1x-4x the size of your RAM.

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix