Привет всем!
Решил поапгрейдиться, поставил RAM 8 гб вместо 4 и подумалось, что swap-раздел на диске теперь будет мал для 8 Гб

Раньше приходилось много раз иметь дело со swap'ом, поэтому сомнений не возникло, ведь я всегда смогу его подключить/отключить/изменить - и смело удалил из fstab всё что касалось swap. На этот раз я решил его сделать в виде файла, а не раздела, поскольку он нужен для подстраховки, на случай переполнения памяти, чтобы не потерять данные.
Установил
swapspace. В /etc/swapspace.conf всё прописал так, чтобы сделать работу подкачки более заметной, понаблюдать, как она будет работать и затем изменить параметры на минимальные, при которых она начнёт работать только в случае заполнения памяти до 90%, например.
Начал вот с этого конфига
/etc/swapspace.conf
# This file is part of Swapspace.
#
# Swapspace is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Swapspace is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with swapspace; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
# Swap path: location where swapspace may create and delete swapfiles. For
# security reasons this directory must be accessible to root and to root only.
swappath="/home/igor/swapdir"
# Lower free-space threshold: if the percentage of free space drops below this
# number, additional swapspace is allocated
lower_freelimit=60
#было 20
# Upper free-space threshold: if the percentage of free space exceeds this
# number, swapspace will attempt to free up swapspace
upper_freelimit=90
#Было 60
# Percentage of free space swapspace should aim for when adding swapspace. This
# should fall somewhere between lower_freelimit and upper_freelimit.
freetarget=65
#было 30
# Smallest allowed size for individual swapfiles
min_swapsize=4m
# Greatest allowed size for individual swapfiles
max_swapsize=2t
# Duration (roughly in seconds) of the moratorium on swap allocation that is
# instated if disk space runs out, or the cooldown time after a new swapfile is
# successfully allocated before swapspace will consider deallocating swap space
# again. The default cooldown period is about 10 minutes.
cooldown=600
Нужно сказать, что файлы подкачки соответствующего размера создаются
swapon -s
Filename Type Size Used Priority
/home/igor/swapdir/1 file 2321248 0 -1
/home/igor/swapdir/2 file 1486880 0 -2
/home/igor/swapdir/3 file 1713988 0 -3
/home/igor/swapdir/4 file 1960472 0 -4
/home/igor/swapdir/5 file 2241076 0 -5
но, как видно, не используются
То же самое было и до этого, когда я размещал подкачку на отдельном разделе диска: раздел есть, подключен, но не работает ни при какой загруженности памяти.
cat /proc/sys/vm/swappiness
60
Как же заставить подкачку работать?
В английском инете попадалась инфа о каком-то баге, из-за которого подкачка с шифрованием может не работать...