Method of enabling Intel rapid start in Linux system


Intel rapid start is a technology developed by Intel to help notebook computers save power and recover quickly. It is different from traditional sleep and hibernate. In comparison, it is similar to hybrid sleep. Intel said that this technology should first be supported by the motherboard, then SSD, and finally windows. But in fact, SSD and windows are not necessary. Yesterday, I successfully used Intel rapid start in the combination of HDD + Linux.

1、 Intel rapid start principle

In fact, the principle of Intel rapid start is very simple, which is to give the computer a chance to enter deep sleep on the basis of traditional sleep. Users can set a timeout through BIOS, such as one minute, ten minutes, half an hour, etc. (you can also set “immediate”). When the computer enters sleep state, the timing starts. If the user wakes up the computer before the timing arrives, Then nothing happens. If the scheduled time is reached, the computer will wake up briefly, write the data in the memory to a specific partition in the hard disk (official document refers to SSD), and then completely power off. After that, the user can only power on by pressing the power key. The motherboard firmware will read the contents of a specific partition back to memory, and then the computer can continue to use.

To sum up, the first half of Intel rapid start technology (IRST) is the same as ordinary sleep, and the second half is similar to hibernate, but hibernation is completed by the operating system, while IRST is completed by the motherboard firmware (BIOS or UEFI). In other words, after power on self-test (post), it is the process of reading content from the hard disk directly, There is no boot loader and operating system loading process at all, so it is much faster than operating system level hibernation. In addition, the application of SSD is even faster. This is what Intel claims as “six second recovery”. According to my understanding, the recovery speed is as fast as sleep, but the power consumption is as low as sleep (zero power consumption).

Intel’s official document mentions that this technology requires SSD + windows, but I don’t see the necessity: SSD is for acceleration. If HDD is used instead, it’s no problem except to slow down. What about windows? What’s exciting is that in June 2013, Linux developer Matthew Garrett submitted onekernel patch , the Linux kernel supports this. The patch has been applied in Linux 3.11, and as of the time of writing this article, the latest Linux kernel version is 3.12.6, which is obviously available.
2、 Adjust partition

My computer is ThinkPad x240s, which has one SATA and two ngff interfaces inside. The latter is a new interface pushed by Intel, which can be used to connect Bluetooth, 3G and other modules, as well as SSD of ngff interface. The most ideal configuration is that SATA interface is used to connect HDD and ngff is used to connect SSD. This version has been configured with Intel rapid start. This version of my SATA interface is connected with a 500GB 7200 RPM mechanical hard disk. One ngff is connected with WiFi + Bluetooth, and the other ngff is empty. In other words, without SSD, Intel rapid start is not necessary by default. But is there no other way except a small and expensive ngff SSD on Taobao? Of course not. Read Intel rapid start’suser ‘s manualIt will be found that the motherboard firmware looks for IRST partitions through partition identifiers. For GPT, it is d3bfe2de-3daf-11df-ba-40-e3a556d89593, and for MBR, it is 0x84.

Before adjustment, my partition structure is as follows:


Copy code

The code is as follows:

sda 8:0 0 465,8G 0 disk
├─sda1 8:1 0 2M 0 part
├─sda2 8:2 0 200M 0 part /boot
├─sda3 8:3 0 50G 0 part
│ └─crypt-sda3 254:0 0 50G 0 crypt /
└──sda4 8:4 0 415,6G 0 part
└─crypt-sda4 254:1 0 415,6G 0 crypt /home

The whole hard disk 465 gib is divided into four areas using GPT. The first 2 gib is used to store grub, then 200 gib is / boot, then 50 gib and /, and the last 415.6 gib is used as / home. Sda3 and sda4 are luks containers. My goal is to adjust sda4 to 400 gib, and then divide the remaining 15.6 gib into sda5 as IRST partition.

Since sda4 is a three-tier nested structure of GPT + luks + ext4, we need to reduce them layer by layer, and then support them to the appropriate position layer by layer.


Copy code

The code is as follows:

#Uninstall / home
umount /home
#You must check the file system before adjusting the file system
e2fsck -f /dev/mapper/crypt-sda4
#Shrink file system to 398 gib
resize2fs -p /dev/mapper/crypt-sda4 398G
#Shrink the luks container to 399 gib
#The block converted to 512 KIB is 399 * 1024 * 1024 * 2 = 836763648
cryptsetup resize crypt-sda4 836763648
#Adjust the sda4 partition to 400 gib
#And use the remaining space to establish sda5
#Enter 8400 for partition identifier when creating
gdisk /dev/sda
#Restart the computer to make the kernel use the new partition table
#Uninstall / home again
umount /home
#Zoom in and the luks container is full sda4
cryptsetup resize crypt-sda4
#Check file system
e2fsck -f /dev/mapper/crypt-sda4
#Zoom in on the file system to fill the luks container
resize2fs -p /dev/mapper/crypt-sda4
#Mount test
mount /dev/mapper/crypt-sda4 /home

After adjustment, this is the effect:


Copy code

The code is as follows:

sda 8:0 0 465,8G 0 disk
├─sda1 8:1 0 2M 0 part
├─sda2 8:2 0 200M 0 part /boot
├─sda3 8:3 0 50G 0 part
│ └─crypt-sda3 254:0 0 50G 0 crypt /
├─sda4 8:4 0 400G 0 part
│ └─crypt-sda4 254:1 0 400G 0 crypt /home
└─sda5 8:5 0 15,6G 0 part

Number Start (sector) End (sector) Size Code Name
1 2048 6143 2.0 MiB EF02 BIOS boot partition
2 6144 415743 200.0 MiB 8300 Linux filesystem
3 415744 105273343 50.0 GiB 8300 LUKS partition
4 105273344 944134143 400.0 GiB 8300 LUKS partition
5 944134144 976773134 15.6 GiB 8400 Intel Rapid Start

3、 Set the motherboard firmware (BIOS / UEFI)

This step depends on different manufacturers, but the main purpose is to find the settings of Intel rapid start in BIOS / UEFI and turn it on. Before completing the above steps, this option is not enabled, and will prompt that no suitable storage device is found. However, after completing the above steps, the firmware will find the IRST partition according to the guid, allowing this function to be enabled. As for how long it will be enabled, it is a personal hobby. I choose “immediately”, which is equivalent to replacing the sleep function with IRST.
4、 Testing

In order to test the effect obviously, you can use DD first_ Rescue clear sda5: DD_ rescue /dev/zero /dev/sda5。 You can check with commands like head – C 1g / dev / sda5.

After the preparation is completed, start the test: Echo – N MEM > / sys / power / state suspend the system to the memory (S3, sleep) → the system sleeps smoothly → the system wakes up briefly and writes the contents of the memory into the IRST partition. At this time, if you listen carefully, you can hear the sound of mechanical hard disk writing → writing is completed, and the system is powered off and shut down.

After power failure and shutdown, the user can only wake up the computer by pressing the power button. After pressing the power key, it can be observed that the BIOS / UEFI displays something like resuming from deep sleep Words, indicating that this recovery process is completed by the firmware and has nothing to do with the operating system. After the recovery is completed, it will return to the way it was before going to sleep. At this time, a large amount of output can be observed using head / dev / sda5, indicating that sda5 has indeed been written.

So far, IRST deployment is successful.

Recommended Today

SQL server cannot generate fruncm thread

SQL Server was unable to generate the fruncm thread. The database error log is as follows: Copy codeThe code is as follows: 2013-09-26 21:21:50.31 Server      Microsoft SQL Server 2005 – 9.00.1399.06 (Intel X86)Oct 14 2005 00:33:37 Copyright (c) 1988-2005 Microsoft CorporationEnterprise Edition on Windows NT 5.2 (Build 3790: Service Pack 2) 2013-09-26 21:21:50.31 Server      (c) […]