2

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?

Noam B.
  • 119
  • 3
  • 7
  • 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

1 Answers1

8

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.

Adam Gibbins
  • 7,147
  • 2
  • 28
  • 42