Fedora 32 small swap problem

I have just installed a clean install of Fedora32 and I let it automaticaly resize my 160GB HD as the interface to set it up yourself had changed and repeatably came back with errors - Now, I have a 3gb Swap partition that Pages furiously most of the time and on occasion, just locks up my PC ( I have 4gb Ram BTW ) - The install also created an 80Gb HOME partition which I do not need as I keep all data on a separate HDD
I tried creating a Swapfile and using SWAPON but it repeatable come back with syntax errors when I try to activate it by using sudo swapon /swapfile …(swapfile was created in root and permissions changed to 600
SO…Please… I ask, Can anyone explain to me PLEASE how to reduce the 80Gb HOME partition by 30Gb and to then use that 30 as a new Swap partition…
Can I do this in DISKS with out destroying everything there ?
Has the SWAPON command changed in anyway ?

1 Like

Seldomly have I encountered the same error when I swapon my swapfile. I guess there must be something wrong, and we have little chance to help if you won’t post your console content.

But if you are interested in reducing the HOME partition by 30GB with a swapfile, which is also my recommended solution rather than repartitioning your HOME, you can refer to Swap - ArchWiki

Just create a swapfile in your HOME partition. swapon it.

1 Like

/ 100% fill /dev/mapper/fedora-root - #13 by vgaetera

Not really, it works for me:
Fedora Docs > Creating a Swap File

3 Likes

Thanks for taking the time to reply…am about to try a swapfile in HOMe again…

1 Like

So…tried it again ini HOME and got the same result…below is the output from terminal

$ sudo fallocate -l 30G /home/swapfile
sudo chmod 600 /home/swapfile
$ sudo mkswap /home/swapfile
Setting up swapspace version 1, size = 30 GiB (32212250624 bytes)
no label, UUID=3c336cd5-****************************
$ sudo swapon /home/swapfile
swapon: /home/swapfile: swapon failed: Invalid argument

right back wher eI began before
this is the same error I had when I tried to make the swapfile in root
any ideas ?

please follow the steps in Swap - ArchWiki

By the way, fallocate is considered not qualified for creating swapfile by tolerating the holes in the file. You can refer to this link: problem with fallocate creating swapfile

All in all, there are some factors you should mind to achieve your goal:

  • Filesystem type of your home partition
  • The utility you use to create the swapfile
  • The permissions of the swapfile

By the way, configuring the system with huge disk swap size and high vm.swappiness value may have very negative impact on responsiveness.

3 Likes

This looks like overkill, you’d best follow recommendations listed in the Fedora documentation.

3 Likes

Thanks for your reply - is 30Gb considered to large ?
I currently have just 3.5 gb ( allocated by Auto set up on install ) - I often run Video and Hi data intensive apps Via Web or localy…and already on one occasion, the computer jsut locked up, paging like mad fro hours…YES…It just kept cycling through paging by the looks of it… I Had to power down…it was the only way to stop it…no logs were written.
Thanks fo ryour Time :wink:

1 Like

Yes, it’s typically a waste of space.
Follow the link posted above to choose the proper swap size.

2 Likes

As ever THANK YOU
All working now…May your Socks Never Get soggy

3 Likes

I’m sure these guidelines are great for servers, but for desktops we now recommend no swap partition or swap file. If you want to maintain system responsiveness, you need to let earlyoom kill processes that use too much memory before throttling begins, and earlyoom will not do that until swap is filled. So the larger you create your swap partition, the worse your throttling is going to be.

Fedora 33 defaults to swap only on zram. With 4 GB RAM, you should see 2 GB normal ram plus 2 GB zram swap.

3 Likes

I hope we can see those recommendations officially updated and documented for Fedora 33.

https://fedoraproject.org/wiki/Changes/SwapOnZRAM

Also worth reading:

Swap is primarily a mechanism for equality of reclamation, not for emergency “extra memory”. Swap is not what makes your application slow – entering overall memory contention is what makes your application slow.

So that’s why swap won’t be huge in size, but we still need one.

1 Like

Wikipedia article on tmpfs says:

Everything stored in tmpfs is temporary in the sense that no files will be directly created on non-volatile storage such as a hard drive (although swap space is used as backing store in case of low memory situations).

Will that still be true for Fedora 33?

If I create a huge file in /tmp I’d rather that affect space I allocated for swap (on disk) than my RAM.

You can put /tmp on a physical device. Simply create the partition, format it, and put it into fstab to be mounted at boot time.

1 Like

Not for fresh installs with default settings, because there will be no more swap on disk.

You’ll want to either create some disk-based swap, or put /tmp on disk. That said, applications should never create large files under /tmp. They should use /var/tmp for large files.

2 Likes

Thanks @computersavvy and @mcatanzaro.

So I think what I’ll do is create a 2nd swap that is disk-based.

Custom/Advance partitioning installer behavior
The user can add swap using Custom partitioning at install time. This is swap-on-drive. […]
Since swap-on-zram is still enabled by default, there will be two swaps: swap-on-zram, and swap-on-drive. The swap-on-zram will have higher priority, thus being favored over drive based swap.
Changes/SwapOnZRAM - Fedora Project Wiki

I’ll make it encrypted.

I’ll trust that the kernel is smart enough to use the swap-on-drive to back the tmpfs filesystems, not my swapon-zram.

And thanks for the tip re using /var/tmp for large temporary files. I was unaware of that directory.