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?
Asked
Active
Viewed 1,522 times
0
-
2Why 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
-
2Decreasing 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 Answers
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