I have computer with battery power supply that allows running the computer for approximately one minute after power loss. I want to trigger suspend-to-disk immediately after power loss so it can be resumed later. The initrd (default Devuan initrd) looks for suspend signature in the swap partition and resumes from it when the signature is found. I am not sure what happens when power is completely interrupted while writing data to the swap partition. That could happen when the battery fails or the system hangs while suspending. Will the system resume from the corrupted swap partition or it will just ignore the swap partition? I consider the second option better – it is better to have incorrectly unmounted filesystem than corrupted system state.
Is the signature written to the swap partition after or before the other data? Does it use checksums?