Can't reduce swap size The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)How do I add more swap easily so that I can hibernate my laptop?How do I calculate a SWAP partition?How to extend logical volume swap space to atleast 64 GB on SSDStrange Swap behaviour on Ubuntu 14.04 LTSHelp with swap on Ubuntu 16.04 LTSFully encrypted setup can't start after cold reset because of encrypted swap and main partitionHow do I resize my Ubuntu partition?Swap partition size for 32GB RAMConvert swap partition to a fileCannot increase size of swap partition under lvm

Is every episode of "Where are my Pants?" identical?

60's-70's movie: home appliances revolting against the owners

different output for groups and groups USERNAME after adding a username to a group

Why don't hard Brexiteers insist on a hard border to prevent illegal immigration after Brexit?

Variable with quotation marks "$()"

Single author papers against my advisor's will?

What was the last x86 CPU that did not have the x87 floating-point unit built in?

What to do when moving next to a bird sanctuary with a loosely-domesticated cat?

Sort list of array linked objects by keys and values

What happens to a Warlock's expended Spell Slots when they gain a Level?

Why doesn't a hydraulic lever violate conservation of energy?

Does Parliament hold absolute power in the UK?

Would an alien lifeform be able to achieve space travel if lacking in vision?

How do you keep chess fun when your opponent constantly beats you?

How to support a colleague who finds meetings extremely tiring?

Word for: a synonym with a positive connotation?

Can withdrawing asylum be illegal?

Example of compact Riemannian manifold with only one geodesic.

Accepted by European university, rejected by all American ones I applied to? Possible reasons?

How to handle characters who are more educated than the author?

One-dimensional Japanese puzzle

The following signatures were invalid: EXPKEYSIG 1397BC53640DB551

Are there continuous functions who are the same in an interval but differ in at least one other point?

Word to describe a time interval



Can't reduce swap size



The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)How do I add more swap easily so that I can hibernate my laptop?How do I calculate a SWAP partition?How to extend logical volume swap space to atleast 64 GB on SSDStrange Swap behaviour on Ubuntu 14.04 LTSHelp with swap on Ubuntu 16.04 LTSFully encrypted setup can't start after cold reset because of encrypted swap and main partitionHow do I resize my Ubuntu partition?Swap partition size for 32GB RAMConvert swap partition to a fileCannot increase size of swap partition under lvm



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















I'm building my first Ubuntu server and I'm struggling with with the swap size.



I have 16GB RAM, however the disk space is limited as I'll be running multiple VM's. I've created a partition for the host machine with 20GB which will be more than enough to start with.



However, when I look at the Logical Volumes through Webmin, the SWAP_1 volume has got about 15GB taking almost the entire partition for nothing.



I'm new to Linux and did my research into how to reduce/remove the swap but couldn't get it to work.
I've added the following line:



vm.swappiness=0


on



/etc/sysctl.conf


I have rebooted the system and the swap size remains the same.
I have also tried to switch swap off through the command:



swapoff -a


But that also did not work.



I'm a bit confused with all of these things as it is a kind a new world for me.



All I want is to have as close as 20GB as possible available on my partition.










share|improve this question
























  • SWAP Partition is created before install. It has a fixed size. if it is 15GB in size, it is that way. swap partition size is not dynamic. Your swap partition will remain after you disabled swapping. You'll have to delete it. I am not sure what will happen without swap Partition if RAM gets full.

    – mondjunge
    Oct 14 '13 at 12:29

















2















I'm building my first Ubuntu server and I'm struggling with with the swap size.



I have 16GB RAM, however the disk space is limited as I'll be running multiple VM's. I've created a partition for the host machine with 20GB which will be more than enough to start with.



However, when I look at the Logical Volumes through Webmin, the SWAP_1 volume has got about 15GB taking almost the entire partition for nothing.



I'm new to Linux and did my research into how to reduce/remove the swap but couldn't get it to work.
I've added the following line:



vm.swappiness=0


on



/etc/sysctl.conf


I have rebooted the system and the swap size remains the same.
I have also tried to switch swap off through the command:



swapoff -a


But that also did not work.



I'm a bit confused with all of these things as it is a kind a new world for me.



All I want is to have as close as 20GB as possible available on my partition.










share|improve this question
























  • SWAP Partition is created before install. It has a fixed size. if it is 15GB in size, it is that way. swap partition size is not dynamic. Your swap partition will remain after you disabled swapping. You'll have to delete it. I am not sure what will happen without swap Partition if RAM gets full.

    – mondjunge
    Oct 14 '13 at 12:29













