4

Ive learned that one should allot a swap space inorder to have Hibernate option in Ubuntu, Why isnt it same with Windows? My Win 7 doesnt have any Swap space but still hibernates without a glitch.

kernel_panic
  • 11,732

3 Answers3

6

Windows uses a file for that instead of a partition. According to wikipedia

A file, "hiberfil.sys" is used to store the contents of RAM when the computer hibernates, and is always the same size as the total RAM. A hidden system file resides in the root of the system partition, usually "C:\hiberfil.sys".

Regarding why linux uses a partition by default. Honestly, I don't know, but I guess it's because of performance reasons.

Edit: As pointed out in a comment, you can also swap to a file as explained in the answers to this question.

jcollado
  • 9,598
5

Typically a swap file is used when the RAM is exceeded to free the RAM by storing its content to a swap file. In Windows environments this is a file (usually pagefile.sys) which is stored on the system partition. In Linux it is recommended to create an extra partition for swap. As far as I know this is not needed, you should be able to hibernate without an extra partition because linux should be able to use a file, too. For further information: https://superuser.com/questions/21020/can-i-hibernate-linux-without-a-swap-partition

The advantages of an extra swap partition are:

  1. Security: Linux wipes the swap file securely before shutdown so nobody can restore it.
  2. Performance: You may wish to map your swap partition to an SSD to increase speed.
  3. Even if your system partition is full, you have some space for your swap data.
jasperado
  • 7,388
  • 3
    Why was this answer accepted? It completely misses the point of the question. The question is asking why Ubuntu needs swap to hibernate, not what is a swap partition and why should you have one. – psusi Dec 02 '11 at 01:09
2

Linux uses the swap partition for both paging and hibernation. Windows uses a separate file for each. It uses pagefile.sys for paging, and hiberfil.sys for hibernation, so while you might not have a pagefile, you still have a hibernation file.

psusi
  • 37,551