Dynamically growing swap file on Debian

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
9
down vote

favorite
2












I know how to create a swap file and use it as swap. But I have to configure the size of the file beforehand and the space is used on the disk, if the swap is used or not.



How do I create a swap that has an initial size of 0 and grows on demand?










share|improve this question























  • @Gilles: I am just curious - Why did you edit the title (apart from the typo)? Isn't it desired to have fully pronounced questions here?
    – rubo77
    Jun 4 '14 at 8:22







  • 1




    It's better to avoid useless words, especially at the start of the title which is where people pay the most attention. See How do I write a good title?. “Dynamically growing swap” gives the essential idea. “How do I create” doesn't begin to indicate what the question is about. There are people who prefer to make question titles questions because they're questions, but it's silly reason: the title is also the title of the answers.
    – Gilles
    Jun 4 '14 at 8:29














up vote
9
down vote

favorite
2












I know how to create a swap file and use it as swap. But I have to configure the size of the file beforehand and the space is used on the disk, if the swap is used or not.



How do I create a swap that has an initial size of 0 and grows on demand?










share|improve this question























  • @Gilles: I am just curious - Why did you edit the title (apart from the typo)? Isn't it desired to have fully pronounced questions here?
    – rubo77
    Jun 4 '14 at 8:22







  • 1




    It's better to avoid useless words, especially at the start of the title which is where people pay the most attention. See How do I write a good title?. “Dynamically growing swap” gives the essential idea. “How do I create” doesn't begin to indicate what the question is about. There are people who prefer to make question titles questions because they're questions, but it's silly reason: the title is also the title of the answers.
    – Gilles
    Jun 4 '14 at 8:29












up vote
9
down vote

favorite
2









up vote
9
down vote

favorite
2






2





I know how to create a swap file and use it as swap. But I have to configure the size of the file beforehand and the space is used on the disk, if the swap is used or not.



How do I create a swap that has an initial size of 0 and grows on demand?










share|improve this question















I know how to create a swap file and use it as swap. But I have to configure the size of the file beforehand and the space is used on the disk, if the swap is used or not.



How do I create a swap that has an initial size of 0 and grows on demand?







linux swap






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jun 3 '14 at 22:55









Gilles

523k12610441576




523k12610441576










asked Jun 3 '14 at 12:44









rubo77

7,3052469130




7,3052469130











  • @Gilles: I am just curious - Why did you edit the title (apart from the typo)? Isn't it desired to have fully pronounced questions here?
    – rubo77
    Jun 4 '14 at 8:22







  • 1




    It's better to avoid useless words, especially at the start of the title which is where people pay the most attention. See How do I write a good title?. “Dynamically growing swap” gives the essential idea. “How do I create” doesn't begin to indicate what the question is about. There are people who prefer to make question titles questions because they're questions, but it's silly reason: the title is also the title of the answers.
    – Gilles
    Jun 4 '14 at 8:29
















  • @Gilles: I am just curious - Why did you edit the title (apart from the typo)? Isn't it desired to have fully pronounced questions here?
    – rubo77
    Jun 4 '14 at 8:22







  • 1




    It's better to avoid useless words, especially at the start of the title which is where people pay the most attention. See How do I write a good title?. “Dynamically growing swap” gives the essential idea. “How do I create” doesn't begin to indicate what the question is about. There are people who prefer to make question titles questions because they're questions, but it's silly reason: the title is also the title of the answers.
    – Gilles
    Jun 4 '14 at 8:29















@Gilles: I am just curious - Why did you edit the title (apart from the typo)? Isn't it desired to have fully pronounced questions here?
– rubo77
Jun 4 '14 at 8:22





@Gilles: I am just curious - Why did you edit the title (apart from the typo)? Isn't it desired to have fully pronounced questions here?
– rubo77
Jun 4 '14 at 8:22





1




1




It's better to avoid useless words, especially at the start of the title which is where people pay the most attention. See How do I write a good title?. “Dynamically growing swap” gives the essential idea. “How do I create” doesn't begin to indicate what the question is about. There are people who prefer to make question titles questions because they're questions, but it's silly reason: the title is also the title of the answers.
– Gilles
Jun 4 '14 at 8:29




