[Share Experiences] btrfs从6.1版本开始简化了swapfile创建方法
Tofloor
poster avatar
neko
deepin
Ecological co-builder
Q&A Team
2025-05-17 13:17
Author
旧方法:
truncate -s 0 swapfile 
chattr +C swapfile
fallocate -1 2G swapfile
chmod 0600 swapfile
mkswap swapfile
swapon swapfile #启用SWAP 

新方法: 
btrfs filesystem mkswapfile --size 2G swapfile
swapon swapfile #启用SWAP

参考文档:https://btrfs.readthedocs.io/en/latest/Swapfile.html

PS:

在给飞牛OS的btrfs数据卷里创建swapfile死活启用不了,extent文件不连续(btrfs要求swap的extent只有1)。
最后发现新方法果然好使了。

Reply Favorite View the author
All Replies
tacat
deepin
2025-05-17 15:30
#1

新方法方便了很多

btrfs yes

帮我节省了大量的重装系统时间like

Reply View the author
璀璨星空
deepin
2025-05-18 21:47
#2
tacat

新方法方便了很多

btrfs yes

帮我节省了大量的重装系统时间like

doubt

Reply View the author