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.
-
It is possible to make Windows put the pagefile on another partition. – Dalton Miller Dec 01 '11 at 15:13
3 Answers
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.
-
You can use a swap file in Linux. You typically don't as to try to avoid filesystem overhead. – user606723 Dec 01 '11 at 15:54
-
@user606723 You're right, I'll update my response to make it clear that a file can also be used. – jcollado Dec 01 '11 at 16:40
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:
- Security: Linux wipes the swap file securely before shutdown so nobody can restore it.
- Performance: You may wish to map your swap partition to an SSD to increase speed.
- Even if your system partition is full, you have some space for your swap data.
-
3Why 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
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.

- 37,551