swapspace
我已经使用了所有的交换空间(由 Rust 编译器使用),虽然我已经安装了包,但交换空间并没有增大。
total used free shared buff/cache available
Mem: 15Gi 12Gi 2.4Gi 1.8Gi 2.5Gi 2.6Gi
Swap: 2.0Gi 2.0Gi 0B
稍后再谈:
$ swapon
NAME TYPE SIZE USED PRIO
/dev/nvme0n1p2 partition 2G 2G -2
如何使文件交换功能起作用?我需要编辑吗/etc/swapspace.conf
?
/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="/var/lib/swapspace"
# Lower free-space threshold: if the percentage of free space drops below this
# number, additional swapspace is allocated
#lower_freelimit=20
# Upper free-space threshold: if the percentage of free space exceeds this
# number, swapspace will attempt to free up swapspace
#upper_freelimit=60
# Percentage of free space swapspace should aim for when adding swapspace. This
# should fall somewhere between lower_freelimit and upper_freelimit.
#freetarget=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
还:
$ systemctl status swapspace.service
● swapspace.service - Swapspace, a dynamic swap space manager
Loaded: loaded (/lib/systemd/system/swapspace.service; enabled; preset: enabled)
Active: active (running) since Sat 2024-04-06 12:25:27 IDT; 1 week 2 days ago
Docs: man:swapspace(8)
Main PID: 5007 (swapspace)
Tasks: 1 (limit: 18672)
Memory: 696.0K
CPU: 56min 53.175s
CGroup: /system.slice/swapspace.service
└─5007 /usr/sbin/swapspace
Apr 15 22:57:50 victor swapspace[5007]: Error: Could not enable swapfile '1': Invalid argument
Apr 16 07:54:11 victor swapspace[2805427]: Setting up swapspace version 1, size = 6.6 GiB (7115493376 bytes)
Apr 16 07:54:11 victor swapspace[2805427]: no label, UUID=e4971b48-a25a-48bd-bba4-c612569f996a
Apr 16 07:54:11 victor swapspace[5007]: Error: Could not enable swapfile '1': Invalid argument
Apr 16 08:04:19 victor swapspace[2920343]: Setting up swapspace version 1, size = 6.1 GiB (6517428224 bytes)
Apr 16 08:04:19 victor swapspace[2920343]: no label, UUID=5e0ae6b7-9715-4882-8cda-51707e96fbaa
Apr 16 08:04:19 victor swapspace[5007]: Error: Could not enable swapfile '1': Invalid argument
Apr 16 08:14:26 victor swapspace[2939298]: Setting up swapspace version 1, size = 6.1 GiB (6539935744 bytes)
Apr 16 08:14:26 victor swapspace[2939298]: no label, UUID=1ba42fae-6106-450e-9d96-3cdc040c84c6
Apr 16 08:14:26 victor swapspace[5007]: Error: Could not enable swapfile '1': Invalid argument
答案1
显然,OpenZFS 目前不支持交换文件,如此错误报告。
通过从 ZFS 切换到 btrfs 解决了该问题。