1
  • OS: Ubuntu 16.04 LTS,
  • Platform: 64bit,
  • Root partition(/) size: 153.6 GB,
  • Free space in root partition(/): 140.2 GB,
  • Swap partition size: 6 gb,
  • Any free/Unallocated space in disk: No,
  • Dual Boot/Other OS: Yes, Windows 10,
  • Main objective: To be able to hibernate ubuntu

I tried to hibernate my system but it failed. I read in some articles that I must allocate swap space equal to the size of RAM installed on my system to perform hibernate. I have no space left in my hard disk other than Ubuntu root partition so how can I shrink it and add 2 GB to swap to make it 8 GB.

Will it hibernate then? Is there any other way?

David Foerster
  • 36,264
  • 56
  • 94
  • 147

1 Answers1

1

I suggest to add a swap file instead of resizing root partition.

First create a empty file somewhere in /

sudo dd if=/dev/zero of=/swapfile bs=1024K count=2000

make it a swap file:

mkswap /swapfile

open /etc/fstab:

sudo nano /etc/fstab

add this line into it:

/swapfile         swap          swap    defaults        0 0

run:

sudo swapon /swapfile

check you swap size:

$ cat /proc/meminfo | grep -i swaptotal
7874913
Ravexina
  • 55,668
  • 25
  • 164
  • 183