Step 1: Check the Current Swap Configuration
sudo swapon --show
free -h
Step 2: Disable the Current Swap
sudo dphys-swapfile swapoff
Step 3: Edit the Swap File Configuration
sudo vi /etc/dphys-swapfile
# CONF_SWAPSIZE=2048
Step 4: Regenerate and Enable the Swap File
sudo dphys-swapfile setup
sudo dphys-swapfile swapon
Step 5: Verify the New Swap Configuration
sudo swapon --show
sudo reboot