Linux 5.7.2 swapfile 无法挂载的解决方案
如题
1 | [FAILED] Failed to activate swap /swapfile. |
开机时报错如上, 开机之后交换文件无法正确被挂载.
在Arch Linux论坛上找到了解决方案如下:
SOLVED: Swap not working with Kernel 5.7.2
这个问题仅出现在ext4
文件系统下的 Linux 5.7.2
上, 使用fallocate
创建的swap交换文件.
Arch Linux Wiki的解释如下:
Note: dynamic space allocation such as using
fallocate
is not supported, as it causes problems with some file systems such as F2FS[1] and will likely fail to activate at boot time with error “swapon: swapfile has holes“ as of kernel 5.7. Hence, contiguous allocation, such asdd
, is the only reliable way to allocate a swap file.[2]
因此删掉原有的swapfile
, 用dd
重新分配即可.
1 | sudo dd if=/dev/zero of=/swapfile bs=1M count=4096 status=progress |
- 本文标题:Linux 5.7.2 swapfile 无法挂载的解决方案
- 本文作者:Reverier Xu
- 本文链接:https://www.wootec.top/2020/06/12/Linux5.7swapfailed/
- 版权声明:本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明出处!