Skip to main content
Topic: Problems with making a swap file (Read 802 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Problems with making a swap file

Hello,
I wanted to make a swapfile, but I have run into a problem with it.

Here is my shell "log":
Code: [Select]
[host /]# fallocate -l 2G /swapfile
[host /]# chmod 600 swapfile
[host /]# mkswap /swapfile
Setting up swapspace version 1, size = 2 GiB (2147479552 bytes)
no label, UUID=e19bca21-75ec-428a-b3f8-8dd847b2a76a
[host /]# swapon -v /swapfile
swapon: /swapfile: found signature [pagesize=4096, signature=swap]
swapon: /swapfile: pagesize=4096, swapsize=2147483648, devsize=2147483648
swapon /swapfile
swapon: /swapfile: swapon failed: Invalid argument
[host /]# swapon -a
[host /]# swapon --show
[host /]# free
               total        used        free      shared  buff/cache   available
Mem:        16066972     5558368     5481120     1800276     7168064    10508604
Swap:              0           0           0

Do any of you know why this is happening?


Re: Problems with making a swap file

Reply #2
lsblk -f
?
if ready  as file /swap on doing:

swapon --show

then
$ faalocate -l 4 GB /swap

$ sudo mkswap /swap