Sunday, September 11, 2011

To swap or not to swap?

Today as i switched my notebook on and logged into Ubuntu i was welcome with the message 'your system has only 348Mb of free space' wtf? was my first impression, i have a 40 Gb HD and i dual boot win7 and Ubuntu Natty Narwahl, but i was sure to have a few Gb of space left, so i started Gparted and took a look...
WTF??? I discovered 3 swap partitions totaling a bit over 6 Gb, something went terribly wrong while installing, there is my missing space!!!
So i happily deleted 2 of those partitions and then i started to wonder, i recently upgraded my RAM to 2 Gb, so what would happen if i delete the third swap partition and run Linux totally without swap? I considered worth a try, so first thing to do was ask mighty Google for enlightenment.
Swap vs. no swap - Alex on Linux  gave me quite a bit to read and a lot of useful info, for instance one thing that made me think twice about running without swap is the fact that without swap there's no possibility of hibernation,
one of the reasons why recommended swap space size is twice the size of the RAM that is in the computer is to allow the operating system to accommodate all your RAM in swap partition – to allow hibernation. I do hibernate my system often so i don't have to sometimes close running programs... i know it's a commodity but once you're used to that is difficult not to do it. 

Has swap still a use with 4 GB of memory? | KernelTrap has also a good discussion about swap, some people do, some don't, i guess it depends what programs you work with and how much memory they use. 
sourcefrog : Is swap space obsolete? this particular article gives a deeper explanation why swap is still important even if you have a few Gb of RAM.

Bottom line is, without swap you won't be able to hibernate your system (not to be confused with sleeping, in sleep mode the system still works and consumes power while in hibernate mode it comes to complete stop) without swap your system may loose stability and disk speed access will be slower compared to a system with swap, so I'll keep for sure that last swap partition.