Swap space settings and other partitioning q's - Questions

This is a discussion on Swap space settings and other partitioning q's - Questions ; Hello! I was just curious to know... What are some good rules of thumb for configuring swap space under Linux? For that matter, are there any comprehensive guides or articles on the subject? When I used to admin NT boxes ...

+ Reply to Thread
Results 1 to 7 of 7

Thread: Swap space settings and other partitioning q's

  1. Swap space settings and other partitioning q's

    Hello!

    I was just curious to know... What are some good rules of thumb for
    configuring swap space under Linux? For that matter, are there any
    comprehensive guides or articles on the subject? When I used to admin
    NT boxes I used to set their "virtual memory" setting to 1.5 times
    physical memory, giving 50% over physical as swap. That was just by
    convention, or, "rule of thumb". No great scientific methodology, it is
    just what had worked for me and my coworkers for so long. Granted,
    Linux is different.

    On my box I have installed Ubuntu and moved up to the 2.6.10 kernel, if
    that matters. I am presently running on two IDE hard drives, 30Mb
    Quantum Fireball and 60Mb Seagate ST360020A. As it stands, I have 1Gb
    of physical RAM and have two swap partitions, one on each drive and both
    494.16Mb. Initially I had set up a 32-bit install on one drive, and a
    64-bit (AMD64) on the other. I decided to go with my old NT convention
    for grins, and give 50% over physical for swap. But since I have both
    swap partitions available, I have both the 32 and 64 bit installs using
    both swaps, for a nearly 1:1 phys:swap ratio.

    Reason I am asking is because I will be very soon installing a 250Gb
    Western Digital SATA drive. Long story on the old one, but short
    version is it shot craps before I could ever use it. But now since I
    will be getting all this breathing room I will of course be
    reconfiguring my partitioning scheme. So given the opportunity I would
    like to put some method to the madness.

    One consideration, besides size, is location. This question goes beyond
    swap space, too. How does Linux like to have it's partitions metered
    across multiple drives? Should the root and swap be on different
    physical drives or does it matter? If it is better to separate, which
    would benefit most from "the faster drive"? Does it actually help to
    split the swap amongst partitions on differing drives, similar to (yes,
    remotely similar to) how striping speeds up RAID performance?

    While I am asking, I would also be interested in suggestions with regard
    to partitions and placements. I have been running 5Gb roots that include
    my /var and /home. Most of my "media", including music, video, photos,
    and the like I have been keeping on a separate partition that I mount
    under /mnt/share. This way I have access to it from whichever root I
    boot to, as well as making it publicly readable to my family's logins.
    Not much needs to be kept private, and, well, I manage that when need be.

    I think it would be unwise for me to make the /home directories be the
    same between the two installs (32 and 64-bit). But I am intruiged to
    know how far such a notion could be taken. Being able to have
    Thunderbird and my GPG keys available no matter which I boot to would be
    rather convenient. I could spend more time in 64-bit land. Right now I
    must use the 32-bit install for that.

    Lastly, since I don't want to tap you all toooo much all at once, I am
    curious about this whole "chroot" thing. Since I have both 32 and
    64-bit installs, is there a way to make my 32-bit root BE the chroot
    under 64-bit? That would totally rock! I have zero experience with this
    and am only sort-of understanding how it all works. I would like to,
    for instance, just run 64-bit firefox and have it use 32-bit
    libflashplayer.so. That, of course, being one of the very few things
    keeping me on the 32-bit side 90% of the time when I would much rather
    go 64-bit as much as possible. But I have heard that you can't have a
    64-bit app call a 32-bit library. Okay. So then 32-bit FF. But then
    that also means all the dependencies for FF and for FlashPlayer, right?
    Well, then, at what point DO the 64 and 32-bit parts commingle? Would
    32-bit FF run on the 64-bit X session? That, I could see. Or is it
    some "xnest" type set-up? If it dose run on the display, would it talk
    to 64-bit Gnome? What kind of crazy nightmare am I getting myself into
    with this chroot thingy? Am I better off sitting in a corner, beating my
    head against the wall? Maybe I should stop wasting my time on this and
    use it more (!) effectively, writing pleas to Macromedia to get off
    their corporate duffs and spend the, what, hour or two it would (should:
    can't know with closed-source) take to do the damned port.

    Well that's all the time my meter had, and then some. Thanks in advance
    for the time to read me and for any help and advice. And apologies for
    the cross-posting. You know, I have not seen any "forum guides" of any
    sort come down the pike on any of these newsgroups for a few months. So
    which Linux newsgroup is good for what sorts of linuxy things I just
    don't know. I'd "RTFM" on these newsgroups if I knew where to find it.

    Peace!
    Morningdew

  2. Re: Swap space settings and other partitioning q's

    Morningdew wrote:

    > I was just curious to know... What are some good rules of thumb for
    > configuring swap space under Linux? For that matter, are there any
    > comprehensive guides or articles on the subject? When I used to admin
    > NT boxes I used to set their "virtual memory" setting to 1.5 times
    > physical memory, giving 50% over physical as swap. That was just by
    > convention, or, "rule of thumb". No great scientific methodology, it is
    > just what had worked for me and my coworkers for so long. Granted,
    > Linux is different.


    Size for swap usually have been given as 1.5 to 2.5 times the size of ram,
    everything depending on whom you are talking with and what distro you use. I
    have settled for around 2 times the ram size, not that I ever have had more
    use than a few MB of the 4GB swap.


    > Initially I had set up a 32-bit install on one drive, and a
    > 64-bit (AMD64) on the other. I decided to go with my old NT convention
    > for grins, and give 50% over physical for swap. But since I have both
    > swap partitions available, I have both the 32 and 64 bit installs using
    > both swaps, for a nearly 1:1 phys:swap ratio.


    One swap is enough, even if you run 32-bit and 64-bit linux, but if you have
    heavy usage of swap, then splitting up to more than harddrive can speed the
    swap speed.


    > One consideration, besides size, is location. This question goes beyond
    > swap space, too. How does Linux like to have it's partitions metered
    > across multiple drives? Should the root and swap be on different
    > physical drives or does it matter? If it is better to separate, which
    > would benefit most from "the faster drive"? Does it actually help to
    > split the swap amongst partitions on differing drives, similar to (yes,
    > remotely similar to) how striping speeds up RAID performance?


    Today with the hughe RAM, swap is quite rarely used, so you can put it on
    slower harddrives or use the end part of the harddrive. I have always set my
    swap as the last slice on my harddrives (usually only one harddrive with swap).
    Stripping would speed up swap, but you don't need to setup it as raid, IBM had
    a quite good article about swap on linux, but sadly I can't find the right
    link at the moment.


    > While I am asking, I would also be interested in suggestions with regard
    > to partitions and placements. I have been running 5Gb roots that include
    > my /var and /home. Most of my "media", including music, video, photos,
    > and the like I have been keeping on a separate partition that I mount
    > under /mnt/share. This way I have access to it from whichever root I
    > boot to, as well as making it publicly readable to my family's logins.
    > Not much needs to be kept private, and, well, I manage that when need be.


    I have done differently, I have a fileserver where I have setup a LVM, this
    one is up on 360GB at the moment (max out at 2TB), the LVM is my /home and I
    share it with NFS to all my computers, so login in you will access all your
    files and settings, regadles on which computer you happen to work at.
    I have only removeble medias mounted in /mnt (cdrw/dvdrw/zip/mp3/floppy).

    Otherwise I have /usr, /usr/src, /tmp and / as own slices, on machine with the
    mailserver I have /var/spool/mail too as it's own (don't want big mails to
    fill /var and that way block the system).


    > I think it would be unwise for me to make the /home directories be the
    > same between the two installs (32 and 64-bit). But I am intruiged to
    > know how far such a notion could be taken. Being able to have
    > Thunderbird and my GPG keys available no matter which I boot to would be
    > rather convenient. I could spend more time in 64-bit land. Right now I
    > must use the 32-bit install for that.


    Why would that be the case? The settings would still be the same for the
    applications, regadles if they are compiled as 32 or 64 bit, just waist of
    space to have more than one /home.


    > Lastly, since I don't want to tap you all toooo much all at once, I am
    > curious about this whole "chroot" thing. Since I have both 32 and
    > 64-bit installs, is there a way to make my 32-bit root BE the chroot
    > under 64-bit? That would totally rock! I have zero experience with this
    > and am only sort-of understanding how it all works. I would like to,
    > for instance, just run 64-bit firefox and have it use 32-bit
    > libflashplayer.so. That, of course, being one of the very few things
    > keeping me on the 32-bit side 90% of the time when I would much rather
    > go 64-bit as much as possible.


    I think you may have confused what chroot is, you use it to lock software to
    run in a controlled environment.


    > But I have heard that you can't have a
    > 64-bit app call a 32-bit library. Okay. So then 32-bit FF. But then
    > that also means all the dependencies for FF and for FlashPlayer, right?
    > Well, then, at what point DO the 64 and 32-bit parts commingle? Would
    > 32-bit FF run on the 64-bit X session?


    People are running neverwinter nights on 64bits systems, so there shouldn't be
    problems, you may need a compat library to allow run 32bit stuff in 64bits
    environment, I'm not that much into that as I only have 32bits machines.



    //Aho

  3. Re: Swap space settings and other partitioning q's

    Morningdew wrote:
    > Morningdew wrote:
    >
    >>> I was just curious to know... What are some good rules of thumb for
    >>> configuring swap space under Linux? For that matter, are there any

    >
    >
    > J.O. Aho wrote:
    >
    >> Size for swap usually have been given as 1.5 to 2.5 times the size of
    >> ram, everything depending on whom you are talking with and what distro
    >> you use. I have settled for around 2 times the ram size, not that I
    >> ever have had more use than a few MB of the 4GB swap.

    >
    >
    > Wow, that's completely contradictory to what Paul Sherwin replied with,
    > which is...
    >
    >> There is *no* direct relationship between physical memory and swapfile
    >> size. These rules of thumb originated in the 70s when people had to
    >> commission systems before knowing what the application mix would be.
    >> The idea was that a system with a lot of memory would be used for
    >> memory intensive applications, so should have a lot of swapspace as
    >> well.


    I don't really see any contradiction here, more that are quite on the same
    track. In a normal usage, you don't need a hughe swap, but today the cost for
    a GB harddrive space is quite low, so you can make a big swap even if you
    won't ever be using it completly.


    > Thats all cool. I'm not running a home net right now, though I have in
    > the past. I suppose really much of these decisions depend on how you
    > intend to use the system. Think for me it is desktop, mostly one user,
    > with occasional family or guest logins under their own accounts.


    I'm the main user on my home network, with some family members that may use it
    from time to time, but that don't mean I want to configure each machine just
    for fun.

    This can be taken even futher, to use tftp to boot systems and use nfs to
    access filesystems, this way you could have diskless systems, this makes the
    coolness level to raise a lot. The coolest home made system I have seen
    includes 3 computers, where one serves the other two as file server (nfs) and
    boot media (tftp), quite cool IMHO.


    > I assume that LVM is Logical Volume Manager or maybe Linux Volume
    > Management, something like that? I don't know what that is, but I will
    > look it up.


    It's L as in Logical.


    > Okay well here is a place where I get concerned, and don't want to mess
    > things up. I mean, lots of configuration information for my user goes
    > here, and I don't want to cause confusion for my programs. I guess I am
    > worrying too much. For the most part I will be trying to keep my app
    > installs between the two in sync. However, if I do have some
    > differences between them this is where they'd likely collide, no?


    I still haven't seen a program, say gimp that would have completly different
    setting if it was compiled for 32bits or 64bits.


    > But hey, the real goal is to run as much in 64-bit land as possible.
    > It's just that a few things (proprietary binaries only released on
    > 32-bit) are holding me back. Once I understand how to "mix" the
    > environment up, I will abandon a straight 32-bit set-up. That is why I
    > wrote the following.


    A hasty checkup, showed that it don't matter that much if you mix 64 and 32
    bits programs, as long as the binary and the plugin is of the same bits, so if
    you use 32bits plugins for FireFox, then your FireFox must be 32bits too. Xorg
    on the other hand could be 64bits, this much resebles of mixed gcc2 and gcc3
    environments.
    I think this will be well covered at the distros homepages that do supply both
    32 and 64 bits versions of their distros.


    //Aho

  4. Re: Swap space settings and other partitioning q's

    On , Morningdew wrote:

    >To turn Paul's argument around, I can always cut back
    >on swap space later.


    This is difficult if you configure a big swap partition. Sure, you can
    delete the swap partition and create a smaller one, but that leaves
    you with a chunk of free disk space. All you can do with this without
    repartitioning the whole disk is to create another small filesystem
    partition in it, which isn't much use.

    A swap file is much more flexible, but most people prefer a partition
    because there's less overhead.

    Best regards, Paul
    --
    Paul Sherwin Consulting http://paulsherwin.co.uk

  5. Re: Swap space settings and other partitioning q's

    Paul Sherwin wrote:
    > On , Morningdew wrote:
    >
    >
    >>To turn Paul's argument around, I can always cut back
    >>on swap space later.

    >
    >
    > This is difficult if you configure a big swap partition. Sure, you can
    > delete the swap partition and create a smaller one, but that leaves
    > you with a chunk of free disk space. All you can do with this without
    > repartitioning the whole disk is to create another small filesystem
    > partition in it, which isn't much use.


    The most commonly used filesystem, ext3 do allow adjusting slice sices, if you
    would create a big swap and then decide to cut it down to half (or what ever),
    you can still assign the "free" space to the slice before/after and grow that
    filesystem.


    > A swap file is much more flexible, but most people prefer a partition
    > because there's less overhead.


    swapfile is slower too and in ms-world one of the main reasons for the
    fragmenation of the filesystem and overall system slowness.


    //Aho

  6. Re: Swap space settings and other partitioning q's

    Paul Sherwin wrote:
    > On , Morningdew wrote:
    >
    >>To turn Paul's argument around, I can always cut back
    >>on swap space later.

    >
    > This is difficult if you configure a big swap partition. Sure, you can
    > delete the swap partition and create a smaller one, but that leaves
    > you with a chunk of free disk space. All you can do with this without
    > repartitioning the whole disk is to create another small filesystem
    > partition in it, which isn't much use.
    >
    > A swap file is much more flexible, but most people prefer a partition
    > because there's less overhead.
    >
    > Best regards, Paul
    > --
    > Paul Sherwin Consulting http://paulsherwin.co.uk


    Thanks, Paul. Here is what I was thinking:

    250Gb SATA drive "Data Drive"
    =================================
    - 250Gb (ext3)

    Basically all of it used for "commons" space. Data / media store,
    programming projects, what have you. It's my playground. Only real
    question I have for myself is whether to house the /home directories on
    this partition too, sharing them between roots, or to leave separate
    /home directories in under the roots.

    60Gb IDE drive "Linux OS Drive"
    =================================
    - 10Gb Ubuntu 64-bit root (ext3)
    - 10Gb Ubuntu 32-bit root (ext3)
    - 28Gb free for experiments
    - 2Gb (swap)

    The deal is that the Swap will be at the end, and can easily shrink (or
    grow, heaven forbid) after I get a "real-world" feel for it. The
    experimnetal 28Gb will be for a 5Gb distro test or two, depending, and
    maybe a chunk here or there for experimental websites and content
    management systems like Mambo, Typo3, Movable Type, phpBB, etc. Call it
    my own little lab. I am also thinking of participating in the Freenode
    Project (http://freenetproject.org/) as a node, which means sharing some
    of my storage with the community. We'll see how that goes. I am very
    much in favor of supporting community projects like this. The majority
    of my media will also be available on p2p. Most of it consists of
    freely tradable concert recordings like Grateful Dead shows (and several
    other bands too!), stuff like that.

    If I wind up putting my /home directories on the 250Gb drive and sharing
    them between the distros, I may cut back the Ubuntu roots to 5Gb each
    and leave more for experiments and projects. I will read about LVM and
    scour the web a little more before deciding for sure. Aho seems to
    think I'll have no problems with shared /home.

    30Gb IDE drive "Windows OS Drive"
    =================================
    - 8Gb Win2k install (NTFS)
    - 22Gb (FAT32 ) for game data

    This is for any game I may have but not be able to get to run in Linux
    via Cedega/Wine. Hopefully these will be few, or something I won't care
    about. Linux has Doom3 and UT2004, but there is so much more on the
    Windows platform. Alas. Other than gaming, Win2k is there just in case
    I ever want to test something for whatever reason, like stuff I write in
    Java or web-stuff I need to test against IE (yeech!). I am actually very
    reluctant to put Windows on my box. Bristles my feathers... The goal
    is to boot Win2K as infrequently as possible. I will make the game data
    partition as FAT32 so I can read/write data from Linux safely, should I
    want to move anything between the OS's. Even for the games I get to
    work under Linux via Cedega/Wine, I will still store their data in this
    partition. Call it the "Game Drive" I guess.
    ---------------------------------

    Thanks both of you, Paul and Aho, who have replied to me on the OP.

    .^//\/Morningdew\//\^..

  7. Re: Swap space settings and other partitioning q's

    On , Morningdew wrote:
    [lots of stuff]

    It's true that you shouldn't worry too much about allocating 1gb or
    2gb to swap if you have huge amounts of free disk space available. It
    always helps to understand what's going on, though. By all means use
    lots of space for swap if you're in any way concerned, but I bet you
    find you never use more than a couple of megs :-)

    Best regards, Paul

    --
    Paul Sherwin Consulting http://paulsherwin.co.uk

+ Reply to Thread