method one
EDIT /etc/fstab
, sudo vim /etc/fstab
, find the following line
Find /dev/disk/by-uuid/28b306c5-92e4-4180-966d-cdedfbce3a4d /boot ext4 defaults 0 1
Modify it to the following figure, and (/swap.img none swap sw 0 0) comment the following line, that is, add at the beginning of the line#
Reboot the system and verify
sudo swapon --show
Method Two:
First check if the Swap partition is enabled:
sudo swapon --show
If the Swap partition is enabled, you will see the path and size of the Swap partition file.
You can also check it with the free command:
free -h
will display the total size and usage of the Swap partition if the Swap partition is enabled.
Run the following command to disable Swap partition
sudo swapoff -a
then delete the Swap partition file:
sudo rm /swap.img
Next modify the fstab file so that the Swap partition file will not be recreated after the system restarts. Comment or remove /etc/fstab:
/swap.img none swap sw 0 0
Run sudo swapon --show again to check if it is disabled, if so the command should have no output.