what is the difference between swap partition and swap file

Nils Kassube kassube at gmx.net
Wed Mar 11 20:10:36 UTC 2009

Da Liu wrote:
> can anybody tell me the what the difference is between them?

A swap file is an ordinary file written to a mounted file system. A swap 
partition is a separate partition used for swap only.

> How 
> about the efficiency?

If you are worried about efficiency avoid swapping, i.e. install more 
RAM or don't use that many huge applications simultaneously.

> I am not sure whether  I should enlarge the /swap partition or make a
> swap file
> as a virtural swap partition.
> Which is better?
> I wanna increase the swap because my laptop cannot hibernate
> correctly. (1G memory, now the /swap is ~1G) .

In that case increase your swap partition because you can't use a swap 
file to hibernate. From <https://help.ubuntu.com/community/SwapFaq>:

| The hibernation feature (suspend-to-disk) writes out the contents of
| the memory to the swap partition before turning off the machine.
| Therefore, your swap partition should be at least as big as your RAM
| size. The hibernation implementation currently used in Ubuntu, swsusp,
| needs a swap or suspend partition, and can not use a swap file on an
| active file system.      


More information about the kubuntu-users mailing list