Virtualbox dynamically-allocated disk *.vdi keeps growing

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











up vote
1
down vote

favorite












When using Linux in Virtualbox and dynamically-allocated disk, it keeps growing even though almost half of space is free:



Filesystem Size Used Avail Use% Mounted on
/dev/sda2 94G 12G 78G 13% /


This disk takes >24G on disk and keeps growing, filesystem ext4.







share|improve this question
























    up vote
    1
    down vote

    favorite












    When using Linux in Virtualbox and dynamically-allocated disk, it keeps growing even though almost half of space is free:



    Filesystem Size Used Avail Use% Mounted on
    /dev/sda2 94G 12G 78G 13% /


    This disk takes >24G on disk and keeps growing, filesystem ext4.







    share|improve this question






















      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      When using Linux in Virtualbox and dynamically-allocated disk, it keeps growing even though almost half of space is free:



      Filesystem Size Used Avail Use% Mounted on
      /dev/sda2 94G 12G 78G 13% /


      This disk takes >24G on disk and keeps growing, filesystem ext4.







      share|improve this question












      When using Linux in Virtualbox and dynamically-allocated disk, it keeps growing even though almost half of space is free:



      Filesystem Size Used Avail Use% Mounted on
      /dev/sda2 94G 12G 78G 13% /


      This disk takes >24G on disk and keeps growing, filesystem ext4.









      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 28 '17 at 8:00









      kirill-a

      2,0351820




      2,0351820




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          In order to discard unused blocks on filesystem there is a command fstrim, part of util-linux package.
          But to use it on Virtualbox, it is needed to enable discard option on your virtual disk by stopping you VM and running the following command:



          VBoxManage storageattach <VM name> --storagectl "SATA" --port 0 --discard on



          where "SATA" and 0 are parameters of your disk controller, can be checked in VB settings for your specific VM.



          Then boot your machine and run



          # fstrim /



          To automate this process, add this command to cron, once in a week is usually enough.






          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: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            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%2f407437%2fvirtualbox-dynamically-allocated-disk-vdi-keeps-growing%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            2
            down vote



            accepted










            In order to discard unused blocks on filesystem there is a command fstrim, part of util-linux package.
            But to use it on Virtualbox, it is needed to enable discard option on your virtual disk by stopping you VM and running the following command:



            VBoxManage storageattach <VM name> --storagectl "SATA" --port 0 --discard on



            where "SATA" and 0 are parameters of your disk controller, can be checked in VB settings for your specific VM.



            Then boot your machine and run



            # fstrim /



            To automate this process, add this command to cron, once in a week is usually enough.






            share|improve this answer
























              up vote
              2
              down vote



              accepted










              In order to discard unused blocks on filesystem there is a command fstrim, part of util-linux package.
              But to use it on Virtualbox, it is needed to enable discard option on your virtual disk by stopping you VM and running the following command:



              VBoxManage storageattach <VM name> --storagectl "SATA" --port 0 --discard on



              where "SATA" and 0 are parameters of your disk controller, can be checked in VB settings for your specific VM.



              Then boot your machine and run



              # fstrim /



              To automate this process, add this command to cron, once in a week is usually enough.






              share|improve this answer






















                up vote
                2
                down vote



                accepted







                up vote
                2
                down vote



                accepted






                In order to discard unused blocks on filesystem there is a command fstrim, part of util-linux package.
                But to use it on Virtualbox, it is needed to enable discard option on your virtual disk by stopping you VM and running the following command:



                VBoxManage storageattach <VM name> --storagectl "SATA" --port 0 --discard on



                where "SATA" and 0 are parameters of your disk controller, can be checked in VB settings for your specific VM.



                Then boot your machine and run



                # fstrim /



                To automate this process, add this command to cron, once in a week is usually enough.






                share|improve this answer












                In order to discard unused blocks on filesystem there is a command fstrim, part of util-linux package.
                But to use it on Virtualbox, it is needed to enable discard option on your virtual disk by stopping you VM and running the following command:



                VBoxManage storageattach <VM name> --storagectl "SATA" --port 0 --discard on



                where "SATA" and 0 are parameters of your disk controller, can be checked in VB settings for your specific VM.



                Then boot your machine and run



                # fstrim /



                To automate this process, add this command to cron, once in a week is usually enough.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 28 '17 at 8:00









                kirill-a

                2,0351820




                2,0351820



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f407437%2fvirtualbox-dynamically-allocated-disk-vdi-keeps-growing%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

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

                    Displaying single band from multi-band raster using QGIS

                    How many registers does an x86_64 CPU actually have?