I started to create a swapfile. I used this command:

sudo fallocate -l 1G /swapfile

Then, I decided that I want to make the swapfile in a different path, so I used the command again with the right path and activated the new swap file.

How can I delete the first file that I created?

  • Personally, I prefer a logical volume (or partition) based paging space, or none at all. A useful example of fallocate in any case. – John Mahowald Feb 19 '18 at 14:21

fallocate just creates a file, it does nothing specific to swap, so you can simply rm /swapfile.

If you had turned it into a swapfile with mkswap then swapon you can simply use swapoff /swapfile to stop your machine using it as swap.

| improve this answer | |

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.