linux hibernate on swap file

本文档详细介绍了如何在 Arch Linux 上安装并配置 USwsusp 工具来实现系统的深度睡眠功能。步骤包括:安装 USwsusp,创建交换文件,配置 suspend.conf 文件,设置内核参数等。

https://wiki.archlinux.org/index.php/Uswsusp

Step A:

install https://aur.archlinux.org/packages/us/uswsusp-git/uswsusp-git.tar.gz

tar zxf uswsusp-git.tar.gz

makepkg

pacman -U uswsusp-git-xxxx-1-x86_64.pkg.tar.xz

em /etc/suspend.conf

like this:

snapshot device = /dev/snapshot
resume device = /dev/sda5
resume offset = 123456                                          <----# swap-offset <swap_file_path>
shutdown method = platform
compress = y



Step B:

1) Create the swap file and make it active, eg.

# dd if=/dev/zero of=<swap_file_path> bs=1024 count=<swap_file_size_in_k>

# mkswap <swap_file_path>

# swapon <swap_file_path>

 2) Use an application that will bmap the swap file with the help of the

 FIBMAP ioctl and determine the location of the file's swap header, as the

 offset, in <PAGE_SIZE> units, from the beginning of the partition which

 holds the swap file.

# swap-offset <swap_file_path>

next line maybe useless

 3) Add the following parameters to the kernel command line:

 resume=<swap_file_partition> resume_offset=<swap_file_offset>


Step C:

s2disk


评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值