Discussion:
Multiple Linux installs on one hard drive.
(too old to reply)
Big Al
2024-04-10 11:27:07 UTC
Permalink
I currently only have one Linux install.
I would like to install a 2nd and have a chunk of space I can use.
The current Linux has a swap partition. When I started the install of the 2nd Linux it wanted to
use the swap partition from the first Linux. If I created a 2nd swap and assigned it to this 2nd
Linux, I get 2 swaps. This isn't a killer as I can just edit the fstab after boot and remove the
extra, or at least it seems that easy.

But can I use a single swap for both? It would be simpler. My assumption is that swap is only
used while the system is running. Once shutdown, it's open game for the other OS.??
--
Linux Mint 21.3 Cinnamon 6.0.4 Kernel 5.15.0-102-generic
Al
Big Al
2024-04-10 11:37:19 UTC
Permalink
Post by Big Al
I currently only have one Linux install.
I would like to install a 2nd and have a chunk of space I can use.
The current Linux has a swap partition.  When I started the install of the 2nd Linux it wanted to
use the swap partition from the first Linux.   If I created a 2nd swap and assigned it to this 2nd
Linux, I get 2 swaps.   This isn't a killer as I can just edit the fstab after boot and remove the
extra, or at least it seems that easy.
But can I use a single swap for both?   It would be simpler.  My assumption is that swap is only
used while the system is running.  Once shutdown, it's open game for the other OS.??
Posted just too quick.
I finally found a response on ask Ubuntu that points out a single draw back when hibernating.
Corruption of the data. (or possible).
Since I don't hibernate and swap OS's, I think I'm fine. Actually I can't think of how that would be
possible.

So this question is moot.
--
Linux Mint 21.3 Cinnamon 6.0.4 Kernel 5.15.0-102-generic
Al
Paul
2024-04-10 12:43:15 UTC
Permalink
Post by Big Al
Post by Big Al
I currently only have one Linux install.
I would like to install a 2nd and have a chunk of space I can use.
The current Linux has a swap partition.  When I started the install of the 2nd Linux it wanted to use the swap partition from the first Linux.   If I created a 2nd swap and assigned it to this 2nd Linux, I get 2 swaps.   This isn't a killer as I can just edit the fstab after boot and remove the extra, or at least it seems that easy.
But can I use a single swap for both?   It would be simpler.  My assumption is that swap is only used while the system is running.  Once shutdown, it's open game for the other OS.??
Posted just too quick.
I finally found a response on ask Ubuntu that points out a single draw back when hibernating. Corruption of the data. (or possible).
Since I don't hibernate and swap OS's, I think I'm fine. Actually I can't think of how that would be possible.
So this question is moot.
Swap Partition versus /swapfile

If you install the second OS, it can format the shared swap
partition and change the UUID. This screws up the /etc/fstab
on the first OS. You can check in "top", when your first OS boots,
whether it found the swap partition or not.

If every install has its own /swapfile, then there
isn't an issue like that. But that's also a waste of space.

Identifying the swap partition via /dev/sda1 is another way
to do it. But each newly installed Linux would then need
its /etc/fstab edited to contain a /dev/sda1 type of reference.

Paul
Big Al
2024-04-10 13:34:49 UTC
Permalink
Post by Paul
Post by Big Al
Post by Big Al
I currently only have one Linux install.
I would like to install a 2nd and have a chunk of space I can use.
The current Linux has a swap partition.  When I started the install of the 2nd Linux it wanted to use the swap partition from the first Linux.   If I created a 2nd swap and assigned it to this 2nd Linux, I get 2 swaps.   This isn't a killer as I can just edit the fstab after boot and remove the extra, or at least it seems that easy.
But can I use a single swap for both?   It would be simpler.  My assumption is that swap is only used while the system is running.  Once shutdown, it's open game for the other OS.??
Posted just too quick.
I finally found a response on ask Ubuntu that points out a single draw back when hibernating. Corruption of the data. (or possible).
Since I don't hibernate and swap OS's, I think I'm fine. Actually I can't think of how that would be possible.
So this question is moot.
Swap Partition versus /swapfile
If you install the second OS, it can format the shared swap
partition and change the UUID. This screws up the /etc/fstab
on the first OS. You can check in "top", when your first OS boots,
whether it found the swap partition or not.
If every install has its own /swapfile, then there
isn't an issue like that. But that's also a waste of space.
Identifying the swap partition via /dev/sda1 is another way
to do it. But each newly installed Linux would then need
its /etc/fstab edited to contain a /dev/sda1 type of reference.
Paul
I changed my swap on this install, and it works. swapon -s
I'll be able to do the same for the other OS then. Thanks.
--
Linux Mint 21.3 Cinnamon 6.0.4 Kernel 5.15.0-102-generic
Al
MarioCCCP
2024-04-10 15:58:03 UTC
Permalink
Post by Big Al
Post by Big Al
I currently only have one Linux install.
I would like to install a 2nd and have a chunk of space I
can use.
The current Linux has a swap partition.  When I started
the install of the 2nd Linux it wanted to use the swap
partition from the first Linux.   If I created a 2nd swap
and assigned it to this 2nd Linux, I get 2 swaps.   This
isn't a killer as I can just edit the fstab after boot and
remove the extra, or at least it seems that easy.
But can I use a single swap for both?   It would be
simpler.  My assumption is that swap is only used while
the system is running.  Once shutdown, it's open game for
the other OS.??
Posted just too quick.
I finally found a response on ask Ubuntu that points out a
single draw back when hibernating. Corruption of the data.
(or possible).
Since I don't hibernate and swap OS's, I think I'm fine.
Actually I can't think of how that would be possible.
So this question is moot.
I have 2 distros on both my two desktop, and during install
of the second distro I choose the existing swap, without
formatting it (which is not only useless, but also, as Paul
pointed out, harmful since you must then edit the FSTAB of
the first distro with the new UUID).

