0

After seeing this post: How do I increase swapfile in Ubuntu 18.04?, I was wondering, how do I decrease the size of the swap file without removing it?

  • 2
    Why the need to decrease the size of a swapfile without removing it? What exactly are you trying to accomplish? – stumblebee Nov 21 '21 at 01:25
  • 2
    Decreasing a swapfile would be done the same way as creating one, as they’re fixed in size to begin with. The only difference is that you would specify a smaller size than currently exists. – matigo Nov 21 '21 at 02:07

1 Answers1

1

how do I decrease the size of the swap file without removing it?

This question is rather irrelevant. Swap space must be taken out of use before changing it. The command sudo fallocate -l 4G /swapfile (with an adjusted size) will overwrite your existing swapfile if you do not delete it first.

vanadium
  • 88,010