The short answer is /sys/power/resume
Much longer answer, because that by itself won't do much if any good. Most distros recommend initiating a resume from the init / PID 1 process (early user space). However, the instructions will almost invariably inform you to add a kernel cmd line argument to your boot loader with the resume target. The reason for this is in almost every case that the initramfs build tool (dracut / mkinitcpio / initramfs-tools) is itself triggered by that argument in the configuration.
Based on your example and distro I'm assuming you are using the low level kernel interface for suspend (swsusp). There are a number of other utilities that can be used to start the suspend process; all of them are fundamentally wrappers around the first item, swusp.
- swusp - low level kernel interface; user space interface is through sysfs
- uswswp - low level userspace software suspend wrapper - provides s2disk, s2ram utilities (not actively maintained)
- pm-utils - high level scripts to configure the process
- systemd-suspend - on systemd systems a suspend target is available which will initiate the suspend operation via the kernel interface.
Resume Configuration
An oversimplified outline of the boot sequence in linux with using an initramfs image is:
[BIOS] ==> [Boot Loader] ==>[Kernel on temp rootfs - initramfs] ==> [Kernel on rootfs - drives]
There is a small window at the end of the initramfs stage where the resume can occur; after the kernel has started PID 1 (systemd or init), loaded the drivers for the raid, but before mounting the actual drives.
I've provided an example of a typical resume configuration. This assumes that the resume path you provided is a swap partition; and not a 'normal' partition containing a swap file. A swap file requires additional configuration. The systemd method is different - it uses a udev rule based on resume.target which triggers the resume process. It's worth looking into if the more traditional bootloader / initramfs image approach doesn't work. This is a direct corelary to the way that an init based system would do it; but a bit trickier to manually insert your own script and get the inter-dependencies / relative timing correct.
The bottom line is that the point in time at which the resume is triggered is immediately prior to when the kernel mounts the 'real' hard drives. So if the kernel can mount the entire fs, it also has all of the capability and information required to mount just the swap partition.
Make sure that your swap partition is mounted via fstab; the dracut initramfs tool specifically looks for it and does not include the resume module if the swap partition is not there.
configure bootloader
Assuming that you are using grub2, you need to append resume=/dev/mapper/isw_qfyzrvbsusf_Volume0p9
to the GRUB_CMDLINE_LINUX_DEFAULT
field in /etc/default/grub
Update your grub image, usually with command: sudo grub2-mkconfig -o /boot/grub2/grub.cfg
rebuild initramfs
You need to rebuild the initramfs image with the resume capability (as well as the raid modifications you've already made). Debian provides both dracut and initramfs-tools to generate initramfs. It must be regenerated with the resume module. With dracut, add the command line argument --add resume
. With update-initramfs
, add the entry resume=/dev/mapper/isw_qfyzrvbsusf_Volume0p9
to the config file /etc/initramfs-tools/conf.d/resume
That should be it; assuming I made some correct assumptions about your configuration.
Edit; assuming you can time it correctly, you can echo the major / minor device number of the swap partition to /sys/power/resume from an init script to trigger the resume. Your initramfs (or initd) image needs to have resume support in it, or that sysfs item and the capability it represents won't exist. See https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/983805