[SOLVED] Release swap after botched hibernation

This forum is dedicated to advanced help and support :

Ask here your questions about advanced usage of Mageia. For example you may post here all your questions about network and automated installs, complex server configurations, kernel tuning, creating your own Mageia mirrors, and all tasks likely to be touchy even for skilled users.

[SOLVED] Release swap after botched hibernation

Postby jimg » Aug 4th, '16, 23:38

I powered up after hibernating, and accidentally selected a different kernel from the one I hibernated from. Now I apparently have an image in my swap partition, and when I boot up (from shutdown, haven't tried hibernate again), I can't load the swap partition. Presumably there's a hibernation image written to swap that's being protected. When booting, I get a lengthy "start job is running" pause while the system tries in vain to load swap.

There's nothing of value in the hibernation image, if in fact it's still there. Is there a simple way to make swap available again upon next reboot?

Thanks,

Jim Garrett
Last edited by jimg on Aug 10th, '16, 04:07, edited 1 time in total.
jimg
 
Posts: 34
Joined: May 31st, '13, 03:45

Re: Release swap after botched hibernation

Postby jiml8 » Aug 5th, '16, 10:06

Presuming swap is a partition, from the command line, as root:

swapoff /dev/swappartitionname
mkswap /dev/swappartitionname
swapon /dev/swappartitionname
jiml8
 
Posts: 1254
Joined: Jul 7th, '13, 18:09

Re: Release swap after botched hibernation

Postby Bequimao » Aug 5th, '16, 10:17

jiml8 wrote:Presuming swap is a partition, from the command line, as root:

swapoff /dev/swappartitionname
mkswap /dev/swappartitionname
swapon /dev/swappartitionname


You should preserve the UUID.

Code: Select all
##  Get partitionname and UUID
# blkid | grep swap
## Formatting
# mkswap -U <old_uuid> <partitionname>


Greetings,
Bequimão
Bequimao
 
Posts: 111
Joined: Jun 3rd, '11, 21:51
Location: Minas Gerais, Brazil

Re: Release swap after botched hibernation

Postby jiml8 » Aug 6th, '16, 01:06

Yes, default mageia installation uses UUID to identify swap in fstab. I eliminated all of that stuff from my installation long ago and had completely forgotten about it.
jiml8
 
Posts: 1254
Joined: Jul 7th, '13, 18:09

Re: Release swap after botched hibernation

Postby jimg » Aug 6th, '16, 01:56

Thanks. Yes, this is a swap partition that should be named "swap".

Unfortunately neither of these suggestions quite worked. It seems not to know of the existence of the partition.

I was able to look up the UUID from /etc/fstab.

Code: Select all
swapoff /dev/swap
swapoff: /dev/swap: swapoff failed: No such file or directory

swapoff -U b9...d6
swapoff: cannot find the device for b9...d6

mkswap -U b9...d6 /swap
/swap: No such file or directory


Thoughts?

-Jim
jimg
 
Posts: 34
Joined: May 31st, '13, 03:45

Re: Release swap after botched hibernation

Postby jiml8 » Aug 6th, '16, 02:16

In my original post, "swappartitionname" refers to the identifier of your swap partition, not the name "swap".

All partitions will be identified as /dev/sdXN where X will be A..Z and N will be 1..9 (could be greater than 9, but most people don't have that many partitions on one device).

Thus, my system has two swap devices, and one of these is a partition, specifically /dev/sdd1. I would disable this swap with the command "swapoff /dev/sdd1".

My other swap is a file located on partition /dev/sda1 with the name .swapfile. I would disable this one with the command: "swapoff /mnt/sda1/.swapfile" because /dev/sda1 is mounted at /mnt/sda1.
jiml8
 
Posts: 1254
Joined: Jul 7th, '13, 18:09

[Solved] Release swap after botched hibernation

Postby jimg » Aug 6th, '16, 03:42

Thanks for the clarification. With this, I was able to figure it out.

For the benefit of anyone else....

I used gparted to get information about the partitions, and was able to infer which one was swap by its size, and by elimination (sda5).

swapoff didn't do anything because there was no swap active. Once I knew the device, I was able to make swap space with the specified UUID, as suggested:
Code: Select all
mkswap -U <old-uuid> /dev/sda5


And that did it. And I learned something!

Thanks for your help!
jimg
 
Posts: 34
Joined: May 31st, '13, 03:45

Re: Release swap after botched hibernation

Postby jiml8 » Aug 6th, '16, 04:39

The command "blkid | grep swap" gives you the partition identifier directly, without having to resort to gparted and inferences and conclusions.

Try entering blkid on its own and see what it gives you. You do not have to be root, but if you are not root, enter /sbin/blkid .
jiml8
 
Posts: 1254
Joined: Jul 7th, '13, 18:09

Re: [SOLVED] Release swap after botched hibernation

Postby jimg » Aug 10th, '16, 04:09

Thanks, that's handy.

It appears that if I submit /sbin/blkid not as root nothing is returned, but blkid as root works fine.

-Jim
jimg
 
Posts: 34
Joined: May 31st, '13, 03:45


Return to Advanced support

Who is online

Users browsing this forum: No registered users and 1 guest