WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: swapfile on boot / settings  (Read 2639 times)

Offline windundgeist

  • Jr. Member
  • **
  • Posts: 55
swapfile on boot / settings
« on: May 28, 2021, 02:19:03 PM »
Hi

I could create a swapfile with the swapfile-tool. It is /mnt/sda4/tc.swp. I saw, that it is already activ. Means mkswap and swapon is done by the tool?

Now I would like to make it permanent on boot. Normaly this is in /etc/fstab with:

Code: [Select]
swapfile none swap defaults 0 0

Looks to me, as these is not ok for TC. What line I need to add?

Here my fstab:

Code: [Select]
proc            /proc        proc    defaults          0       0
sysfs           /sys         sysfs   defaults          0       0
devpts          /dev/pts     devpts  defaults          0       0
tmpfs           /dev/shm     tmpfs   defaults          0       0
/dev/zram0  swap         swap    defaults,noauto   0       0
/dev/sda4       /mnt/sda4       ext4     noauto,users,exec    0 0 # Added by TC
/dev/sda2       /mnt/sda2       ext4     noauto,users,exec    0 0 # Added by TC
/dev/sda3       /mnt/sda3       ext4     noauto,users,exec    0 0 # Added by TC
/dev/sda1       /mnt/sda1       ext4     noauto,users,exec    0 0 # Added by TC
/dev/sr0        /mnt/sr0        auto     noauto,users,exec    0 0 # Added by TC

Then I like to set the swapiness. This is normally in /etc/sysctl.conf .  But I can not find this file at this location.

So can you help me to do the right thing whit this in TC, please?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11704
Re: swapfile on boot / settings
« Reply #1 on: May 28, 2021, 03:51:36 PM »
Hi windundgeist
... Now I would like to make it permanent on boot. ...
Try adding this boot code:
Code: [Select]
swapfile=sda4
Quote
... Then I like to set the swapiness. ...
You can use  sysctl  to view and change kernel parameters:
Code: [Select]
tc@E310:~$ sudo sysctl vm.swappiness
vm.swappiness = 60
tc@E310:~$ sudo sysctl -w vm.swappiness=70
vm.swappiness = 70
tc@E310:~$ sudo sysctl vm.swappiness
vm.swappiness = 70

Offline windundgeist

  • Jr. Member
  • **
  • Posts: 55
Re: swapfile on boot / settings
« Reply #2 on: May 28, 2021, 06:41:02 PM »
@Rich

Boot code is working fine :) Tested some different swapiness with Vivaldi. But have better results on antiX with Opera. So I need Opera. Another "project" :) In antiX with swapiness 30-40 I can open 8 fb tabs and still go on working. I think with TC this will be even better.

Still don't found the right file to set swapiness permanent. sysctl.conf is not in etc. Is there another file? Or needs it also a boot code? Default is 60 I saw. But it is to high for my situation with hardware and my way to act in browsing.

Ok, tomorrow is another day :)

have a good night, Rich

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11704
Re: swapfile on boot / settings
« Reply #3 on: May 28, 2021, 08:09:11 PM »
Hi windundgeist
You could just add this to  /opt/bootlocal.sh:
Code: [Select]
sysctl -w vm.swappiness=30Since  /opt/bootlocal.sh  gets launched by root, it does not require  sudo.

Offline windundgeist

  • Jr. Member
  • **
  • Posts: 55
Re: swapfile on boot / settings
« Reply #4 on: May 29, 2021, 01:58:17 PM »
@Rich

Thank you, works fine. I was thinking that I could just create a sysctl.conf in /etc, if there is no. But then I found your answer first.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11704
Re: swapfile on boot / settings
« Reply #5 on: May 29, 2021, 02:09:21 PM »
Hi windundgeist
You could do that. Then you also have to add that file to your backup. Then you need to add  sysctl -p  to  bootlocal.sh.
« Last Edit: June 22, 2021, 08:18:36 PM by Rich »

Offline windundgeist

  • Jr. Member
  • **
  • Posts: 55
Re: swapfile on boot / settings
« Reply #6 on: May 29, 2021, 02:17:53 PM »
Ok, so I will let is how it is in  bootlocal.sh  ;D