ubuntu 待机休眠



默认命令行待机命令:pm-suspend
休眠:pm-hibernate

详见:man pm-suspend
man pm-hibernate


      pm-suspend
           During suspend most devices are shutdown, and system state is
           saved in RAM. The system still requires power in this state.
           Most modern systems require 3 to 5 seconds to enter and leave
           suspend, and most laptops can stay in suspend mode for 1 to 3
           days before exhausting their battery.

       pm-hibernate
           During hibernate the system is fully powered off, and system
           state is saved to disk. The system does not require power, and
           can stay in hibernate mode indefinitely. Most modern systems
           require 15 to 45 seconds to enter and leave hibernate, and
           entering and leaving hibernate takes longer when you have more
           memory.

       pm-suspend-hybrid
           Hybrid-suspend is the process where the system does everything
           it needs to hibernate, but suspends instead of shutting down.
           This means that your computer can wake up quicker than for
           normal hibernation if you do not run out of power, and you can
           resume even if you run out of power. s2both(8) is an
          
 hybrid-suspend implementation.


### 如何配置 Ubuntu 系统中的硬盘休眠功能 #### 设置交换空间 为了确保能够正常进入休眠模式,需要确认交换分区的大小超过系统内存容量。这能保障当系统休眠时有足够的存储空间来保存当前状态数据[^4]。 对于调整或创建新的swap文件可以按照如下操作: ```bash sudo fallocate -l 16G /swapfile # 创建一个16GB的swap文件 sudo chmod 600 /swapfile # 修改权限使只有root可读写 sudo mkswap /swapfile # 将该文件标记为swap空间 sudo swapon /swapfile # 启用新创建的swap文件 echo '/swapfile none swap defaults 0 0' | sudo tee -a /etc/fstab # 添加到fstab开机自动挂载 ``` #### 编辑 GRUB 参数支持休眠选项 编辑 `/etc/default/grub` 文件,在 `GRUB_CMDLINE_LINUX_DEFAULT` 行追加参数 `"mem_sleep_default=deep"` 和其他必要的内核命令行参数以允许操作系统识别并处理更深程度上的电源管理特性[^3]。 更新 grub 配置使之生效: ```bash sudo update-grab ``` #### 调整 Power Management 设置 通过图形界面或者终端命令修改功耗设定让磁盘能够在一段时间闲置后转入待机(stanby)模式。可以通过安装 `gnome-tweaks` 或者直接编辑 dconf 数据库来进行更细致化的调节[^1]: ```bash gsettings set org.gnome.settings-daemon.plugins.power disk-idle-delay uint32 900 # 设定900秒即15分钟后触发 ``` 另外需要注意的是,某些情况下SSH连接可能会激活处于standby state下的HDD设备,为了避免这种情况发生可能还需要进一步定制服务端行为或是禁用不必要的后台进程[^2].
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值