我有 SSD。当我检查时dmesg
,我看到警告并失败:
$ sudo dmesg | grep swap
[ 0.085887] Spectre V1 : Mitigation: usercopy/swapgs barriers and __user pointer sanitization
[ 0.429424] zswap: loaded using pool lzo/zbud
[ 35.685791] systemd[1]: Activating swap /swapfile...
[ 35.690098] BTRFS warning (device nvme0n1p4): swapfile must not be copy-on-write
[ 35.691545] systemd[1]: swapfile.swap: Swap process exited, code=exited, status=255/EXCEPTION
[ 35.691549] systemd[1]: swapfile.swap: Failed with result 'exit-code'.
[ 35.691934] systemd[1]: Failed to activate swap /swapfile.
[ 35.691969] systemd[1]: swap.target: Job swap.target/start failed with result 'dependency'.
[ 36.112620] BTRFS warning (device nvme0n1p4): swapfile must not be copy-on-write
[ 36.326045] BTRFS warning (device nvme0n1p4): swapfile must not be copy-on-write
如果我禁用交换,为什么系统会尝试激活交换?
$ cat /etc/fstab | grep swap
/swapfile none swap sw 0 0
答案1
要真正禁用交换文件,我们应该这样做:
在 shell 提示符下以 root 身份执行以下命令以禁用交换文件(其中 /swapfile 是交换文件):
swapoff -v /swapfile
从 /etc/fstab 文件中删除其条目。
删除实际文件:
rm /swapfile