I decided to switch from using a swap partition, to using a
But there's a problem. The system is still using the swap partition
/dev/sda8, and not the
- I created the
/swapfileusing the appropriate
- I changed
/swapfileinstead of the old swap partition
- I changed
- I checked that
/etc/default/grubhas no reference to resume or swap
Yet, when I do
swapon -s or
free -h, it's still showing
/dev/sda8, instead of
Do I need to delete the
/dev/sda8 swap partition for this to work?
Does 20.04.1 use any swap partition that it finds, even if it's not in
Just to document my
/swapfile creation process...
Note: Incorrect use of the
dd command can cause data loss. Suggest copy/paste.
In the terminal...
sudo swapoff -a # turn off swap sudo rm -i /swapfile # remove old /swapfile sudo dd if=/dev/zero of=/swapfile bs=1M count=4096 sudo chmod 600 /swapfile # set proper file protections sudo mkswap /swapfile # init /swapfile sudo swapon /swapfile # turn on swap free -h # confirm 16G RAM and 4G swap
/swapfile line at the end of
/etc/fstab... and confirm no other “swap” lines...
To edit, use
sudo -H gedit /etc/fstab or
sudo pico /etc/fstab
/swapfile none swap sw 0 0
reboot # reboot and verify operation
Here's my /proc/swaps (and it's fresh from this morning)...
Filename Type Size Used Priority /dev/sda8 partition 9081852 0 -2
Here's the appropriate portion of my
# swap was on /dev/sda8 during installation # UUID=071f8b0e-8e16-4f4d-90ff-a4ae9cc56e2b none swap sw 0 0 /swapfile none swap sw 0 0
# RESUME=UUID=071f8b0e-8e16-4f4d-90ff-a4ae9cc56e2b RESUME=/swapfile
sudo update-initramfs -c -k $(uname -r) didn't help.