Problems during swapfile creation on a low spec laptop

Hopefully this will help others.

As per:

I wanted to increase the size of the swap file.

Every time I submitted this command in terminal:

sudo dd if=/dev/zero of=/swapfile bs=1G count=8

the terminal app crashed, and no swap file was created.

Looking at the journal with

journalctl --since <timestamp>

I found the reason:

oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/user.slice/user-1000.slice/user@1000.service/app.slice/app-org.kde.konsole@31d13f64a4394511a13cf05cb2f5f687.service,task=dd,pid=2282,uid=0
aug 16 08:42:04 EOS001 kernel: Out of memory: Killed process 2282 (dd) total-vm:1054496kB, anon-rss:1048680kB, file-rss:528kB, shmem-rss:0kB, UID:0 pgtables:2108kB oom_score_adj:200

In short: the laptop is very low spec and did not even have enough memory to run the process to create the swap file. :astonished:

Solution was: close all apps leaving only terminal running, then submit the command

sudo dd if=/dev/zero of=/swapfile bs=1G count=8

Then no crash occurred and the swapfile was created:

               total        used        free      shared  buff/cache   available
Mem:           3,7Gi       2,5Gi       188Mi       796Mi       2,1Gi       1,3Gi
Swap:          8,0Gi       1,0Gi       7,0Gi

And i swapped happily ever after.

Hope this may help others.

I’ll mark this as solved:

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