2












2








2


1






I'm building my first Ubuntu server and I'm struggling with with the swap size.



I have 16GB RAM, however the disk space is limited as I'll be running multiple VM's. I've created a partition for the host machine with 20GB which will be more than enough to start with.



However, when I look at the Logical Volumes through Webmin, the SWAP_1 volume has got about 15GB taking almost the entire partition for nothing.



I'm new to Linux and did my research into how to reduce/remove the swap but couldn't get it to work.
I've added the following line:



vm.swappiness=0


on



/etc/sysctl.conf


I have rebooted the system and the swap size remains the same.
I have also tried to switch swap off through the command:



swapoff -a


But that also did not work.



I'm a bit confused with all of these things as it is a kind a new world for me.



All I want is to have as close as 20GB as possible available on my partition.










share|improve this question
















I'm building my first Ubuntu server and I'm struggling with with the swap size.



I have 16GB RAM, however the disk space is limited as I'll be running multiple VM's. I've created a partition for the host machine with 20GB which will be more than enough to start with.



However, when I look at the Logical Volumes through Webmin, the SWAP_1 volume has got about 15GB taking almost the entire partition for nothing.



I'm new to Linux and did my research into how to reduce/remove the swap but couldn't get it to work.
I've added the following line:



vm.swappiness=0


on



/etc/sysctl.conf


I have rebooted the system and the swap size remains the same.
I have also tried to switch swap off through the command:



swapoff -a


But that also did not work.



I'm a bit confused with all of these things as it is a kind a new world for me.



All I want is to have as close as 20GB as possible available on my partition.







server partitioning swap






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 days ago









Kevin Bowen

14.9k155971




14.9k155971










asked Oct 14 '13 at 12:06









J.BJ.B

1154




1154












  • SWAP Partition is created before install. It has a fixed size. if it is 15GB in size, it is that way. swap partition size is not dynamic. Your swap partition will remain after you disabled swapping. You'll have to delete it. I am not sure what will happen without swap Partition if RAM gets full.

    – mondjunge
    Oct 14 '13 at 12:29

















  • SWAP Partition is created before install. It has a fixed size. if it is 15GB in size, it is that way. swap partition size is not dynamic. Your swap partition will remain after you disabled swapping. You'll have to delete it. I am not sure what will happen without swap Partition if RAM gets full.

    – mondjunge
    Oct 14 '13 at 12:29
















SWAP Partition is created before install. It has a fixed size. if it is 15GB in size, it is that way. swap partition size is not dynamic. Your swap partition will remain after you disabled swapping. You'll have to delete it. I am not sure what will happen without swap Partition if RAM gets full.

– mondjunge
Oct 14 '13 at 12:29





SWAP Partition is created before install. It has a fixed size. if it is 15GB in size, it is that way. swap partition size is not dynamic. Your swap partition will remain after you disabled swapping. You'll have to delete it. I am not sure what will happen without swap Partition if RAM gets full.

– mondjunge
Oct 14 '13 at 12:29










1 Answer
1






active

oldest

votes


















2














vm.swappiness controls the kernel's preference on how much to use swap vs trimming back the filesystem cache to free up memory. swapoff stops using swap. Neither has a thing to do with disk partitions. If you are using LVM, then you want lvresize to change the size of the volume.



sudo -s
cat /etc/fstab
swapoff -a
lvresize vg0/SWAP_1 -L 4G
mkswap -U long-uuid-here /dev/vg0/SWAP_1
swapon -a


Look at your /etc/fstab and figure out the uuid of the swap volume and copy/paste that into the mkswap line so that it will be reformatted to the new size, but keep the old uuid.



Alternatively since you have plenty of ram, you could do without swap entirely. Edit /etc/fstab to remove the swap line after running swapoff -a, then use lvremove vgo/SWAP_1 to delete the volume.






