Linux Swap Partition

Discussion in 'other software & services' started by rdsu, Oct 11, 2007.

Thread Status:
Not open for further replies.
  1. rdsu

    rdsu Registered Member

    Joined:
    Jun 28, 2003
    Posts:
    4,537
    Hi :p ,

    After reading a few things about how to make partitions for Linux, since I'm decided to leave Windows, I want to discuss with you about the Swap partition.

    I think that all the Linux distros put the Swap partition next to the Root partition, but for example Mrkvonic, on his website, prefer to put it first.

    Today the systems doesn't need a lot virtual memory because we already have and a lot of available memory. Another thing is the fact that is faster to have it +/- on the 1/3 of the disk (from the outer tracks) because the disk can do quicker movements to read all the data on it, instead of having to go every time to the outer track of the disk.
    This way we will have the system files on the faster part of the disk.
    On Windows this is the same...

    So, I prefer the default of Linux distros and put the Swap partition next to the Root partition.

    Another thing is it size. Like I already said, we don't need a lot of swapping like we needed before, so 512MB or 1GB will be more than sufficient...

    What do you think?

    Regards
     
  2. zapjb

    zapjb Registered Member

    Joined:
    Nov 15, 2005
    Posts:
    5,556
    Location:
    USA still the best. But barely.
    I think, welcome aboard. Choose your distro wisely. :thumb:
     
  3. Pedro

    Pedro Registered Member

    Joined:
    Nov 2, 2006
    Posts:
    3,502
    You probably know more than i. But Debian's wiki mentions:
    http://wiki.debian.org/Swap?highlight=(swap)

    I believe Alphalutra1 said the same before. I think GNU/Linux does a good job keeping unneeded memory in SWAP. It would take real knowledge for me to provide a decent answer sorry :p
     
  4. rdsu

    rdsu Registered Member

    Joined:
    Jun 28, 2003
    Posts:
    4,537
    It depends of what programs we use...

    If we use a lot of programs at the same time, that consumes a lot of memmory, than would be nice to increase the size of the swap partition...

    But it's logic that if we increase the memory on our systems we will also reduce the usage of the swap, and that is why the system became much faster...

    For example, if we have 2GB of memory, it is wise to define the swap for 4GB (2 x Memory)? For what? I really doubt that we will use all that swap...
     
  5. Pedro

    Pedro Registered Member

    Joined:
    Nov 2, 2006
    Posts:
    3,502
  6. rdsu

    rdsu Registered Member

    Joined:
    Jun 28, 2003
    Posts:
    4,537
    Nice article :)

    Do you know if exists some similar program of Process Explorer, to Linux?
     
  7. Pedro

    Pedro Registered Member

    Joined:
    Nov 2, 2006
    Posts:
    3,502
    Built in :)
    The Task Manager equivalent is very good. I don't know if it varies from distro to distro, they're probably all good.
     
  8. rdsu

    rdsu Registered Member

    Joined:
    Jun 28, 2003
    Posts:
    4,537
    Excellent! :D

    I have no doubt that this time I really will change and stay with Linux... :D
     
  9. Reposed

    Reposed Registered Member

    Joined:
    Aug 17, 2006
    Posts:
    62
    Location:
    Perth, Australia
    I have a laptop with 256k of memory. Running either kde or gnome, my swap, and therefore my hdd, gets hammered with only a few programmes running. However, using xfce or fluxbox desktops, combined with a distro that runs few services, tends make life for my laptop far less stressful. Running Dreamlinux at the moment and find that it runs very smoothly on my machine and only uses a small portion of swap. Fluxbuntu and Elive are two others that have worked well on my machine. Strangely, Mandriva 2008, even when running xfce, still needed a lot of swap. Too many services I suspect, but I didn't know which ones I could turn off - still being a relative newbie at linux.
     
  10. Alphalutra1

    Alphalutra1 Registered Member

    Joined:
    Dec 17, 2005
    Posts:
    1,160
    Location:
    127.0.0.0/255.0.0.0
    My pc with 256MB of RAM rarely touches the swap thank goodness, otherwise it slows to a crawl because my hard disk is so slow :doubt:

    I can't find the post I wrote on swap, but I'll quote the OpenBSD FAQ which is a pretty good source of knowledge and can put it much better then I could ever word it:
    I would put around 512MB of RAM of swap, and if you ever need more, either add another partition, expand the partition, or just swap to a file, all of which are easily feasible. If my setup never swaps with only 256MB of memory, you should be just fine, but then again I like to run light, but I have been known to have firefox and java going at the same time :D

    Cheers,

    Alphalutra1
     
  11. Kerodo

    Kerodo Registered Member

    Joined:
    Oct 5, 2004
    Posts:
    8,013
    Hey VC, good to see you using Linux.. :)

    I have an older PC with 512mb ram and have always used around 750mb to 1 gig for swap, however, it rarely gets used, usually just a few mb at most. Probably because I don't ever really tax the system much, just do browsing and email and music, p2p, the usual. Right now I am dual booting XP and SuSE 10.3, I put SuSE on a small 8 gig partition, and it defaulted with 750mb swap, which is more than enough for me I think.. I think if you have plenty of ram, there isn't much need for much swap as it's never going to be used anyway... just wasted disk space..
     
  12. rdsu

    rdsu Registered Member

    Joined:
    Jun 28, 2003
    Posts:
    4,537
    Thanks for your opinions... ;)
     
  13. Pedro

    Pedro Registered Member

    Joined:
    Nov 2, 2006
    Posts:
    3,502
    My bad, i did a search and didn't find anything either. You actually said in the OpenBSD thread 256 MB.
    Time for reading and not posting.
     
  14. iceni60

    iceni60 ( ^o^)

    Joined:
    Jun 29, 2004
    Posts:
    5,116
  15. EASTER

    EASTER Registered Member

    Joined:
    Jul 28, 2007
    Posts:
    11,126
    Location:
    U.S.A. (South)
    Interesting tidbit. It does seems Logical that the turnings per micro/nano-second or whatever the actual rate of speed, would indeed be preminum at the spindle or center point of disc. For some odd reason, some including myself had in the past been under the false perception that the space at that area of the disk was too limited in scope to make any real difference, but then data space naturally increases as files are added beyond it.

    Just trying to pin down this more acceptable placement of data.

    It makes perfect sense then when looking at the physical geometry, after all it is also a mechanical device as well as electronic.

    Thanks for that info.

    It's been all too easy for some of us like myself content to keep Linux on the backburner while we're so consumed daily (yearly o_O ) with securing Windows always looking for that perfect combo which seems an endless task, but finally getting somewhat better.

    Linux though finally has my attention now thanks to the latest Topic and postings concerning Suse 10.3 and hope to make the most of a go with it.
     
  16. GlobalForce

    GlobalForce Regular Poster

    Joined:
    Jun 30, 2004
    Posts:
    3,581
    Location:
    Garden State, USA
  17. Mrkvonic

    Mrkvonic Linux Systems Expert

    Joined:
    May 9, 2005
    Posts:
    10,223
    Hello,

    Regarding the position / size of the swap file...

    1. It is or was recommended to use double the RAM size. I must admit that I have sinned and used less than that, only equivalent of RAM size, but in both cases the machines have 2GB RAM, so the memory usage is not really an issue. Even when I run VM and give them quite a lot of RAM, I have never run out of memory.

    2. Position; if you have a plenty of RAM, the chances you won't need it that much ... which means that your root (and possibly home) will be on the faster tracks ... but this is not something that should bother you. You will probably never be able to tell the difference unless you are at the low end of HW.

    3. Another reason why I like to position them in this order is the grow/shrink need in possible future. If your root gets crammed, but the home partition is free, you'll be able to repartition and "squeeze" outwards, but not if the swap is in the middle.

    4. All of the above means nothing with good, modern PC.

    Cheers,
    Mrk
     
  18. iceni60

    iceni60 ( ^o^)

    Joined:
    Jun 29, 2004
    Posts:
    5,116
    i don't think those settings are too great, i've been trying out different values for the last few days and right now it looks like no buffers are being held in RAM and the cache is very small, i think it's the vm.vfs_cache_pressure that did that, so i'm going to reboot now and delete the vm.vfs_cache_pressure=50 setting and only use vm.swappiness=20. just about all the articles i've read mention tyring the vm.swappiness setting, but not many mention vm.vfs_cache_pressure.
     
  19. rdsu

    rdsu Registered Member

    Joined:
    Jun 28, 2003
    Posts:
    4,537
    iceni60,

    Thanks for the tips :p

    Thanks for the links ;)

    That is a nice thing to use the Swap partition at the beginning, but I still prefer to use after the Root partition, because I normally choose a good size for system partition, and I think that changing the partitions sizes isn't a big problem today...
     
  20. Pedro

    Pedro Registered Member

    Joined:
    Nov 2, 2006
    Posts:
    3,502
Thread Status:
Not open for further replies.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.