{"id":805,"date":"2026-04-22T15:54:06","date_gmt":"2026-04-22T07:54:06","guid":{"rendered":"https:\/\/play.datalude.com\/blog\/?p=805"},"modified":"2026-04-22T15:54:08","modified_gmt":"2026-04-22T07:54:08","slug":"increasing-linux-swapfile-with-minimal-disruption-the-swapfile-shuffle","status":"publish","type":"post","link":"https:\/\/play.datalude.com\/blog\/2026\/04\/increasing-linux-swapfile-with-minimal-disruption-the-swapfile-shuffle\/","title":{"rendered":"Increasing Linux swapfile with minimal disruption: the swapfile shuffle"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Had a server which needed a bit more swap, but the current swap was at 100%, and it was marginal whether there was enough RAM to allow me to delete the current 2G swap and replace it with 4G. So I came up with the \"swapfile shuffle\". <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> # Lets see what we've got\nswapon --show\nNAME      TYPE SIZE USED PRIO\n\/swapfile file   2G   2G   -2\n\n# Make a new temp swapfile and turn it on.\nfallocate -l 2G \/swapfile2\nchmod 600 \/swapfile2\nmkswap \/swapfile2\nswapon \/swapfile2\n\n# Check progress\n htop -> 4G of active swap. Memory looks OK. \n \n# Looking good, so now we turn off the original swapfile, resize it and then turn it on\nswapoff \/swapfile\nfallocate -l 4G \/swapfile\nchmod 600 \/swapfile\nmkswap \/swapfile\nswapon \/swapfile\n\n# Check again. \nhtop -> Whoo, now have 6Gb swap\n\n# Now can disable the temp swapfile \nswapoff \/swapfile2 \nrm \/swapfile2\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">All good. Happy server. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Had a server which needed a bit more swap, but the current swap was at 100%, and it was marginal whether there was enough RAM to allow me to delete the current 2G swap and replace it with 4G. So I came up with the \"swapfile shuffle\". All good. Happy server.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,4],"tags":[],"class_list":["post-805","post","type-post","status-publish","format-standard","hentry","category-it","category-linux"],"_links":{"self":[{"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/posts\/805","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/comments?post=805"}],"version-history":[{"count":1,"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/posts\/805\/revisions"}],"predecessor-version":[{"id":812,"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/posts\/805\/revisions\/812"}],"wp:attachment":[{"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/media?parent=805"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/categories?post=805"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/tags?post=805"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}