Do i need swap?

Can I use swap partition and systemd-swap together ?

To quote from the arch wiki link given earlier in this thread:

In order for systemd_swap to be effective you need to remove any traditional swap devices you have.

2 Likes

Oh thanks, I missed thatā€¦so to be sure, while installation, for swap partition I need to choose none ? And when installation is finished, only use systemd-swap ? Thanks

Hi, I just installed fresh KDE on my laptop.

I wanted to try setup systemd-swap but I stucked on step : creating a file /etc/systemd/swap.conf.d/myswap.conf

How to do that ? In Dolphin I can not open etc folder as root ?thx

Itā€™s all described in the wiki:

sudo bash -c 'echo -e "zswap_enabled=0\nzram_enabled=0\nswapfc_enabled=1" > /etc/systemd/swap.conf.d/myswap.conf'

https://wiki.manjaro.org/index.php?title=Swap

2 Likes

Yes, I tried that and got this :slight_smile:
[marko@marko-hpenvy ~]$ sudo bash -c ā€˜echo -e ā€œzswap_enabled=0\nzram_enabled=0\nswapfc_enabled=1ā€ > /etc/systemd/swap.conf.d/myswap.confā€™
[sudo] password for marko:
bash: /etc/systemd/swap.conf.d/myswap.conf: No such file or directory

Try

echo -e "zswap_enabled=0\nzram_enabled=0\nswapfc_enabled=1" | sudo tee /etc/systemd/swap.conf.d/myswap.conf

If this is also not working you first need to create the missing directory /etc/systemd/swap.conf.d.

1 Like

Yeah, I figured thatā€¦ But In dolphin can not because no root in folder. In xfce I used option Thunar root. How to do that in Dolphin (KDE) ?

Use a terminal window and enter

cd /etc/systemd
sudo mkdir swap.conf.d
1 Like

Thanksā€¦ got it now :slight_smile: how to check if it is working ?
I tried to use command swapon, but nothing showed

Use

systemctl status systemd-swap.service
1 Like

Watching this , I will say it is working :slight_smile: `

[marko@marko-hpenvy ~]$ systemctl status systemd-swap.service
ā— systemd-swap.service - Manage swap spaces on zram, files and partitions.
Loaded: loaded (/usr/lib/systemd/system/systemd-swap.service; enabled;>
Active: active (running) since Sat 2020-08-29 22:27:27 CEST; 31min ago
Main PID: 482 (systemd-swap)
Status: ā€œMonitoring memory statusā€¦ā€
Tasks: 1 (limit: 6958)
Memory: 15.8M
CGroup: /system.slice/systemd-swap.service
ā””ā”€482 /usr/bin/python3 -u /usr/bin/systemd-swap start

kol 29 22:27:26 marko-hpenvy systemd[1]: Starting Manage swap spaces on zra>
kol 29 22:27:27 marko-hpenvy systemd-swap[482]: INFO: Load: /etc/systemd/sw>
kol 29 22:27:27 marko-hpenvy systemd-swap[482]: INFO: Removing working dire>
kol 29 22:27:27 marko-hpenvy systemd-swap[482]: INFO: Removing files in /va>
kol 29 22:27:27 marko-hpenvy systemd-swap[482]: INFO: Load: /etc/systemd/sw>
kol 29 22:27:27 marko-hpenvy systemd-swap[482]: INFO: Writing destroy info.>
kol 29 22:27:27 marko-hpenvy systemd-swap[482]: INFO: swapD: pick up device>
kol 29 22:27:27 marko-hpenvy systemd-swap[482]: INFO: swapD: searching swap>
kol 29 22:27:27 marko-hpenvy systemd-swap[482]: INFO: swapFC: on-demand swa>
kol 29 22:27:27 marko-hpenvy systemd[1]: Started Manage swap spaces on zram>
lines 1-20/20 (END)ā€¦skippingā€¦
ā— systemd-swap.service - Manage swap spaces on zram, files and partitions.
Loaded: loaded (/usr/lib/systemd/system/systemd-swap.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2020-08-29 22:27:27 CEST; 31min ago
Main PID: 482 (systemd-swap)
Status: ā€œMonitoring memory statusā€¦ā€
Tasks: 1 (limit: 6958)
Memory: 15.8M
CGroup: /system.slice/systemd-swap.service
ā””ā”€482 /usr/bin/python3 -u /usr/bin/systemd-swap start

kol 29 22:27:26 marko-hpenvy systemd[1]: Starting Manage swap spaces on zram, files and partitionsā€¦
kol 29 22:27:27 marko-hpenvy systemd-swap[482]: INFO: Load: /etc/systemd/swap.conf.d/myswap.conf
kol 29 22:27:27 marko-hpenvy systemd-swap[482]: INFO: Removing working directoryā€¦
kol 29 22:27:27 marko-hpenvy systemd-swap[482]: INFO: Removing files in /var/lib/systemd-swap/swapfc/ā€¦
kol 29 22:27:27 marko-hpenvy systemd-swap[482]: INFO: Load: /etc/systemd/swap.conf.d/myswap.conf
kol 29 22:27:27 marko-hpenvy systemd-swap[482]: INFO: Writing destroy infoā€¦
kol 29 22:27:27 marko-hpenvy systemd-swap[482]: INFO: swapD: pick up devices from systemd-gpt-auto-generator
kol 29 22:27:27 marko-hpenvy systemd-swap[482]: INFO: swapD: searching swap devices
kol 29 22:27:27 marko-hpenvy systemd-swap[482]: INFO: swapFC: on-demand swap activation at >3822 MiB memory usage
kol 29 22:27:27 marko-hpenvy systemd[1]: Started Manage swap spaces on zram, files and partitions.`

