2

I had a problem with mysql and I needed to make a swap file to fix it. I ran this code

# dd if=/dev/zero of=/swap.dat bs=1024 count=512M
# mkswap /swap.dat
# swapon /swap.dat
## Edit the /etc/fstab, and the following entry.
/swap.dat      none    swap    sw      0       0 

It makes a swap file, of 512mb I think. Now my VPS says I'm using 99.9% of 19.56gb.

I tried to run swapoff /swap.dat and remove /swap.dat from /etc/fstab but it still says I'm using 99.9%

I can't install any additional software like gparted because it says that the device has no space left

3
  • Try rebooting and see if that fixes is – fosslinux Jun 22 '16 at 1:27
  • @CollDue96 I already did it. :( – Zerquix18 Jun 22 '16 at 1:28
  • You had created a file that is 1024 * 512MB in size, have you checked that with ls -l? You also didn't say if you have deleted /swap.dat or not. – Anthony Wong Jun 22 '16 at 11:00
5

First, remove that entry from /etc/fstab. Then:

sudo swapoff /swap.dat
# Wait for all resources paged to that swap file to be moved to other swap files or to RAM.
sudo rm -f /swap.dat

If you remove the file before it is no longer in use, the disk space will remain allocated until swapoff is complete.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.