As you said, the only possible problem is / was the use of
"non matching" hibernation / resume, but this is not always
the case. Maybe it depends on the kernel in use and/or
configuration, since I have met both possible scenarios
1) the wrong OS loaded does not detect the mismatch on time,
and discards saved hibernation data and load itself
or
2) the wrong (non matching) OS (I mean the one selected in
GRUB's menu) detects the problem in "pre-os" and refuses to
load, but loads the hibernated image instead.

There are possible ways to limit the problem frequency, I.G.
using hibernation just in the Distro you use more often and
setting it as the default intem in Grub config, so that it
resumes itself in the absence of user's choice.

I personally find the least problem all the above, compared
with the relevant waste of space of having two swaps (I have
64 GB of Ram on both machines, and I DO use hibernation, so
I need comparatively large swap partition).

the use of file does not convince me a lot, dunno why (I am
quite sure this file is preallocated contiguously on a
mechanical disk, not to degrade performance, while on SSD
the actual position of chunks is possibly irrelevant at
all). For some undefined reasons I feel safer with a
dedicated partition than with a file on the system FS.

But using 2 swaps seems to me a bit of overkill :D



--
1) Resistere, resistere, resistere.
2) Se tutti pagano le tasse, le
Nic
2024-04-10 22:10:38 UTC
Permalink
Post by Big Al
I currently only have one Linux install.
I would like to install a 2nd and have a chunk of space I can use.
The current Linux has a swap partition.  When I started the install of
the 2nd Linux it wanted to use the swap partition from the first
Linux.   If I created a 2nd swap and assigned it to this 2nd Linux, I
get 2 swaps.   This isn't a killer as I can just edit the fstab after
boot and remove the extra, or at least it seems that easy.
But can I use a single swap for both?   It would be simpler.  My
assumption is that swap is only used while the system is running. Once
shutdown, it's open game for the other OS.??
Ventoy fills some of the problem with booting in multi os's, except for
the persistence problems and difficulties. If Ventoy came up with the
persistence issue, on a thumb drive, now that would be very uptodate and
way to go. On a big thumb/flash drive you could satisfy all your
requirements with variable partition sizes and a large number of os's.
Big Al
2024-04-11 00:54:37 UTC
Permalink
Post by Big Al
I currently only have one Linux install.
I would like to install a 2nd and have a chunk of space I can use.
The current Linux has a swap partition.  When I started the install of the 2nd Linux it wanted to
use the swap partition from the first Linux.   If I created a 2nd swap and assigned it to this 2nd
Linux, I get 2 swaps.   This isn't a killer as I can just edit the fstab after boot and remove the
extra, or at least it seems that easy.
But can I use a single swap for both?   It would be simpler.  My assumption is that swap is only
used while the system is running. Once shutdown, it's open game for the other OS.??
Ventoy fills some of the problem with booting in multi os's, except for the persistence problems and
difficulties. If Ventoy came up with the persistence issue, on a thumb drive, now that would be very
uptodate and way to go. On a big thumb/flash drive you could satisfy all your requirements with
variable partition sizes and a large number of os's.
I use ventoy to have access to a large # of ISOs. I think it's great. It's a real slow drive and
really only a place to house the ISOs.
--
Linux Mint 21.3 Cinnamon 6.0.4 Kernel 5.15.0-97-generic
Al
azigni
2024-04-11 03:32:09 UTC
Permalink
On Wed, 10 Apr 2024 07:27:07 -0400, Big Al wrote:
snipped...
But can I use a single swap for both? snipped...
I used to use a single swap for two different distros on my hd. I ran into
various problems with display, etc as the swap held info from the not
being used distro that would get used by the running distro..

