0

I want my 16.04 to be able to hibernate to disk, it does not give that option now. I have a HP Pavillion x360 with 4 GB RAM. What should I do? Do you think it will help to shrink the Windows partition (sda3) by one GB and make swap size all together 5 GB? Or should I do something else? (Maybe 3.91 GiB is enough already?)

If I expand swap, will I then have to make any adjustments in the system. Or will Ubuntu automatically realize the swap has been enlarged?

Since I will be shrinking Windows 10 I thought I might use Windows 10 partitioning tools, also for enlarging swap. I don't have a bootable GParted USB at hand. Does that make a difference? (The system is dual boot.)

(I am in a period when I use Linux quite much for a project and I would appreciate hibernate to be present and also that I can install it smoothly, therefore I ask this before just trying around.)

Thanks

enter image description here

ycc@x360:~$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda5 during installation
UUID=c9b9e601-f78a-41d8-a4f4-87e276b4aeb7 /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sda1 during installation
UUID=9ADF-D1D2  /boot/efi       vfat    umask=0077      0       1
# /home was on /dev/sda6 during installation
UUID=782e4b9f-4941-48bc-a1bf-5883e28cb174 /home           ext4    defaults        0       2
# swap was on /dev/sda4 during installation
UUID=c35d5bd1-960c-4e1a-8f6e-d73af393bfc3 none            swap    sw              0       0

$ sudo parted -l
Model: ATA WDC WD5000LPCX-6 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start   End    Size    File system     Name                          Flags
 1      1049kB  274MB  273MB   fat32           EFI system partition          boot, esp
 2      274MB   290MB  16.8MB                  Microsoft reserved partition  msftres
 3      290MB   315GB  315GB   ntfs            Basic data partition          msftdata
 4      315GB   319GB  4194MB  linux-swap(v1)  Basic data partition          msftdata
 5      319GB   382GB  62.9GB  ext4            Basic data partition          msftdata
 6      382GB   483GB  101GB   ext4            Basic data partition          msftdata
 7      483GB   484GB  1028MB  ntfs            Basic data partition          hidden, diag
 8      484GB   500GB  16.1GB  ntfs            Basic data partition          hidden, msftdata
cvr
  • 373
  • 1
  • 7
  • 17
  • You can shrink the sda3 and enlarge sda4 in gparted. But you need to disable swap before you do it. The UUID will not change, so there is no need to do anything with swap. – Pilot6 Jul 30 '16 at 12:49
  • How to enable hibernate you can find using search. – Pilot6 Jul 30 '16 at 12:50
  • Maybe I expressed myself badly. I think it is always enabled. Something is missing in my system. Would it help increasing swap from 3.91 GiB? – cvr Jul 30 '16 at 12:52
  • The system works really well and I need it. So I try to plan before I make changes this time. – cvr Jul 30 '16 at 12:53
  • 1
    Hibernation is not enabled in Ubuntu by default. You need to have swap more that RAM and then enable it in configs. – Pilot6 Jul 30 '16 at 12:55
  • But basically. Do you think it will help increasing Swap from 3.91 GiB to 5GB? – cvr Jul 30 '16 at 12:56
  • 1
    5 GB is too much. 4.1 will be enough. See http://askubuntu.com/questions/94754/how-to-enable-hibernation – Pilot6 Jul 30 '16 at 12:57
  • 3.91 may be enough too. You can test if it works now by sudo pm-hibernate. – Pilot6 Jul 30 '16 at 12:58
  • I executed the command. Nothing happened. – cvr Jul 30 '16 at 13:00
  • 1
    If you are using UEFI, you need to disable Secure Boot in BIOS. – Pilot6 Jul 30 '16 at 13:00
  • 1
    See http://askubuntu.com/questions/803157/hibernation-disappeared-in-ubuntu-16-04-after-a-kernel-upgrade – Pilot6 Jul 30 '16 at 13:01
  • I thought it was disabled since I can boot Ubuntu. But then I will start Windows and see if I can find secure boot in UEFI. – cvr Jul 30 '16 at 13:02
  • 1
    Ubuntu can boot with Secure Boot enables. Do not look for UEFI settings in Windows. They are not there. – Pilot6 Jul 30 '16 at 13:03
  • I restart windows with shift held down. Then I get options. LIke I did to activate Ubuntu bootloader after install of Ubuntu?? OK It is not Windows, but I go via Windows?? – cvr Jul 30 '16 at 13:06
  • You nned to get into system setup or UEFI settings depending on your hardware. – Pilot6 Jul 30 '16 at 13:07
  • OK I look and see how I find UEFI settings. I think I was there when I activated GRUB2 after Ubuntu install. I come back when that is done. Thanks for your help, I appreciate. – cvr Jul 30 '16 at 13:08

1 Answers1

2

You need to disable Secure Boot in UEFI (BIOS) settings to use hibernation in Ubuntu.

Your swap size is probably enough. You can test it by running

sudo pm-hibernate

If that works and the system wakes up correctly, then you can enable hibernation using this guide

Pilot6
  • 90,100
  • 91
  • 213
  • 324
  • Works perfectly, I added menu entry like you suggested. / Thanks, I appreciate. Will make things easier for me. You guys answering are invaluable. / (I found UEFI like I said, but it is quicker through GRUB2 setup.) – cvr Jul 30 '16 at 13:48
  • Grub has a menu entry pointing to UEFI settings. – Pilot6 Jul 30 '16 at 14:15
  • That's what I meant, "System Setup" when the computer starts up. I may have expressed myself unclearly. "Secure boot disable" can be in different places in the BIOS, I read. I had to open the 2nd level menu entry "boot options" to find the secure boot. Thanks. – cvr Jul 30 '16 at 14:19
  • Thanks for your help, all worked like you said. HIbernate worked well at least 10 times. A little slow to wake up and every program needed a "warm up" to get up to full speed. I really pushed it and hibernated MATLAB and other demanding stuff together. Last time it didn't wake up even though I waited long time. I long pressed power and on restart chose the second option which gave me a terminal and I could issue "sudo shutdown -h now" which "took" the second time I issued it. Now all system works OK again, but I guess I pushed it too far. I am not sure it would work if I increased swap? – cvr Aug 01 '16 at 08:31
  • I do not think increasing swap can help, because if swap is not enough, resume from hibernate does not work at all. But you can try to increase it a little just in case. Maybe RAM consuming programs used swap and it was not enough for both things. – Pilot6 Aug 01 '16 at 08:33