share|improve this answer























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "89"
    ;
    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',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    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%2faskubuntu.com%2fquestions%2f358908%2fcant-reduce-swap-size%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    vm.swappiness controls the kernel's preference on how much to use swap vs trimming back the filesystem cache to free up memory. swapoff stops using swap. Neither has a thing to do with disk partitions. If you are using LVM, then you want lvresize to change the size of the volume.



    sudo -s
    cat /etc/fstab
    swapoff -a
    lvresize vg0/SWAP_1 -L 4G
    mkswap -U long-uuid-here /dev/vg0/SWAP_1
    swapon -a


    Look at your /etc/fstab and figure out the uuid of the swap volume and copy/paste that into the mkswap line so that it will be reformatted to the new size, but keep the old uuid.



    Alternatively since you have plenty of ram, you could do without swap entirely. Edit /etc/fstab to remove the swap line after running swapoff -a, then use lvremove vgo/SWAP_1 to delete the volume.






    share|improve this answer



























      2














      vm.swappiness controls the kernel's preference on how much to use swap vs trimming back the filesystem cache to free up memory. swapoff stops using swap. Neither has a thing to do with disk partitions. If you are using LVM, then you want lvresize to change the size of the volume.



      sudo -s
      cat /etc/fstab
      swapoff -a
      lvresize vg0/SWAP_1 -L 4G
      mkswap -U long-uuid-here /dev/vg0/SWAP_1
      swapon -a


      Look at your /etc/fstab and figure out the uuid of the swap volume and copy/paste that into the mkswap line so that it will be reformatted to the new size, but keep the old uuid.



      Alternatively since you have plenty of ram, you could do without swap entirely. Edit /etc/fstab to remove the swap line after running swapoff -a, then use lvremove vgo/SWAP_1 to delete the volume.






      share|improve this answer

























        2












        2








        2







        vm.swappiness controls the kernel's preference on how much to use swap vs trimming back the filesystem cache to free up memory. swapoff stops using swap. Neither has a thing to do with disk partitions. If you are using LVM, then you want lvresize to change the size of the volume.



        sudo -s
        cat /etc/fstab
        swapoff -a
        lvresize vg0/SWAP_1 -L 4G
        mkswap -U long-uuid-here /dev/vg0/SWAP_1
        swapon -a


        Look at your /etc/fstab and figure out the uuid of the swap volume and copy/paste that into the mkswap line so that it will be reformatted to the new size, but keep the old uuid.



        Alternatively since you have plenty of ram, you could do without swap entirely. Edit /etc/fstab to remove the swap line after running swapoff -a, then use lvremove vgo/SWAP_1 to delete the volume.






        share|improve this answer













        vm.swappiness controls the kernel's preference on how much to use swap vs trimming back the filesystem cache to free up memory. swapoff stops using swap. Neither has a thing to do with disk partitions. If you are using LVM, then you want lvresize to change the size of the volume.



        sudo -s
        cat /etc/fstab
        swapoff -a
        lvresize vg0/SWAP_1 -L 4G
        mkswap -U long-uuid-here /dev/vg0/SWAP_1
        swapon -a


        Look at your /etc/fstab and figure out the uuid of the swap volume and copy/paste that into the mkswap line so that it will be reformatted to the new size, but keep the old uuid.



        Alternatively since you have plenty of ram, you could do without swap entirely. Edit /etc/fstab to remove the swap line after running swapoff -a, then use lvremove vgo/SWAP_1 to delete the volume.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Oct 14 '13 at 13:23









        psusipsusi

        31.5k15192




        31.5k15192



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Ask Ubuntu!


            • 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%2faskubuntu.com%2fquestions%2f358908%2fcant-reduce-swap-size%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

            Tamil (spriik) Luke uk diar | Nawigatjuun

            Align equal signs while including text over equalitiesAMS align: left aligned text/math plus multicolumn alignmentMultiple alignmentsAligning equations in multiple placesNumbering and aligning an equation with multiple columnsHow to align one equation with another multline equationUsing \ in environments inside the begintabularxNumber equations and preserving alignment of equal signsHow can I align equations to the left and to the right?Double equation alignment problem within align enviromentAligned within align: Why are they right-aligned?

            Training a classifier when some of the features are unknownWhy does Gradient Boosting regression predict negative values when there are no negative y-values in my training set?How to improve an existing (trained) classifier?What is effect when I set up some self defined predisctor variables?Why Matlab neural network classification returns decimal values on prediction dataset?Fitting and transforming text data in training, testing, and validation setsHow to quantify the performance of the classifier (multi-class SVM) using the test data?How do I control for some patients providing multiple samples in my training data?Training and Test setTraining a convolutional neural network for image denoising in MatlabShouldn't an autoencoder with #(neurons in hidden layer) = #(neurons in input layer) be “perfect”?