I searched but didnā€™t find a right answerā€¦ what is difference between systems swap and swap file ? Ok both donā€™t need partition.

What is best for you :slight_smile: is up toyou

If you had full disk encryption and the hiber file would be inside, then you can be sure when you hibernate that the memory is stored on the encrypted disk.

If you had a swap partition and the partition would not be encrypted, then after hibernation, all the memory is stored on an unecrypted media.

EDIT: I use swap partition that is almost never used as I have 8Gb ram and never hibernate. But I donā€™t like risking Out of memory situation, Linux behaves kinda bad when that happens. + you can set up encryption with a random generated key specified in fstab and cryptab

1 Like

Atm I used installation with : no swap. I thought to use swap file or systemd-swap,as I read that is basically the sameā€¦

About encryption ,I donā€™t know what I haveā€¦haha

1 Like

Then you can use swapfile, resizing partition and doing all the stuff is extra hard work. :slight_smile:

But when you install next, think through where all your data would be and how it can be lost and abused by naughty thief.

That is why I am asking. I am still on fresh start installation and it is not a problem to do new installation. I want to find out more information so I can keep Manjaro KDE without new installation for a long periodā€¦hehe

Do I need encryption? It is my private laptop.
Also I have 6 gb of Ram which is shared with graphic card

Encryption protects the data from unauthorized access. I would make a difference between encryption of personal data and system encryption.

  1. Is there a person having access to your laptop? Does you have data you want to hide from that person? If yes, encrypt this personal data.
  2. Do you cary your laptop to places others could access it or do you fear what happens to your data if you loose the laptop? If yes, again encrypt your personal data.
  3. Do you have top confidential information on your laptop which if it is getting in wrong hands could cause serious damage? Then, and only then think about a system encryption.
2 Likes

If you trust yourself to net let it get stolen then OK. It has small CPU overhead, but itā€™s so small that itā€™s worth to protect your data.

6Gb shared with GPU is not much.

Hiberfile gives you the ability in certain scenario, delete it easily and use the space if you really need one. Swap partition is a fixed thing that is hard to repurpose.

@freed00m @Wollie thanks guysā€¦Per your question I think I donā€™t need encryptionā€¦too complicated ,heheā€¦ it is needed for me only on my phone.

About swap partition, still donā€™t know which option to use from those three : swap file, systemd-swap or swap partitionā€¦ I think that first two are faster and better ?