It's better to avoid useless words, especially at the start of the title which is where people pay the most attention. See How do I write a good title?. “Dynamically growing swap” gives the essential idea. “How do I create” doesn't begin to indicate what the question is about. There are people who prefer to make question titles questions because they're questions, but it's silly reason: the title is also the title of the answers.
– Gilles
Jun 4 '14 at 8:29










3 Answers
3






active

oldest

votes

















up vote
8
down vote













SwapSpace is a utility that creates a ‘dynamic swap file’ which according to the requirements of the operating system changes its size.



So you can even forget about creating a virtual swap file and just install “SwapSpace” and it’ll automatically create one for you and will even resize it when necessary.



You can also use ‘Swapspace’ side by side with a manually created swap file and when the manually one gets filled ‘Swapspace’ will automatically create another one for the OS so the OS will always have a swap space and it enhances the stability.



Another useful thing about “SwapSpace” is that, whenever it can, it’ll reduce the size of the SwapSpace and “release” those bytes into user file system and according to the developers this reduction helps to increase the swap file’s performance as well (plus your “precious” HDD space is not wasted too).



Install with



sudo apt-get install swapspace


And adjust the config file to your needs. I set the minimum to 0 on my VM debian machine with just 8GB HDD




Additionally I also set the swappiness to 0 to minimize the usage of the precious HDD space on my VM:



To change the system swappiness value, open /etc/sysctl.conf as root. Then, change or add this line to the file:



vm.swappiness = 0


(Reboot for the change to take effect)






share|improve this answer




















  • This won't support swsusp/suspending to swap file, unless the size of the created swap file is already big enough to contain the RAM dump.
    – soze
    Aug 26 '15 at 2:37










  • So how could we make sure that the swap file gets big enough to contain the ram?
    – rubo77
    Nov 29 '15 at 18:21










  • Have one fixed size swap file the size of RAM for suspending, and then use swapspace for dynamically sized swap
    – Tom Hale
    Oct 11 '16 at 11:17










  • It worked for me. This is super useful for small SSD disks.
    – Adrian Lopez
    Apr 14 '17 at 15:54

















up vote
0
down vote













Afaik, any swap partition that you would make using fdisk for example, would need any space greater than 0, as you are modifying the space from an existing disk and reallocating it into somewhere else.



Anyway, and answering your question, you can easily make a small partition, assign it as swap under fdisk, and afterwards:



1) disable swapping with swapoff -v
2) resize partition with lvresize
3) format the partition with mkswap
4) re-enable the swap space with swapon -v



Afterwards, you can use cat /proc/swaps to check if it has been upgraded or not. You can easily use this on a script, depending on your system specs, and run it on demand for whenever you need to increase that swap space. Something like:



$ swapoff -v /dev/swapvol1
$ lvresize /dev/swapvol1 -L +1G
$ mkswap /dev/swapvol1
$ swapon -v /dev/swapvol1





share|improve this answer




















  • This doesn't answer the question because the swap size is changed manually, not on demand. Furthermore, resizing the LV isn't useful: where do you find the space to grow? how is the freed space on shrinking not wasted? The question asks about a swap file, which solves the issue of the free space — it's available for other files.
    – Gilles
    Jun 3 '14 at 22:58










  • Changing the swap size on demand is a good idea, but swapspace does not cover the scenario of swsusp being used for supporting hibernation. I believe this answer might be more sane for those users who need hibernation support. Until swapspace handles that better, of course.
    – soze
    Aug 26 '15 at 2:40

















up vote
0
down vote













Swapspace is old and unmaintained and could lead, one day, to problems in modern systems. I think that the best solution for dynamic swap is to:



sudo apt install dphys-swapfile
sudo update-rc.d dphys-swapfile enable


then setting CONF_SWAPFACTOR=2 in /etc/dphys-swapfile and finally



sudo service dphys-swapfile start