Once I started using a separate swap for each partition, the hassle it
saved was worth the little disk space they took up.
Big Al
2024-04-11 11:13:23 UTC
Permalink
Post by azigni
snipped...
But can I use a single swap for both? snipped...
I used to use a single swap for two different distros on my hd. I ran into
various problems with display, etc as the swap held info from the not
being used distro that would get used by the running distro..
Once I started using a separate swap for each partition, the hassle it
saved was worth the little disk space they took up.
If I get there, I'll probably make 2. I have 16G of memory and I don't think I use swap that much
but a 10G swap can't take too much of a bite out of my drive.
--
Linux Mint 21.3 Cinnamon 6.0.4 Kernel 5.15.0-102-generic
Al
Chris Elvidge
2024-04-11 11:33:14 UTC
Permalink
Post by Big Al
Post by azigni
snipped...
But can I use a single swap for both? snipped...
I used to use a single swap for two different distros on my hd. I ran into
various problems with display, etc as the swap held info from the not
being used distro that would get used by the running distro..
Once I started using a separate swap for each partition, the hassle it
saved was worth the little disk space they took up.
If I get there, I'll probably make 2. I have 16G of memory and I don't
think I use swap that much but a 10G swap can't take too much of a bite
out of my drive.
If you're going to use swap anyway - to facilitate recovery? - use at
least a 16Gb partition with 16Gb RAM, otherwise it won't fit all your
memory in the swap. If it won't fit, you can't use it for recovery.

As you say, hard disc space is cheap, even SSD.
--
Chris Elvidge, England
SPITWADS ARE NOT FREE SPEECH
azigni
2024-04-12 01:26:34 UTC
Permalink
On Thu, 11 Apr 2024 07:13:23 -0400, Big Al wrote:
I have 16G of memory and I don't
Post by Big Al
think I use swap that much but a 10G swap can't take too much of a bite
out of my drive.
Or make two 5 gig swaps?
Paul
2024-04-11 18:43:36 UTC
Permalink
Post by azigni
snipped...
But can I use a single swap for both? snipped...
I used to use a single swap for two different distros on my hd. I ran into
various problems with display, etc as the swap held info from the not
being used distro that would get used by the running distro..
Once I started using a separate swap for each partition, the hassle it
saved was worth the little disk space they took up.
Isn't there a function to zero out the swap, at shutdown time ?

That's for privacy/security reasons normally.

It may not be switched on by default (it could be a poor
choice for an SSD with a huge swap loaded onto it).

On my desktops, I'm not normally set up for sleep or hibernate,
and so my swap is a 1GB sized one.

Paul
Big Al
2024-04-11 19:28:22 UTC
Permalink
Post by Big Al
I currently only have one Linux install.
I would like to install a 2nd and have a chunk of space I can use.
The current Linux has a swap partition.  When I started the install of the 2nd Linux it wanted to
use the swap partition from the first Linux.   If I created a 2nd swap and assigned it to this 2nd
Linux, I get 2 swaps.   This isn't a killer as I can just edit the fstab after boot and remove the
extra, or at least it seems that easy.
But can I use a single swap for both?   It would be simpler.  My assumption is that swap is only
used while the system is running.  Once shutdown, it's open game for the other OS.??
Well, not solved but I'm giving it up for now.
I wanted to dual boot LMDE6 but it won't install... and I don't want to pursue this issue now.
As much as all this info is educational, it may get used later.
--
Linux Mint 21.3 Cinnamon 6.0.4 Kernel 5.15.0-102-generic
Al
Jack Strangio
2024-04-12 06:21:49 UTC
Permalink
Post by Big Al
But can I use a single swap for both?
Certainly you can use the same swap for as many distros on the same hard
drive as you want. Once upon a time you have needed to ask this question as
all distros would have been pointed to the same partition on installation.

But these days we use UUIDs to specify partitions , not /dev numbers. It's
just a matter of editing your /etc/fstab file to point to a /dev/sdXX
partition name instaed of using the latest UUID name for the partition.

So edit your /etc/fstab file. You will see something like this:

# swap was on /dev/nvme0n1p8 during installation
UUID=f1dd86d2-e1f6-42a9-89a1-3a2eed594309 none swap sw 0 0


So you just change that UUID=f1dd86d2-e1f.... field back to the installation
/dev format field as told to you on the line above: /dev/nvme0n1p8


/dev/nvme0n1p8 none swap sw 0 0


Do that for all of your distros (I always have 3 root partitions) and
they'll all use that same swap partition.

Regards,

Jack
--
Try to look unimportant - the enemy may be low on ammo :- Murphy's Laws of Combat Ops
Loading...