Page 1 of 1

Multiple Linux setup

Posted: Sat Apr 28, 2012 10:56 am
by DrTeeth
I had got into the habit of having a separate swap file partition for
each Linux distro installed. I had beleived that one swap file could
not be used for all distros since the UUID system came into use.

I have been advised on these forums that I am mistaken.
What are the performance benefits, if any, to having a swap file next
to its distro rather than having both at opposite ends of the hard
disk? I only have a 2GB swap file for each partition so wasting space
is not an issue with modern drives.

OT- Are there any special steps to be taken if one reverts from a
multi-swap file setup to one that has a single one?
--

Cheers

DrT
______________________________
We may not be able to prevent the stormy times in
our lives; but we can always choose to dance
in the puddles (Jewish proverb).

Re: Multiple Linux setup

Posted: Sat Apr 28, 2012 5:44 pm
by TeraByte Support(TP)
On 04/28/2012 06:56 AM, DrTeeth wrote:
> I had got into the habit of having a separate swap file partition
> for each Linux distro installed. I had beleived that one swap file
> could not be used for all distros since the UUID system came into
> use.
>
> I have been advised on these forums that I am mistaken. What are the
> performance benefits, if any, to having a swap file next to its
> distro rather than having both at opposite ends of the hard disk? I
> only have a 2GB swap file for each partition so wasting space is not
> an issue with modern drives.
>
> OT- Are there any special steps to be taken if one reverts from a
> multi-swap file setup to one that has a single one? --
>
> Cheers
>
> DrT ______________________________ We may not be able to prevent the
> stormy times in our lives; but we can always choose to dance in the
> puddles (Jewish proverb).
>
>

You can use the same swap partition for multiple Linux installs,
although there are some things to keep in mind about it.

A line in /etc/fstab is used to specify the swap partition, and in
modern distros that line usually specifies the UUID of the swap
partition. That line can be edited to change the UUID at any time, or it
can also just specify the partition directly (such as with /dev/sda5),
so the swap UUID can change without affecting anything. For example,
these 2 lines can both specify the same swap partition:

UUID=e56593f9-7e87-435c-96a0-e8215eeb22f3 none swap sw 0 0
/dev/sda5 none swap sw 0 0

If you install a distro that formats the swap partition so that the swap
UUID changes, you can either change the UUID in /etc/fstab for the other
installs (the command 'blkid' will display the swap UUID ), or just
specify it by partition designation to begin with so that won't be
necessary.

Some other points:

- if you want to hibernate (suspend to disk), Linux uses the swap
partition for that. In that case, you will want to keep them separate,
at least the ones you hibernate from.

- you also have the option to use a swap file, rather than a swap
partition. The advantage being that the swap file will be self-contained
within the root partition. This Arch Linux wiki page gives some details
on how to set one up:

https://wiki.archlinux.org/index.php/Swap

- as far as performance vs swap partition location, I doubt if it makes
much difference, if any, in the vast majority of situations. FWIW, I've
never even considered it when setting up partitions. However, if
interested, that wiki page linked to above has some information on it
for tuning some parameters that may affect performance in some cases.


--
Tom Pfeifer
TeraByte Support

Re: Multiple Linux setup

Posted: Mon Apr 30, 2012 7:22 pm
by DrTeeth
WOW! Thanks for all of that Tom. It is much appreciated.
--

Cheers

DrT
______________________________
We may not be able to prevent the stormy times in
our lives; but we can always choose to dance
in the puddles (Jewish proverb).

Re: Multiple Linux setup

Posted: Thu May 03, 2012 3:12 pm
by peleus
Outstanding. :) Please update us DrTeeth as soon as you get this to work.