vhp1360
December 31, 2023, 5:51am
1
Hello to all.
I tried to add a new swap partition by these steps:
dd if=/dev/zero of=/swap bs=1M count 18000
chmod 600 /swap
mkswap /swap
echo /swap none swap sw 0 0' >> /etc/fstab
but mount -a of reboot wouldn’t up new swap partition.
do I need any selinux possily?
what should I do?
iwalker
December 31, 2023, 1:33pm
2
You can do:
swapon /swap
if seliux is causing a problem, you can check with:
audit2allow -a /var/log/audit/audit.log
alternatively, do:
setenforce 0
swapon /swap
and see if the swap is active. If any errors, post them in the thread here. Usually when I do swap like you I just do:
fallocate -l 4G /swap
chmod 600 /swap
mkswap /swap
swapon /swap
Swap isn’t mounted like regular filesystems, and the “mount” command doesn’t affect it. You need to run “swapon -a” to activate all known swap partitions and files, “swapon -av” to observe it in action.
hello and thanks.
so, you meant I couldn’t test it with ‘mount -a’ and couldn’t see the result of new ‘/etc/fstab’ unless reboot?
You can mount all the swap partitions in fstab with
swapon -a
virer
January 5, 2024, 12:16pm
6
Hi,
“mount -a” will only mount all “normal” filesystem, swap is not a “normal” one I would say :).
And as other already says, “swapon -a” will “mount” every swap partition mentioned/configured in /etc/fstab
You can see the swap current size and usage using “free -m | grep Swap” for example.
Or using “top” command.
system
Closed
March 5, 2024, 12:17pm
7
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.