Partitions and SWAP in Tumbleweed

I was installing TW automatic, but I’ve noticed also a guided install. You can choose LVM, but I don’t know much about the advantages, so I dind’t. Instead I’ve choosed a separate partition for /home and also a much encreased SWAP partition. But I’d like some explenations, because I like to understand.

  1. Some distros - like Ubuntu - don’t have a separated SWAP partition. Is it ok? And also why having a SWAP partition on a SSD?
  2. TW need a bigger SWAP partition? I admit that things are going much better with a bigger SWAP partition. No delays, no more freezing. Is there an explanation?
  3. A separated partition for /home it’s a good idea or it makes no difference?
  4. LVM is a good ideea for Tumbleweed? Should I expand th SWAP partition if things go wrong, like slow performance or freezing?
  1. Having a swap space (separate partition or an equivalent means like zswap in RAM for instance) allows the kernel to manage memory allocation more efficiently. With an SSD the possible use of the swap space is faster, but if you are systematically swapping content in and out of the swap your system likely needs more RAM.
  2. TW does not need a swap bigger than usual. What “usual” means depends on your use case.
  3. A separate /home partition is always a good idea. If your system gets corrupt, you have the chance of reinstalling reusing the /home partition with no loss of user data.
  4. I cannot comment on LVM. If you experience slow performance or freezing it is unlikely that expanding the swap alone can solve your problems.
1 Like

I agree with you OrsoBruno, although I don’t see much use in having the HOME separated with BTRFS filesystem given that recovery snapshots exist.

On having a swap: I did have one but still the system did still have freezing when I was running out of memory.

So instead of that I added memory I did add memory and installed earlyoom, that is as easy as executing “sudo zypper install earlyoom”. If there is a specific application that is essential to you it would be good to tell earlyoom that so that it is killed last.

BTRFS going nuts is still a possibility, especially when installed by a novice user not familiar with it and/or without regular maintenance…

Experienced users tend to have /home on a separate partition, as it makes it easy to reinstall your system without loosing any setting. But there are also other users which want to setup a system from scratch, or have backups from home, or do not care at all of loosing settings.

It depends on the use case of the system, user experience, filesystem, and many more variables…

2 Likes

This is what I do. The / is BTRFS, and /home is separate using XFS. I do backups weekly (using rsync), but only for /home.

If something goes catastrophic with BTRFS, and is not recoverable, I simply reinstall.

And we should not forget that BTRFS snapshots are not a substitute for a proper backup. If the drive fails they will be lost along with the system.
That’s why for some of my machines I even prefer to keep /home on a different drive rather than just a partition. It may be old school paranoia, however. :wink:

My swap is on a rotating disk. Working on heavy stuffs as I observed really needs a big swap partition when ram is not enough. I observed it in blender before the rendering switches to gpu the ram sometimes is struggling and lots have been building up on swap.

Just to clarify btrfs snapshots and /home
/home is not included in snapshots by default, as well as several other directories.

Also, backing up /home, whether on a separate partiton or not, doesn’t require anything different regardless of the file system.

I have never had a btrfs corruption situation. Also, I have never had a separate /home partition survive a disk failure, so that backups are essential. I will admit to using a separate /home partition years ago as quite often upgrades were prone to failures and a new install was thus simplified.

As for your other questions:

  1. Using a partition for swap rather than a file offers the advantage of improved performance because of being contiguous. I have used both types, but I also have bought as much ram as I could afford so it has never been noticable.
  2. TW doesn’t require any more ram than any other installation. It is the number and type of apps that you run that will determine the optimum swap size. Google (or equivalent) is your friend.
  3. Covered above.
  4. In my opinion, just go for the default install.

To check your swap usage:

dos@DOS1:~> grep '^Swap' /proc/meminfo
SwapCached:       120020 kB
SwapTotal:       2097856 kB
SwapFree:        1594920 kB
dos@DOS1:~> free
               total        used        free      shared  buff/cache   available
Mem:        65749408    18341440     1217524      156032    47047096    47407968
Swap:        2097856      502936     1594920
dos@DOS1:~> sudo swapon -s
[sudo] password for root: 
Filename                                Type            Size            Used            Priority
/dev/nvme0n1p3                          partition       2097856         465344          -2

@doscott I would suggest reducing vm.swappiness and vm.vfs_cache_pressure sysctl values, or like me if not suspending or hibernating, disable. Systems shouldn’t need swap above 32GB, MicroOS has none and I run that (Aeon) on a 4GB Tablet without problems…

Thank you for the advice. This is a desktop so I will see what happens with disabling.

@doscott then make sure to set vm.swappiness=0 then :wink: There are numerous tuning entries you can play with…

Ref: https://docs.kernel.org/admin-guide/sysctl/index.html

Thanks again. I am going to show what I did for anyone else that reads this:

sudo nano /etc/sysctl.conf
append (or edit if already there)

vm.swappiness = 0

Save the changes. To skip an immediate reboot
sudo sysctl vm.swappiness=0

In searching for where to make the changes I found the following which discusses the topic.

My apologies to @valc_2024 for the partial hijack.

@doscott best to create a conf file in /etc/sysctl.d as that file can be overwritten on an update

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.