While installing Ubuntu 18.04 LTS I created swap in hard drive which is leading me hang for heavy applications because I have 8 GB of RAM.
1 Answers
It's not a good idea to use the SSD drive as the swap space but if the life-span of the device is not a concern for you , you can manually delete your current swap partition and create a new one .
First off you have to unmount the current swap (Check your memory usage since unmounting the swap might cause bottlenecks in your RAM) :
sudo swapoff -a
Then delete your swap file (presumably it's /swapfile
)
sudo rm /swapfile
And create a new swapfile in your SSD :
fallocate -l 2G /path/to/custom/swapfile/in/ssd #Change the size to suit your needs
then change the permissions :
sudo chmod 0600 /your/swapfile
make a swap partition :
sudo mkswap /your/swapfile
and finally mount it :
sudo swapon /your/swapfile
Now you should be able to use the new swap partition.
And don't forget to change the swap file address in your /etc/fstab
file to point to the new swap partition not the old one. The line containing swap
should look like this :
/new/swap/location none swap sw 0 0
And if you want to use the hibernation feature , you should update your grub config as @C.S.Cameron mentioned :
sudo update-grub

- 3,305
- 16
- 37
-
OP may also want to update hibernation resume location in grub.cfg – C.S.Cameron Jun 07 '20 at 08:01
-
sudo update-grub
to update "resume" location in grub.cfg. – C.S.Cameron Jun 07 '20 at 07:52