resume disk partition

I recently “tidied up” and removed unneeded partitions, and a few other helpful things. :wink: Unfortunately, afterwards the system (OS 42.3) wouldn’t hibernate … or, I think, it wouldn’t resume from hibernate.

Can you tell me where the hibernate target partition is set?
(I know where the resume partition is set … in grub2 via yast2 bootloader)

TIA
David

Swap is used.

Did you perhaps remove or change that location? The resume location is set in grub.pointing to the partition used for swap.

Hibernating uses Swap space, most probably the Swap partition. You can find it in /etc/fstab and see if you happened to delete it.

Yes, it’s using a swap partition … but I have 3. One of them is hard coded into the boot line.

fstab swap:

UUID=e18fda08-c47c-4121-a3fb-6b8e656181ae                         swap                 swap       pri=10               0 0
UUID=b2d0e8e6-b9cc-4080-91f0-acbfba88b828                 swap                 swap       pri=0                 0 0
UUID=d5aa9aba-6b73-41cf-9236-a4ff49618f4d                 swap                 swap       pri=0                 0 0

grub:

GRUB_CMDLINE_LINUX_DEFAULT="lang=en_GB resume=/dev/disk/by-id/ata-IC35L060AVV207-0_VNVB05G2RUTTGH-part4 usbhid.quirks=0x056a:0x0319:0x40000000 splash=silent quiet showopts"

/dev/disk/by-id/ata-IC35L060AVV207-0_VNVB05G2RUTTGH-part4 → …/…/sda4
/dev/disk/by-uuid/b2d0e8e6-b9cc-4080-91f0-acbfba88b828 → …/…/sda4
/dev/disk/by-uuid/d5aa9aba-6b73-41cf-9236-a4ff49618f4d → …/…/sdc3
/dev/disk/by-uuid/e18fda08-c47c-4121-a3fb-6b8e656181ae → …/…/sdb5

How can I know (or control) which swap partition it’s going to choose to use for resume so I can be certain it’s set correctly on the grub line? Or do I need to put all the swap partitions on the grub line?

Hi, apparently sdb5 is used first to store the hibernation image since you set pri=10 in fstab, so resuming from sda4 finds no image to read.
Setting GRUB to resume from sdb5 should fix things, or maybe you prefer to change swap priorities in fstab.

You can use multiple swaps but hibernate will only use one. That one will need to be large enough to hold the memory image

IMHO it is best to stick with one swap large enough to hole memory

True, if either a non-commercial system or a non-scientific (laboratory) system, with only one disk drive.

  • IOW, more than 90 % of the “home” (or “student”) systems …

IMHO, not true for large commercial systems and large scientific (laboratory) systems, with multiple disk drives and/or RAID and, compute intensive applications …

Thanks. This may answer my current puzzlement, given the earlier statement about priorities. Hibernate isn’t using sdb5 but sda4 - I can tell by “adjusting” the grub/kernel resume partition:). The sizes of all the swap partitions are different:

# swapon --summary
Filename                                Type            Size    Used    Priority
/dev/sdb5                               partition       8383484 1688    10
/dev/sdc3                               partition       8388604 0       0
/dev/sda4                               partition       8391596 0       0

I’m vaguely puzzled by the different partition sizes, none of which are 8GB, as they will all have been created as 8GB (or 8192 MB) within either gpart or fdisk, but that’s a question for another day. Probably down to sector alignment.

# fdisk -l /dev/sda
Disk /dev/sda: 57.3 GiB, 61492838400 bytes, 120103200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x15a32722

Device     Boot    Start       End  Sectors  Size Id Type                                                                                                                          
/dev/sda1  *          63   9389519  9389457  4.5G  b W95 FAT32                                                                                                                     
/dev/sda2        9389520  72318959 62929440   30G  7 HPFS/NTFS/exFAT                                                                                                               
/dev/sda3       89102160 120098159 30996000 14.8G  f W95 Ext'd (LBA)                                                                                                               
/dev/sda4       72318960  89102159 16783200    8G 82 Linux swap / Solaris                                                                                                          
/dev/sda5       89102223  93305519  4203297    2G  7 HPFS/NTFS/exFAT                                                                                                               
/dev/sda6       93305583  99610559  6304977    3G  7 HPFS/NTFS/exFAT                                                                                                               
/dev/sda7       99610623 120098159 20487537  9.8G  7 HPFS/NTFS/exFAT                                                                                                               
                                                                                                                                                                                   
Partition table entries are not in disk order.

$ echo $(( 16783200 * 512 ))
8592998400
# fdisk -l /dev/sdb
Disk /dev/sdb: 111.8 GiB, 120034123776 bytes, 234441648 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x93d23bfd

Device     Boot     Start       End  Sectors  Size Id Type
/dev/sdb1  *         4096    131071   126976   62M  6 FAT16
/dev/sdb2          131072    524287   393216  192M 83 Linux
/dev/sdb3          524288  96860159 96335872   46G  7 HPFS/NTFS/exFAT
/dev/sdb4       138801600 234436544 95634945 45.6G  5 Extended
/dev/sdb5       138805248 155572223 16766976    8G 82 Linux swap / Solaris
/dev/sdb6       155573523 234434559 78861037 37.6G 83 Linux

