Configuring two Ubuntus to share a swap partition? - Setup

This is a discussion on Configuring two Ubuntus to share a swap partition? - Setup ; One of my scratch monkeys has two different ext3 partitions on it, with somewhat different configurations of Ubuntu in each one. During some recent struggles, I apparently separated one of them from its swap partition. Since I had to rebuild ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: Configuring two Ubuntus to share a swap partition?

  1. Configuring two Ubuntus to share a swap partition?

    One of my scratch monkeys has two different ext3 partitions on it,
    with somewhat different configurations of Ubuntu in each one. During
    some recent struggles, I apparently separated one of them from its
    swap partition. Since I had to rebuild the other one at a little
    later, it seemed easiest to just wipe both of the swap partitions
    before the reinstall, and let it make a new swap partition, so now I
    only have one (fresh) swap partition, which is only used by the new
    installation.

    >From searching in the newsgroups, it seems like it's okay (or at least

    it used to be okay) to configure several Linux installations to use
    the same swap partition. However, I wasn't able to figure the best way
    to do it. Is there some relatively painless way (or even a GUI way) to
    do this part of the configuration without a lot of low-level tweaking
    of the configuration files? (That's what seemed to be necessary based
    on studying the man pages about setting up swap files. Actually, based
    on the man page study, it seems like it might be simplest to just
    create and use a swap file in the ext3 partition.)


  2. Re: Configuring two Ubuntus to share a swap partition?

    Shannon Jacobs (Shannon.Jacobs.nospam@gmail.com) writes:
    > One of my scratch monkeys has two different ext3 partitions on it,
    > with somewhat different configurations of Ubuntu in each one. During
    > some recent struggles, I apparently separated one of them from its
    > swap partition. Since I had to rebuild the other one at a little
    > later, it seemed easiest to just wipe both of the swap partitions
    > before the reinstall, and let it make a new swap partition, so now I
    > only have one (fresh) swap partition, which is only used by the new
    > installation.
    >

    That almost seems like a fault of too much handholding on the installer's
    part. There is absolutely no reason to have more than one swap partition.
    By definition it's not used for storage when you turn things off, so you
    don't need to know or care what's on it when you switch to the other
    distribution.

    So long as you have set up one swap partition, all you have to do is
    edit /etc/fstab so the other distribution knows where the swap partition
    is. The same line from the "good" distribution will be what you put
    in the distribution without the swap set up.

    It seems odd that when you install the second distribution, it doesn't
    already notice that there's a swap partition, because a swap partition
    would be clearly apparent to the distribution.

    Swap is often overrated. The last time I installed, I somehow forgot
    a step, so there was no entry in fstab for the swap partition. I didn't
    even notice it. So unless your installer is freaking out about "no
    swap partition", you can live with it until you can boot the new
    install and edit fstab.

    Michael


    >>From searching in the newsgroups, it seems like it's okay (or at least

    > it used to be okay) to configure several Linux installations to use
    > the same swap partition. However, I wasn't able to figure the best way
    > to do it. Is there some relatively painless way (or even a GUI way) to
    > do this part of the configuration without a lot of low-level tweaking
    > of the configuration files? (That's what seemed to be necessary based
    > on studying the man pages about setting up swap files. Actually, based
    > on the man page study, it seems like it might be simplest to just
    > create and use a swap file in the ext3 partition.)
    >




  3. Re: Configuring two Ubuntus to share a swap partition?

    In comp.os.linux.setup on 30 Apr 2007 20:46:53 -0700, Shannon Jacobs
    wrote:

    > From searching in the newsgroups, it seems like it's okay (or at
    > least it used to be okay) to configure several Linux installations
    > to use the same swap partition.


    Yes: anything else is probably just a waste of disk space.

    > However, I wasn't able to figure the best way to do it. Is there
    > some relatively painless way (or even a GUI way) to do this part of
    > the configuration without a lot of low-level tweaking of the
    > configuration files?


    $ sudo editor /etc/fstab

    Add a line lke this:

    /dev/hdax none swap sw 0 0

    Where /dev/hdax is the location of the swap partition. In fact, you
    can copy this line from the installation that's properly configured.

    Then:

    $ sudo swapon -av

    For details, see man fstab and man swapon.

    --
    PJR :-)

  4. Re: Configuring two Ubuntus to share a swap partition?

    On May 1, 2:43 pm, Peter J Ross wrote:
    > In comp.os.linux.setup on 30 Apr 2007 20:46:53 -0700, Shannon Jacobs
    >
    > wrote:
    > > From searching in the newsgroups, it seems like it's okay (or at
    > > least it used to be okay) to configure several Linux installations
    > > to use the same swap partition.

    >
    > Yes: anything else is probably just a waste of disk space.
    >
    > > However, I wasn't able to figure the best way to do it. Is there
    > > some relatively painless way (or even a GUI way) to do this part of
    > > the configuration without a lot of low-level tweaking of the
    > > configuration files?

    >
    > $ sudo editor /etc/fstab
    >
    > Add a line lke this:
    >
    > /dev/hdax none swap sw 0 0
    >
    > Where /dev/hdax is the location of the swap partition. In fact, you
    > can copy this line from the installation that's properly configured.
    >
    > Then:
    >
    > $ sudo swapon -av
    >
    > For details, see man fstab and man swapon.
    >
    > --
    > PJR :-)


    Thanks, I think this is the approach to try, and it meshes with with I
    can recall of the man study. Also thanks to Michael Black, though his
    reply is more of a background approach... In my struggles, I had
    focused on swapon and mkswap, and I don't recall studying fstab.

    Regarding the need for the swap file, I'm definitely not sure, but I
    think I am seeing some problems with that older installation that may
    be related to lack of a swap file. It sometimes get into a mode where
    it is pretty clearly thrashing...

    Whoops, I seem to have spoken too soon... It isn't as obvious as I'd
    hoped. Rather than using the simple /dev/hda6 reference that matches
    what you described, it appears the newer version of Ubuntu is using a
    more complicated UUID-based reference... Long complicated thing with
    hair on it. Oh well, I suppose that's why I'm losing mine.

    Okay, here goes nothing. If I don't return in tatters, it must have
    worked.


  5. Re: Configuring two Ubuntus to share a swap partition?

    Aha! I think the problem was actually that the old Ubuntu installation
    still had the fstab line for a swap partition that no longer existed.
    No wonder it was going so far south sometimes. Not sure what it
    thought it was doing when it tried to swap to a place that no longer
    existed... Should I be amazed I didn't get the blinkenlichten mit
    spitzensparksen?

    I am confused about one aspect of this struggle... When I studied the
    situation earlier, it seemed very clear (according to gparted) that no
    swap partition was mounted. Using the same approach now, it is quite
    clear that there is one swap partition and it is in use. There's even
    an option to turn it off. In Ubuntu, is the swap partition only
    mounted as needed? Had it never been mounted in that session? Or had
    it become unmounted when it wasn't being used?

    Anyway, thanks again, and my current round of problems seem to have
    been cured. Now I'll just relaxen and watschen der blinkenlichten.


  6. Re: Configuring two Ubuntus to share a swap partition?


    All about history of Indonesian country, und global universal news.
    http://hystorian.blogspot.com
    http://sejarawan.blogspot.com
    http://cahdinar.blogspot.com
    Please com to three web-blog in front of..up there and click anything
    about this in.


+ Reply to Thread