If a Linux system is using more than one swap device and suspend to disk, how does one setup the resume= kernel parameter?


Just like if you only have one swap device, i.e., specify exactly one partition as value of resume=. The Kernel Documentation on the resume kernel command-line parameter make it clear that it only takes one device.

resume=       [SWSUSP]          
              Specify the partition device for software suspend
              {/dev/<dev> | PARTUUID=<uuid> | <int>:<int> | <hex>}

Source https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/admin-guide/kernel-parameters.txt?h=v4.17#n3767

More information about suspend-to-swap can be found at https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/power/swsusp.txt?h=v4.17

| improve this answer | |
  • So if I only specify one of the n devices, will it work it out? – Tom Hale Jun 28 '18 at 8:56
  • Yes, the device given to 'resume=' will be used to when writing the data from RAM to disk, and on resumption, to search for the data to be written back from disk to RAM. It hasn't even be of the size of your physical RAM, hibernation may even work in this case, but if you wan't to make sure, make it the size of the RAM. – Flow Jun 28 '18 at 8:59
  • My answer seems to say it's impossible. Do you have a counter-reference? – Tom Hale Jun 28 '18 at 9:01
  • Your quote appears to state exactly what I wrote: You can only use exactly one swap partition for suspend to disk. – Flow Jun 28 '18 at 9:03

It doesn't seem possible.

The Software Suspend documentation says:

Q: Does swsusp (to disk) use only one swap partition or can it use
multiple swap partitions (aggregate them into one logical space)?

A: Only one swap partition, sorry.

Thanks to Flow's answer for the link.

| improve this answer | |
  • I don't think that is correct. You can use suspend-to-disk even if you have multiple swap partitions. But the 'resume=` kernel parameter only takes exactly one partition, which is used for suspend to disk. – Flow Jun 28 '18 at 9:04
  • 1
    @Flow Are you sure? Have you tried it or seen it? What if the one named swap partition happens to not have enough space? If it was you who down-voted, I welcome constructive criticism. – Tom Hale Jun 28 '18 at 10:50
  • "What if the one named swap partition happens to not have enough space?" Then hibernation fails. But that isn't a matter of having one or multiple swap partitions. – Flow Jun 28 '18 at 14:50
  • 1
    Do you have any evidence for you assertion that it works with multiple partitions? I forgot to reference you by the way - added now. – Tom Hale Jun 29 '18 at 5:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.