share|improve this answer




















    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f134258%2fdynamically-growing-swap-file-on-debian%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    8
    down vote













    SwapSpace is a utility that creates a ‘dynamic swap file’ which according to the requirements of the operating system changes its size.



    So you can even forget about creating a virtual swap file and just install “SwapSpace” and it’ll automatically create one for you and will even resize it when necessary.



    You can also use ‘Swapspace’ side by side with a manually created swap file and when the manually one gets filled ‘Swapspace’ will automatically create another one for the OS so the OS will always have a swap space and it enhances the stability.



    Another useful thing about “SwapSpace” is that, whenever it can, it’ll reduce the size of the SwapSpace and “release” those bytes into user file system and according to the developers this reduction helps to increase the swap file’s performance as well (plus your “precious” HDD space is not wasted too).



    Install with



    sudo apt-get install swapspace


    And adjust the config file to your needs. I set the minimum to 0 on my VM debian machine with just 8GB HDD




    Additionally I also set the swappiness to 0 to minimize the usage of the precious HDD space on my VM:



    To change the system swappiness value, open /etc/sysctl.conf as root. Then, change or add this line to the file:



    vm.swappiness = 0


    (Reboot for the change to take effect)






    share|improve this answer




















    • This won't support swsusp/suspending to swap file, unless the size of the created swap file is already big enough to contain the RAM dump.
      – soze
      Aug 26 '15 at 2:37










    • So how could we make sure that the swap file gets big enough to contain the ram?
      – rubo77
      Nov 29 '15 at 18:21










    • Have one fixed size swap file the size of RAM for suspending, and then use swapspace for dynamically sized swap
      – Tom Hale
      Oct 11 '16 at 11:17










    • It worked for me. This is super useful for small SSD disks.
      – Adrian Lopez
      Apr 14 '17 at 15:54














    up vote
    8
    down vote













    SwapSpace is a utility that creates a ‘dynamic swap file’ which according to the requirements of the operating system changes its size.



    So you can even forget about creating a virtual swap file and just install “SwapSpace” and it’ll automatically create one for you and will even resize it when necessary.



    You can also use ‘Swapspace’ side by side with a manually created swap file and when the manually one gets filled ‘Swapspace’ will automatically create another one for the OS so the OS will always have a swap space and it enhances the stability.



    Another useful thing about “SwapSpace” is that, whenever it can, it’ll reduce the size of the SwapSpace and “release” those bytes into user file system and according to the developers this reduction helps to increase the swap file’s performance as well (plus your “precious” HDD space is not wasted too).



    Install with



    sudo apt-get install swapspace


    And adjust the config file to your needs. I set the minimum to 0 on my VM debian machine with just 8GB HDD




    Additionally I also set the swappiness to 0 to minimize the usage of the precious HDD space on my VM:



    To change the system swappiness value, open /etc/sysctl.conf as root. Then, change or add this line to the file:



    vm.swappiness = 0


    (Reboot for the change to take effect)






    share|improve this answer




















    • This won't support swsusp/suspending to swap file, unless the size of the created swap file is already big enough to contain the RAM dump.
      – soze
      Aug 26 '15 at 2:37










    • So how could we make sure that the swap file gets big enough to contain the ram?
      – rubo77
      Nov 29 '15 at 18:21










    • Have one fixed size swap file the size of RAM for suspending, and then use swapspace for dynamically sized swap
      – Tom Hale
      Oct 11 '16 at 11:17










    • It worked for me. This is super useful for small SSD disks.
      – Adrian Lopez
      Apr 14 '17 at 15:54












    up vote
    8
    down vote










    up vote
    8
    down vote









    SwapSpace is a utility that creates a ‘dynamic swap file’ which according to the requirements of the operating system changes its size.



    So you can even forget about creating a virtual swap file and just install “SwapSpace” and it’ll automatically create one for you and will even resize it when necessary.



    You can also use ‘Swapspace’ side by side with a manually created swap file and when the manually one gets filled ‘Swapspace’ will automatically create another one for the OS so the OS will always have a swap space and it enhances the stability.



    Another useful thing about “SwapSpace” is that, whenever it can, it’ll reduce the size of the SwapSpace and “release” those bytes into user file system and according to the developers this reduction helps to increase the swap file’s performance as well (plus your “precious” HDD space is not wasted too).



    Install with



    sudo apt-get install swapspace


    And adjust the config file to your needs. I set the minimum to 0 on my VM debian machine with just 8GB HDD




    Additionally I also set the swappiness to 0 to minimize the usage of the precious HDD space on my VM:



    To change the system swappiness value, open /etc/sysctl.conf as root. Then, change or add this line to the file:



    vm.swappiness = 0


    (Reboot for the change to take effect)






    share|improve this answer












    SwapSpace is a utility that creates a ‘dynamic swap file’ which according to the requirements of the operating system changes its size.



    So you can even forget about creating a virtual swap file and just install “SwapSpace” and it’ll automatically create one for you and will even resize it when necessary.



    You can also use ‘Swapspace’ side by side with a manually created swap file and when the manually one gets filled ‘Swapspace’ will automatically create another one for the OS so the OS will always have a swap space and it enhances the stability.



    Another useful thing about “SwapSpace” is that, whenever it can, it’ll reduce the size of the SwapSpace and “release” those bytes into user file system and according to the developers this reduction helps to increase the swap file’s performance as well (plus your “precious” HDD space is not wasted too).



    Install with



    sudo apt-get install swapspace


    And adjust the config file to your needs. I set the minimum to 0 on my VM debian machine with just 8GB HDD




    Additionally I also set the swappiness to 0 to minimize the usage of the precious HDD space on my VM:



    To change the system swappiness value, open /etc/sysctl.conf as root. Then, change or add this line to the file:



    vm.swappiness = 0


    (Reboot for the change to take effect)







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Jun 4 '14 at 0:12









    rubo77

    7,3052469130




    7,3052469130











    • This won't support swsusp/suspending to swap file, unless the size of the created swap file is already big enough to contain the RAM dump.
      – soze
      Aug 26 '15 at 2:37










    • So how could we make sure that the swap file gets big enough to contain the ram?
      – rubo77
      Nov 29 '15 at 18:21










    • Have one fixed size swap file the size of RAM for suspending, and then use swapspace for dynamically sized swap
      – Tom Hale
      Oct 11 '16 at 11:17










    • It worked for me. This is super useful for small SSD disks.
      – Adrian Lopez
      Apr 14 '17 at 15:54
















    • This won't support swsusp/suspending to swap file, unless the size of the created swap file is already big enough to contain the RAM dump.
      – soze
      Aug 26 '15 at 2:37










    • So how could we make sure that the swap file gets big enough to contain the ram?
      – rubo77
      Nov 29 '15 at 18:21










    • Have one fixed size swap file the size of RAM for suspending, and then use swapspace for dynamically sized swap
      – Tom Hale
      Oct 11 '16 at 11:17










    • It worked for me. This is super useful for small SSD disks.
      – Adrian Lopez
      Apr 14 '17 at 15:54















    This won't support swsusp/suspending to swap file, unless the size of the created swap file is already big enough to contain the RAM dump.
    – soze
    Aug 26 '15 at 2:37




    This won't support swsusp/suspending to swap file, unless the size of the created swap file is already big enough to contain the RAM dump.
    – soze
    Aug 26 '15 at 2:37












    So how could we make sure that the swap file gets big enough to contain the ram?
    – rubo77
    Nov 29 '15 at 18:21




    So how could we make sure that the swap file gets big enough to contain the ram?
    – rubo77
    Nov 29 '15 at 18:21












    Have one fixed size swap file the size of RAM for suspending, and then use swapspace for dynamically sized swap
    – Tom Hale
    Oct 11 '16 at 11:17




    Have one fixed size swap file the size of RAM for suspending, and then use swapspace for dynamically sized swap
    – Tom Hale
    Oct 11 '16 at 11:17












    It worked for me. This is super useful for small SSD disks.
    – Adrian Lopez
    Apr 14 '17 at 15:54




    It worked for me. This is super useful for small SSD disks.
    – Adrian Lopez
    Apr 14 '17 at 15:54












    up vote
    0
    down vote













    Afaik, any swap partition that you would make using fdisk for example, would need any space greater than 0, as you are modifying the space from an existing disk and reallocating it into somewhere else.



    Anyway, and answering your question, you can easily make a small partition, assign it as swap under fdisk, and afterwards:



    1) disable swapping with swapoff -v
    2) resize partition with lvresize
    3) format the partition with mkswap
    4) re-enable the swap space with swapon -v



    Afterwards, you can use cat /proc/swaps to check if it has been upgraded or not. You can easily use this on a script, depending on your system specs, and run it on demand for whenever you need to increase that swap space. Something like:



    $ swapoff -v /dev/swapvol1
    $ lvresize /dev/swapvol1 -L +1G
    $ mkswap /dev/swapvol1
    $ swapon -v /dev/swapvol1





    share|improve this answer




















    • This doesn't answer the question because the swap size is changed manually, not on demand. Furthermore, resizing the LV isn't useful: where do you find the space to grow? how is the freed space on shrinking not wasted? The question asks about a swap file, which solves the issue of the free space — it's available for other files.
      – Gilles
      Jun 3 '14 at 22:58










    • Changing the swap size on demand is a good idea, but swapspace does not cover the scenario of swsusp being used for supporting hibernation. I believe this answer might be more sane for those users who need hibernation support. Until swapspace handles that better, of course.
      – soze
      Aug 26 '15 at 2:40














    up vote
    0
    down vote













    Afaik, any swap partition that you would make using fdisk for example, would need any space greater than 0, as you are modifying the space from an existing disk and reallocating it into somewhere else.



    Anyway, and answering your question, you can easily make a small partition, assign it as swap under fdisk, and afterwards:



    1) disable swapping with swapoff -v
    2) resize partition with lvresize
    3) format the partition with mkswap
    4) re-enable the swap space with swapon -v



    Afterwards, you can use cat /proc/swaps to check if it has been upgraded or not. You can easily use this on a script, depending on your system specs, and run it on demand for whenever you need to increase that swap space. Something like:



    $ swapoff -v /dev/swapvol1
    $ lvresize /dev/swapvol1 -L +1G
    $ mkswap /dev/swapvol1
    $ swapon -v /dev/swapvol1





    share|improve this answer




















    • This doesn't answer the question because the swap size is changed manually, not on demand. Furthermore, resizing the LV isn't useful: where do you find the space to grow? how is the freed space on shrinking not wasted? The question asks about a swap file, which solves the issue of the free space — it's available for other files.
      – Gilles
      Jun 3 '14 at 22:58










    • Changing the swap size on demand is a good idea, but swapspace does not cover the scenario of swsusp being used for supporting hibernation. I believe this answer might be more sane for those users who need hibernation support. Until swapspace handles that better, of course.
      – soze
      Aug 26 '15 at 2:40












    up vote
    0
    down vote










    up vote
    0
    down vote









    Afaik, any swap partition that you would make using fdisk for example, would need any space greater than 0, as you are modifying the space from an existing disk and reallocating it into somewhere else.



    Anyway, and answering your question, you can easily make a small partition, assign it as swap under fdisk, and afterwards:



    1) disable swapping with swapoff -v
    2) resize partition with lvresize
    3) format the partition with mkswap
    4) re-enable the swap space with swapon -v



    Afterwards, you can use cat /proc/swaps to check if it has been upgraded or not. You can easily use this on a script, depending on your system specs, and run it on demand for whenever you need to increase that swap space. Something like:



    $ swapoff -v /dev/swapvol1
    $ lvresize /dev/swapvol1 -L +1G
    $ mkswap /dev/swapvol1
    $ swapon -v /dev/swapvol1





    share|improve this answer












    Afaik, any swap partition that you would make using fdisk for example, would need any space greater than 0, as you are modifying the space from an existing disk and reallocating it into somewhere else.



    Anyway, and answering your question, you can easily make a small partition, assign it as swap under fdisk, and afterwards:



    1) disable swapping with swapoff -v
    2) resize partition with lvresize
    3) format the partition with mkswap
    4) re-enable the swap space with swapon -v



    Afterwards, you can use cat /proc/swaps to check if it has been upgraded or not. You can easily use this on a script, depending on your system specs, and run it on demand for whenever you need to increase that swap space. Something like:



    $ swapoff -v /dev/swapvol1
    $ lvresize /dev/swapvol1 -L +1G
    $ mkswap /dev/swapvol1
    $ swapon -v /dev/swapvol1






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Jun 3 '14 at 13:00









    AleksanderKseniya

    70853




    70853











    • This doesn't answer the question because the swap size is changed manually, not on demand. Furthermore, resizing the LV isn't useful: where do you find the space to grow? how is the freed space on shrinking not wasted? The question asks about a swap file, which solves the issue of the free space — it's available for other files.
      – Gilles
      Jun 3 '14 at 22:58










    • Changing the swap size on demand is a good idea, but swapspace does not cover the scenario of swsusp being used for supporting hibernation. I believe this answer might be more sane for those users who need hibernation support. Until swapspace handles that better, of course.
      – soze
      Aug 26 '15 at 2:40
















    • This doesn't answer the question because the swap size is changed manually, not on demand. Furthermore, resizing the LV isn't useful: where do you find the space to grow? how is the freed space on shrinking not wasted? The question asks about a swap file, which solves the issue of the free space — it's available for other files.
      – Gilles
      Jun 3 '14 at 22:58










    • Changing the swap size on demand is a good idea, but swapspace does not cover the scenario of swsusp being used for supporting hibernation. I believe this answer might be more sane for those users who need hibernation support. Until swapspace handles that better, of course.
      – soze
      Aug 26 '15 at 2:40















    This doesn't answer the question because the swap size is changed manually, not on demand. Furthermore, resizing the LV isn't useful: where do you find the space to grow? how is the freed space on shrinking not wasted? The question asks about a swap file, which solves the issue of the free space — it's available for other files.
    – Gilles
    Jun 3 '14 at 22:58




    This doesn't answer the question because the swap size is changed manually, not on demand. Furthermore, resizing the LV isn't useful: where do you find the space to grow? how is the freed space on shrinking not wasted? The question asks about a swap file, which solves the issue of the free space — it's available for other files.
    – Gilles
    Jun 3 '14 at 22:58












    Changing the swap size on demand is a good idea, but swapspace does not cover the scenario of swsusp being used for supporting hibernation. I believe this answer might be more sane for those users who need hibernation support. Until swapspace handles that better, of course.
    – soze
    Aug 26 '15 at 2:40




    Changing the swap size on demand is a good idea, but swapspace does not cover the scenario of swsusp being used for supporting hibernation. I believe this answer might be more sane for those users who need hibernation support. Until swapspace handles that better, of course.
    – soze
    Aug 26 '15 at 2:40










    up vote
    0
    down vote













    Swapspace is old and unmaintained and could lead, one day, to problems in modern systems. I think that the best solution for dynamic swap is to:



    sudo apt install dphys-swapfile
    sudo update-rc.d dphys-swapfile enable


    then setting CONF_SWAPFACTOR=2 in /etc/dphys-swapfile and finally



    sudo service dphys-swapfile start





    share|improve this answer
























      up vote
      0
      down vote













      Swapspace is old and unmaintained and could lead, one day, to problems in modern systems. I think that the best solution for dynamic swap is to:



      sudo apt install dphys-swapfile
      sudo update-rc.d dphys-swapfile enable


      then setting CONF_SWAPFACTOR=2 in /etc/dphys-swapfile and finally



      sudo service dphys-swapfile start





      share|improve this answer






















        up vote
        0
        down vote










        up vote
        0
        down vote









        Swapspace is old and unmaintained and could lead, one day, to problems in modern systems. I think that the best solution for dynamic swap is to:



        sudo apt install dphys-swapfile
        sudo update-rc.d dphys-swapfile enable


        then setting CONF_SWAPFACTOR=2 in /etc/dphys-swapfile and finally



        sudo service dphys-swapfile start





        share|improve this answer












        Swapspace is old and unmaintained and could lead, one day, to problems in modern systems. I think that the best solution for dynamic swap is to:



        sudo apt install dphys-swapfile
        sudo update-rc.d dphys-swapfile enable


        then setting CONF_SWAPFACTOR=2 in /etc/dphys-swapfile and finally



        sudo service dphys-swapfile start






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 26 at 10:32









        Denis Pitzalis

        1313




        1313



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f134258%2fdynamically-growing-swap-file-on-debian%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown






            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay