Both swapon -show
and cat /proc/swaps
report that I have a swap of size 1003516 and no unit is given. At first I assumed that this was bytes, giving me about 1 megabyte. However, free -mh
reports that I have nearly 1 gigabyte. This has made me suspicious of the units in use. Does swapon -show
give results in something other than bytes?
-
stackoverflow.com/questions/38987060/…– spikey_richieMar 11, 2020 at 17:17
1 Answer
Note swapon -show
is swapon -s -h -o -w
and it seems it's just swapon -s
. You probably wanted swapon --show
.
In my Kubuntu swapon --show
shows 16.5G
which is ambiguous (rounding; is G
for gigabyte or gibibyte?), but there's also unambiguous swapon --show --bytes
(which I used to tell this 16.5G
was actually in gibibytes).
cat /proc/swaps
should be more predictable (and swapon -s
should be equivalent to cat /proc/swaps
, but -s
is deprecated in favor of --show
). While some sources I found use the word "kilobytes" to describe /proc/swaps
, on every machine I own it's actually in kibibytes, 1024-byte units.