Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Why do we need to make swap partitions?

  1. #1
    Join Date
    Mar 2007
    Beans
    1,052

    Why do we need to make swap partitions?

    Why do we need to make swap partitions? Why can't it be like Windows where it uses your installation partition as much as it needs to and if it doesn't need to, it doesn't use at all. Of course Windows doesn't have good memory management and uses alot of pagefiling but my point is why can't Ubuntu have a similar option? Is there any good reason for not having it implemented in that way? Or is it possible to do this?

    Thanks!
    Apps for Ubuntu (outdated) ---> http://cid-23a283fc1010a1bb.skydrive...%20Wine|6?uc=1
    Use Mnemosyne to Study for School!

  2. #2
    Join Date
    Jun 2007
    Location
    Paraparaumu, New Zealand
    Beans
    Hidden!

    Re: Why do we need to make swap partitions?

    One reason that *nix has a separate partition for its swap file is that it can be more efficient. Under Windows, the pagefile can be fragmented, which eats into the efficiency.
    Forum DOs and DON'Ts
    Please use CODE tags
    Including your email address in a post is not recommended
    My Blog

  3. #3
    Join Date
    May 2007
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Why do we need to make swap partitions?

    Linux uses the separate partition because it is efficient, can easily be unmounted, and can be shared between linux distributions in a multiboot setup (if you aren't hibernating). Swap is used to store your RAM during hibernate.

  4. #4
    Join Date
    Jun 2008
    Beans
    267
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: Why do we need to make swap partitions?

    Linux can use just another file on the filesystem for swap just like windows. I'm trying to think off the top of my head the reasons it's not the best approach. One I think is that your swap space is traditionally were core dumps are written out to, so if your filesystem is corrupted, you want your swap on a separate partition.

    I did a little quick research and found this link that a file is a safe option according to Andrew Morton. http://lkml.org/lkml/2005/7/7/326
    I'm not sure why we still tend towards the swap partition then to be honest. I think it's an old habit from when it was better and safer.

  5. #5
    Join Date
    Jun 2008
    Location
    Spain
    Beans
    181
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: Why do we need to make swap partitions?

    Yes it is something of the past.

    Now it seems it is better to use a file for swapping because the efficiency is equivalent than a swap partition and it is easier to resize.

  6. #6
    Join Date
    Oct 2007
    Location
    Siberia
    Beans
    217
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Why do we need to make swap partitions?

    Quote Originally Posted by manfer View Post
    Yes it is something of the past.

    Now it seems it is better to use a file for swapping because the efficiency is equivalent than a swap partition and it is easier to resize.
    It is a matter of taste, actually. Some of Windows admins prefer creating separate primary partition and store swap file with fixed size on it Everything have its cons and pros.
    Registered Ubuntu User # 18873.
    We all create a new world.

  7. #7
    Join Date
    Jun 2008
    Location
    Spain
    Beans
    181
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: Why do we need to make swap partitions?

    Resizing wouldn't be often needed but imagine a system with 256Mb RAM with a swap partition of 512Mb. If that system is upgraded to 1GB RAM you would probably like to resize swapping to 1Gb at least. With a file for swapping it would be very very easy, but with the swap partition?? In linux systems was suggested to use swap partition because a better efficiency but in this days the efficiency of a swap partition and a swap file are equivalent.

    Windows problems with paging file are totally different. No matter you put it on a file or on a different partition, the fragmentation problem is there (is a problem of the NTFS filesystem and as paging is no more than data in that filesystem, the paging inherits the problem too). The only form I knew of improving windows paging a little was putting the paging file in a partition made for it, being that partition the first of a disk. That way paging file can be accessed faster and that is the improvement, though fragmentation would be still present, no way to correct that.
    Last edited by manfer; June 27th, 2008 at 08:10 AM.

  8. #8
    Join Date
    Oct 2007
    Location
    Siberia
    Beans
    217
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Why do we need to make swap partitions?

    Quote Originally Posted by manfer View Post
    Resizing wouldn't be often needed but imagine a system with 256Mb RAM with a swap partition of 512Mb. If that system is upgraded to 1GB RAM you would probably like to resize swapping to 1Gb at least. With a file for swapping it would be very very easy, but with the swap partition??
    Yep, that makes sense. Though *nix systems were (and still are *sigh*) generally server OSes, and servers generally not getting upgraded often enough.

    Quote Originally Posted by manfer View Post
    in this days the efficiency of a swap partition and a swap file are equivalent.
    Citation needed

    Quote Originally Posted by manfer View Post
    No matter you put it on a file or on a different partition, the fragmentation problem is there (is a problem of the NTFS filesystem and as paging is no more than data in that filesystem, the paging inherits the problem too).
    Not agreed, elaborate please. From my point of view, single file with fixed size could be allocated in one shot, and fortunately without any fragmentation. Therefore, any data written into it won't be affected by fragmentation unless ntfs driver decide to do something nasty.

    Quote Originally Posted by manfer View Post
    The only form I knew of improving windows paging a little was putting the paging file in a partition made for it, being that partition the first of a disk.
    Agreed, this improves performance more or less.
    Registered Ubuntu User # 18873.
    We all create a new world.

  9. #9
    Join Date
    Dec 2006
    Location
    Hogwarts, `UNKNOWN`
    Beans
    Hidden!
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Re: Why do we need to make swap partitions?

    Option to use SWAP file must be given during install.

  10. #10
    Join Date
    Jun 2008
    Location
    Spain
    Beans
    181
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: Why do we need to make swap partitions?

    @rubicon: The citation is on the 4th post by Taxman415a. I didn't read to much about it but can be found in that citation and on ubuntu wikis too. It is something since kernel 2.6, don't know exactly why.

    https://help.ubuntu.com/community/SwapFaq

    which would point you to:

    http://en.wikipedia.org/wiki/Paging#Swapping_in_Linux
    http://lkml.org/lkml/2005/7/7/326

    About the paging file in Windows. Yes sorry, fragmentation occurs when paging file automatic resizing is enable, not with single file with fixed size. Thanks for the correction.
    Last edited by manfer; June 27th, 2008 at 09:11 AM.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •