Windows, MacOS, and Linux all have a couple low-power modes known as sleep (or suspend on Linux, we will refer to both as sleep mode from here on out.), and hibernate.
Sleep mode is a low power mode where your computer saves all your work in it’s volatile memory and reduces it’s power consumption so much that it is essentially doing nothing. This state is so efficient that a laptop with a 2 hour battery life can go all day in sleep mode. However, if your device DOES lose power, you lose all your work because the current state of your device was stored in RAM, which requires power to contain data.
Hibernate is an even lower-power state, where your computer is actually off. In this case, what would normally be stored in RAM is stored on your internal drive. With Linux, this is is your swap partition and/or file. Since this state requires no power, it puts no strain on your battery. However, due to the speed differences between internal storage devices such as SSDs and HDDs, and RAM, it takes much longer for your computer to fully boot back up.
This is where Hybrid Sleep, or Hybrid Suspend comes in. Hybrid Suspend saves the same date to both your RAM and internal drive. This way, you can much more quickly boot up, but if you lose power due to a dead battery or power outage, you don’t lose anything.
On Drauger OS 7.5.1, hybrid suspend is enabled by default. The only requirement from the user is to provide enough SWAP space on their system for the kernel to unlock this feature. This can be done during, or after, installation. However, in order to avoid bugs, it is advised to do it during installation. This wiki article will go over the process of adding swap during installation. Any user wanting to add swap post-installation will be expected to have the necessary knowledge of the command line to achieve this. Therefore, it will not be covered in this article.
How much swap do I need?
This is an age old question, asked by Linux users for years until now, and probably will be asked for years to come.
Recently, It’s FOSS had an article posted about how much swap you should have. We will be referencing it for large amounts of this article.
In order to figure out how much SWAP you need to enable Hybrid Suspend, simply follow this equation, where R is the RAM capacity of your system and S is the size of the SWAP partition to create, both in gigabytes:
S = √R + R
So, if you have 8 GB of RAM in your system:
S = √8 + 8
S = 2.828 + 8
S = 10.828 GB
To make your life easier, here is a table of swap allocation sizes, using this formula on common RAM capacities:
|4 GB||6 GB|
|6 GB||8.5 GB|
|8 GB||11 GB|
|16 GB||20 GB|
|32 GB||38 GB|
To create a swap area during installation, you can either:
- Create a swap partition with the necessary size.
- Or, leave the swap field blank and let the system installation utility generate a swap file for you.
If you choose to use “Auto Partitioning mode”, the system installation utility will create a swap file for you automatically that is large enough to enable Hybrid Sleep.
This feature should allow Drauger OS users to have quicker start-ups, and lose data less often, with minimal to no extra effort for them.
Hope you enjoy it!