$ echo $(( 16766976 * 512 ))
8584691712

… etc

# cat /proc/meminfo
[sudo] password for david: 
MemTotal:        8106528 kB

$ echo $(( 8106528 * 1024 * 1024 ))
8500310704128

$ echo $(( 8 * 1024 * 1024 * 1024 ))
8589934592

In physical reality it has 8 GB memory - 4 x 2GB cards.

I’d like to get the hibernate partition onto sdc, and remove sda as it has multiple old Windows installs, kept for incompatible software reasons after I migrated to Linux (they now fire up as VMs under vbox). I’ll increase the swap partition size on sdc to 12GB and reduce the one on sda (SSD) to 4GB. I also want to move sdb to GPT and boot to UEFI, but that’s a whole different can of worms.

Swap is needed solely for inefficient data analysis packages which insist on keeping the whole dataset in memory. :frowning:

Better memory info:

# cat /proc/meminfo
MemTotal:        8106528 kB

$ echo $(( 8106528 * 1024 ))
8301084672

I am not sure if /proc/meminfo uses the standards, but
8106528 kB = 81065281000 B
8106528 kiB = 8106528
1024 B

… hmm. I’d always assumed that Linux used 1024 everywhere … the other is a Microsoft “standard.” But maybe not.

From a different computer, also OS 42.3:

# free -b
             total       used       free     shared    buffers     cached
Mem:    33693470720 25551183872 8142286848   60297216  693420032 24150450176
-/+ buffers/cache:  707313664 32986157056
Swap:            0          0          0


# cat /proc/meminfo 
MemTotal:       32903780 kB

$ echo $(( 32903780 * 1024 ))
33693470720

k for 1024 instead of 1000 (as is the normal ISO standard for all ISO standard units) is used since somewhere in the beginning of computers.

Nowadays one tries to use ki, Mi, etc. for the 1024, 1024*1024, etc. notations.
Dolphin e.g. show clearly in the Size column 130.9 KiB, etc. on my system.
As I said in my earlier post, tools that already exist very long may still use k for 1024. The problem is that one can not tell very easy what is used.

But this is not a Linux standard at all. https://en.wikipedia.org/wiki/Kibibyte

You only need one swap, unless you have a really odd requirement, and it is large enough (note the mem image is compressed)

Just don’t mount the others. Note if you manull edit the fstab then you also need to manually adjust the resume in grub. If you use yast disk management grub should be updated at the same time.

The 8G is taken as a rough hint by the partitioning software.

“/dev/sda” uses legacy partitioning. It is old-style, with partitions being aligned on cylinders or tracks – preferably cylinders. And “/dev/sda4” is a primary partition, so gets a full quota of cylinders. A logical partion ("/dev/sda5" or later on that drive) would typically get one track short of a set of cylinders. That’s because each logical partition requires an additional partition table, and usually a track was reserved for that.

“/dev/sdb” uses legacy partitioning, but new-style where boundaries are at MiB alignment rather than track alignment. That’s better suited to modern disks where the cylinder/track as seen by the logic is not related to the physical structure.

“/dev/sdb5” is a logical partition. That still requires an additional partition table. And most partitioning software well set aside 1MiB of disk space for that, though a few will just start it at the first available physical sector or the first available logical sector.

I can’t comment on “/dev/sdc” since you did not give detailed info for that.

Puzzled here too: how can you tell that hibernate is using sda4? According to your original post the system tries to resume from sda4, pointed to by the boot line, but doesn’t succeed: how can you tell that a system image is actually stored there?
From the above lines I see that only sdb5 is actually used, according to the priorities set.
Size of the swap partitions should not matter much under most conditions; this is what I see with 16 GB RAM and 8GB swap:

bruno@LT_B:~> journalctl -b
...
apr 07 09:24:59 LT_B systemd-logind[1425]: Power key pressed.
...
apr 07 09:25:00 LT_B systemd[1]: Reached target Sleep.
apr 07 09:25:00 LT_B systemd[1]: Starting Hibernate...
apr 07 09:25:00 LT_B kernel: PM: Hibernation mode set to 'platform'
...
apr 07 09:25:30 LT_B kernel: PM: Preallocating image memory... done (allocated 758883 pages)
apr 07 09:25:30 LT_B kernel: PM: Allocated 3035532 kbytes in 0.23 seconds (13197.96 MB/s)
...
apr 07 09:25:30 LT_B kernel: PM: Creating hibernation image:
apr 07 09:25:30 LT_B kernel: PM: Need to copy 753310 pages
apr 07 09:25:30 LT_B kernel: PM: Normal pages needed: 753310 + 1024, available pages: 3412282

You have 16 gig RAM??? Hibernate will only use ONE (1) partition and 8 gig would not be enough you need single ~16 Gig swap. I’d expect the save to go to the first swap but resume is set in Grub resume stanza these two must agree

Please read again carefully. 16GB RAM and 8GB swap is just a test to illustrate, not the OP actual setup.

Ok got confused there. Though the memory image is compressed. compression percentages can vary thus you need a minimum swap the size of RAM at least until you get into huge memory images +12gig then you need to rethink

I think the multiple mounted swaps is just confusing the system and the OP in this case. Drop back to using only one swap. And be sure that grub resume points to that one and only swap. Removing the mounts via yast should sync grub also.