A command which checks that trim is working?How to enable TRIM?Unsure about TRIM enabled on my SSDAutomatic...

Cat is tipping over bed-side lamps during the night

The No-Straight Maze

Boss asked me to sign a resignation paper without a date on it along with my new contract

What to do with threats of blacklisting?

Does the ditching switch allow an A320 to float indefinitely?

What is a good reason for every spaceship to carry a weapon on board?

How much light is too much?

Concatenating two int[]

Is there a way to not have to poll the UART of an AVR?

Eww, those bytes are gross

What does MTU depend on?

Single-row INSERT...SELECT much slower than separate SELECT

Website seeing my Facebook data?

Are the positive and negative planes inner or outer planes in the Great Wheel cosmology model?

How can I prevent an oracle who can see into the past from knowing everything that has happened?

Is there a file that always exists and a 'normal' user can't lstat it?

Why did Luke use his left hand to shoot?

Why is it that Bernie Sanders is always called a "socialist"?

What can I do to encourage my players to use their consumables?

What senses are available to a corpse subjected to a Speak with Dead spell?

Can a player sacrifice a creature after declaring that creature as blocker while taking lethal damage?

Does Skippy chunky peanut butter contain trans fat?

How to politely refuse in-office gym instructor for steroids and protein

Book where a space ship journeys to the center of the galaxy to find all the stars had gone supernova



A command which checks that trim is working?


How to enable TRIM?Unsure about TRIM enabled on my SSDAutomatic TRIM vs. manual TRIMTrim and SSD with usb 3.0 enclosure does not work - UASP not supported?Is TRIM on by default in 13.04?Does TRIM work with FAT32?Will be TRIM enabled by default?Can Ubuntu TRIM another (NTFS) partition?Do I need to enable TRIM if I have a non-Intel/SamsungTrim supports for Kington SSD is in default or not?













4















I have installed Ubuntu 14.04 LTS 64bit, and would like to make sure that TRIM is enabled (as much as I know - it is enabled by default). Is there some sort of command which would help me to find out if it is working correctly?










share|improve this question

























  • Read this

    – girardengo
    May 11 '14 at 12:45


















4















I have installed Ubuntu 14.04 LTS 64bit, and would like to make sure that TRIM is enabled (as much as I know - it is enabled by default). Is there some sort of command which would help me to find out if it is working correctly?










share|improve this question

























  • Read this

    – girardengo
    May 11 '14 at 12:45
















4












4








4








I have installed Ubuntu 14.04 LTS 64bit, and would like to make sure that TRIM is enabled (as much as I know - it is enabled by default). Is there some sort of command which would help me to find out if it is working correctly?










share|improve this question
















I have installed Ubuntu 14.04 LTS 64bit, and would like to make sure that TRIM is enabled (as much as I know - it is enabled by default). Is there some sort of command which would help me to find out if it is working correctly?







trim






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 8 '16 at 9:37









thirtythreeforty

1,132619




1,132619










asked May 11 '14 at 12:18









MariusMarius

484169




484169













  • Read this

    – girardengo
    May 11 '14 at 12:45





















  • Read this

    – girardengo
    May 11 '14 at 12:45



















Read this

– girardengo
May 11 '14 at 12:45







Read this

– girardengo
May 11 '14 at 12:45












3 Answers
3






active

oldest

votes


















5














You can perform a sudo fstrim -v / (replace "/" with other mountpoints, if you have any), to check if fstrim gives any errors.
If it doesn't, type in cat /etc/cron.weekly/fstrim which should give you an output like:



#!/bin/sh
# call fstrim-all to trim all mounted file systems which support it
set -e
#
# This only runs on Intel and Samsung SSDs by default, as some SSDs with
# faulty firmware may encounter data loss when running fstrim under high I/O
# load (e. g. https://launchpad.net/bugs/1259829). You can append the
# --no-model-check option here to disable the vendor check and run fstrim on
# all SSD drives Like this (remove the hash):
#exec fstrim-all --no-model-check
exec fstrim-all


If it does, it means, that your Ubuntu automatically recognized that you have an SSD and will trim it once a week as a cron job.



If you like to optimize your system for SSD, check out this article.






share|improve this answer

































    1














    I would suggest that a more direct, if somewhat more complex, way to ensure that trim is working is by creating a file, identifying precisely where this file is stored, checking the contents of the file at this location, deleting the file, and then re-checking the contents of the file's location. If trim is working, the original contents of the file will have been replaced by zeros. The method and the specific commands to conduct this test are documented at: http://andyduffell.com/techblog/?p=852. A specific example of the technique is provided at: https://linuxnorth.wordpress.com/2014/03/18/trim-your-ssd-down-to-size/






    share|improve this answer































      0
















      On 18.04, you may check it in syslog:



      cat /var/log/syslog | grep -a fstrim | tail


      if you see recent dates and all your SSD's mountpoints, it's working. Sample output:



      Oct  1 14:54:55 justapc fstrim[769]: /home: 80,1 GiB (86008037376 bytes) trimmed
      Oct 1 14:54:55 justapc fstrim[769]: /boot: 360,2 MiB (377663488 bytes) trimmed
      Oct 1 14:54:55 justapc fstrim[769]: /: 16,3 GiB (17486880768 bytes) trimmed
      Oct 8 08:16:01 justapc fstrim[792]: /home: 76,8 GiB (82423615488 bytes) trimmed
      Oct 8 08:16:01 justapc fstrim[792]: /boot: 360,1 MiB (377634816 bytes) trimmed
      Oct 8 08:16:01 justapc fstrim[792]: /: 15,9 GiB (17038168064 bytes) trimmed
      Oct 8 08:16:44 justapc ureadahead[283]: ureadahead:trimage_trimage.png: Ignored relative path
      Oct 15 20:14:00 justapc fstrim[749]: /home: 73,5 GiB (78863814656 bytes) trimmed
      Oct 15 20:14:00 justapc fstrim[749]: /boot: 360,1 MiB (377634816 bytes) trimmed
      Oct 15 20:14:00 justapc fstrim[749]: /: 16 GiB (17104076800 bytes) trimmed


      To be sure of any possible errors, verbose fstrim manually:



      for mountpoint in $(cat /etc/fstab | awk '/ext[0-9]/ {print $2}'); do sudo fstrim -v "$mountpoint"; done





      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%2f464306%2fa-command-which-checks-that-trim-is-working%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









        5














        You can perform a sudo fstrim -v / (replace "/" with other mountpoints, if you have any), to check if fstrim gives any errors.
        If it doesn't, type in cat /etc/cron.weekly/fstrim which should give you an output like:



        #!/bin/sh
        # call fstrim-all to trim all mounted file systems which support it
        set -e
        #
        # This only runs on Intel and Samsung SSDs by default, as some SSDs with
        # faulty firmware may encounter data loss when running fstrim under high I/O
        # load (e. g. https://launchpad.net/bugs/1259829). You can append the
        # --no-model-check option here to disable the vendor check and run fstrim on
        # all SSD drives Like this (remove the hash):
        #exec fstrim-all --no-model-check
        exec fstrim-all


        If it does, it means, that your Ubuntu automatically recognized that you have an SSD and will trim it once a week as a cron job.



        If you like to optimize your system for SSD, check out this article.






        share|improve this answer






























          5














          You can perform a sudo fstrim -v / (replace "/" with other mountpoints, if you have any), to check if fstrim gives any errors.
          If it doesn't, type in cat /etc/cron.weekly/fstrim which should give you an output like:



          #!/bin/sh
          # call fstrim-all to trim all mounted file systems which support it
          set -e
          #
          # This only runs on Intel and Samsung SSDs by default, as some SSDs with
          # faulty firmware may encounter data loss when running fstrim under high I/O
          # load (e. g. https://launchpad.net/bugs/1259829). You can append the
          # --no-model-check option here to disable the vendor check and run fstrim on
          # all SSD drives Like this (remove the hash):
          #exec fstrim-all --no-model-check
          exec fstrim-all


          If it does, it means, that your Ubuntu automatically recognized that you have an SSD and will trim it once a week as a cron job.



          If you like to optimize your system for SSD, check out this article.






          share|improve this answer




























            5












            5








            5







            You can perform a sudo fstrim -v / (replace "/" with other mountpoints, if you have any), to check if fstrim gives any errors.
            If it doesn't, type in cat /etc/cron.weekly/fstrim which should give you an output like:



            #!/bin/sh
            # call fstrim-all to trim all mounted file systems which support it
            set -e
            #
            # This only runs on Intel and Samsung SSDs by default, as some SSDs with
            # faulty firmware may encounter data loss when running fstrim under high I/O
            # load (e. g. https://launchpad.net/bugs/1259829). You can append the
            # --no-model-check option here to disable the vendor check and run fstrim on
            # all SSD drives Like this (remove the hash):
            #exec fstrim-all --no-model-check
            exec fstrim-all


            If it does, it means, that your Ubuntu automatically recognized that you have an SSD and will trim it once a week as a cron job.



            If you like to optimize your system for SSD, check out this article.






            share|improve this answer















            You can perform a sudo fstrim -v / (replace "/" with other mountpoints, if you have any), to check if fstrim gives any errors.
            If it doesn't, type in cat /etc/cron.weekly/fstrim which should give you an output like:



            #!/bin/sh
            # call fstrim-all to trim all mounted file systems which support it
            set -e
            #
            # This only runs on Intel and Samsung SSDs by default, as some SSDs with
            # faulty firmware may encounter data loss when running fstrim under high I/O
            # load (e. g. https://launchpad.net/bugs/1259829). You can append the
            # --no-model-check option here to disable the vendor check and run fstrim on
            # all SSD drives Like this (remove the hash):
            #exec fstrim-all --no-model-check
            exec fstrim-all


            If it does, it means, that your Ubuntu automatically recognized that you have an SSD and will trim it once a week as a cron job.



            If you like to optimize your system for SSD, check out this article.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited May 11 '14 at 12:57









            karel

            59.6k13129151




            59.6k13129151










            answered May 11 '14 at 12:53









            BelfryGhostBelfryGhost

            1645




            1645

























                1














                I would suggest that a more direct, if somewhat more complex, way to ensure that trim is working is by creating a file, identifying precisely where this file is stored, checking the contents of the file at this location, deleting the file, and then re-checking the contents of the file's location. If trim is working, the original contents of the file will have been replaced by zeros. The method and the specific commands to conduct this test are documented at: http://andyduffell.com/techblog/?p=852. A specific example of the technique is provided at: https://linuxnorth.wordpress.com/2014/03/18/trim-your-ssd-down-to-size/






                share|improve this answer




























                  1














                  I would suggest that a more direct, if somewhat more complex, way to ensure that trim is working is by creating a file, identifying precisely where this file is stored, checking the contents of the file at this location, deleting the file, and then re-checking the contents of the file's location. If trim is working, the original contents of the file will have been replaced by zeros. The method and the specific commands to conduct this test are documented at: http://andyduffell.com/techblog/?p=852. A specific example of the technique is provided at: https://linuxnorth.wordpress.com/2014/03/18/trim-your-ssd-down-to-size/






                  share|improve this answer


























                    1












                    1








                    1







                    I would suggest that a more direct, if somewhat more complex, way to ensure that trim is working is by creating a file, identifying precisely where this file is stored, checking the contents of the file at this location, deleting the file, and then re-checking the contents of the file's location. If trim is working, the original contents of the file will have been replaced by zeros. The method and the specific commands to conduct this test are documented at: http://andyduffell.com/techblog/?p=852. A specific example of the technique is provided at: https://linuxnorth.wordpress.com/2014/03/18/trim-your-ssd-down-to-size/






                    share|improve this answer













                    I would suggest that a more direct, if somewhat more complex, way to ensure that trim is working is by creating a file, identifying precisely where this file is stored, checking the contents of the file at this location, deleting the file, and then re-checking the contents of the file's location. If trim is working, the original contents of the file will have been replaced by zeros. The method and the specific commands to conduct this test are documented at: http://andyduffell.com/techblog/?p=852. A specific example of the technique is provided at: https://linuxnorth.wordpress.com/2014/03/18/trim-your-ssd-down-to-size/







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Apr 28 '16 at 13:00









                    CentaurusACentaurusA

                    2,2351424




                    2,2351424























                        0
















                        On 18.04, you may check it in syslog:



                        cat /var/log/syslog | grep -a fstrim | tail


                        if you see recent dates and all your SSD's mountpoints, it's working. Sample output:



                        Oct  1 14:54:55 justapc fstrim[769]: /home: 80,1 GiB (86008037376 bytes) trimmed
                        Oct 1 14:54:55 justapc fstrim[769]: /boot: 360,2 MiB (377663488 bytes) trimmed
                        Oct 1 14:54:55 justapc fstrim[769]: /: 16,3 GiB (17486880768 bytes) trimmed
                        Oct 8 08:16:01 justapc fstrim[792]: /home: 76,8 GiB (82423615488 bytes) trimmed
                        Oct 8 08:16:01 justapc fstrim[792]: /boot: 360,1 MiB (377634816 bytes) trimmed
                        Oct 8 08:16:01 justapc fstrim[792]: /: 15,9 GiB (17038168064 bytes) trimmed
                        Oct 8 08:16:44 justapc ureadahead[283]: ureadahead:trimage_trimage.png: Ignored relative path
                        Oct 15 20:14:00 justapc fstrim[749]: /home: 73,5 GiB (78863814656 bytes) trimmed
                        Oct 15 20:14:00 justapc fstrim[749]: /boot: 360,1 MiB (377634816 bytes) trimmed
                        Oct 15 20:14:00 justapc fstrim[749]: /: 16 GiB (17104076800 bytes) trimmed


                        To be sure of any possible errors, verbose fstrim manually:



                        for mountpoint in $(cat /etc/fstab | awk '/ext[0-9]/ {print $2}'); do sudo fstrim -v "$mountpoint"; done





                        share|improve this answer






























                          0
















                          On 18.04, you may check it in syslog:



                          cat /var/log/syslog | grep -a fstrim | tail


                          if you see recent dates and all your SSD's mountpoints, it's working. Sample output:



                          Oct  1 14:54:55 justapc fstrim[769]: /home: 80,1 GiB (86008037376 bytes) trimmed
                          Oct 1 14:54:55 justapc fstrim[769]: /boot: 360,2 MiB (377663488 bytes) trimmed
                          Oct 1 14:54:55 justapc fstrim[769]: /: 16,3 GiB (17486880768 bytes) trimmed
                          Oct 8 08:16:01 justapc fstrim[792]: /home: 76,8 GiB (82423615488 bytes) trimmed
                          Oct 8 08:16:01 justapc fstrim[792]: /boot: 360,1 MiB (377634816 bytes) trimmed
                          Oct 8 08:16:01 justapc fstrim[792]: /: 15,9 GiB (17038168064 bytes) trimmed
                          Oct 8 08:16:44 justapc ureadahead[283]: ureadahead:trimage_trimage.png: Ignored relative path
                          Oct 15 20:14:00 justapc fstrim[749]: /home: 73,5 GiB (78863814656 bytes) trimmed
                          Oct 15 20:14:00 justapc fstrim[749]: /boot: 360,1 MiB (377634816 bytes) trimmed
                          Oct 15 20:14:00 justapc fstrim[749]: /: 16 GiB (17104076800 bytes) trimmed


                          To be sure of any possible errors, verbose fstrim manually:



                          for mountpoint in $(cat /etc/fstab | awk '/ext[0-9]/ {print $2}'); do sudo fstrim -v "$mountpoint"; done





                          share|improve this answer




























                            0












                            0








                            0









                            On 18.04, you may check it in syslog:



                            cat /var/log/syslog | grep -a fstrim | tail


                            if you see recent dates and all your SSD's mountpoints, it's working. Sample output:



                            Oct  1 14:54:55 justapc fstrim[769]: /home: 80,1 GiB (86008037376 bytes) trimmed
                            Oct 1 14:54:55 justapc fstrim[769]: /boot: 360,2 MiB (377663488 bytes) trimmed
                            Oct 1 14:54:55 justapc fstrim[769]: /: 16,3 GiB (17486880768 bytes) trimmed
                            Oct 8 08:16:01 justapc fstrim[792]: /home: 76,8 GiB (82423615488 bytes) trimmed
                            Oct 8 08:16:01 justapc fstrim[792]: /boot: 360,1 MiB (377634816 bytes) trimmed
                            Oct 8 08:16:01 justapc fstrim[792]: /: 15,9 GiB (17038168064 bytes) trimmed
                            Oct 8 08:16:44 justapc ureadahead[283]: ureadahead:trimage_trimage.png: Ignored relative path
                            Oct 15 20:14:00 justapc fstrim[749]: /home: 73,5 GiB (78863814656 bytes) trimmed
                            Oct 15 20:14:00 justapc fstrim[749]: /boot: 360,1 MiB (377634816 bytes) trimmed
                            Oct 15 20:14:00 justapc fstrim[749]: /: 16 GiB (17104076800 bytes) trimmed


                            To be sure of any possible errors, verbose fstrim manually:



                            for mountpoint in $(cat /etc/fstab | awk '/ext[0-9]/ {print $2}'); do sudo fstrim -v "$mountpoint"; done





                            share|improve this answer

















                            On 18.04, you may check it in syslog:



                            cat /var/log/syslog | grep -a fstrim | tail


                            if you see recent dates and all your SSD's mountpoints, it's working. Sample output:



                            Oct  1 14:54:55 justapc fstrim[769]: /home: 80,1 GiB (86008037376 bytes) trimmed
                            Oct 1 14:54:55 justapc fstrim[769]: /boot: 360,2 MiB (377663488 bytes) trimmed
                            Oct 1 14:54:55 justapc fstrim[769]: /: 16,3 GiB (17486880768 bytes) trimmed
                            Oct 8 08:16:01 justapc fstrim[792]: /home: 76,8 GiB (82423615488 bytes) trimmed
                            Oct 8 08:16:01 justapc fstrim[792]: /boot: 360,1 MiB (377634816 bytes) trimmed
                            Oct 8 08:16:01 justapc fstrim[792]: /: 15,9 GiB (17038168064 bytes) trimmed
                            Oct 8 08:16:44 justapc ureadahead[283]: ureadahead:trimage_trimage.png: Ignored relative path
                            Oct 15 20:14:00 justapc fstrim[749]: /home: 73,5 GiB (78863814656 bytes) trimmed
                            Oct 15 20:14:00 justapc fstrim[749]: /boot: 360,1 MiB (377634816 bytes) trimmed
                            Oct 15 20:14:00 justapc fstrim[749]: /: 16 GiB (17104076800 bytes) trimmed


                            To be sure of any possible errors, verbose fstrim manually:



                            for mountpoint in $(cat /etc/fstab | awk '/ext[0-9]/ {print $2}'); do sudo fstrim -v "$mountpoint"; done






                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited 5 hours ago

























                            answered Oct 21 '18 at 16:29









                            crysmancrysman

                            192113




                            192113






























                                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%2f464306%2fa-command-which-checks-that-trim-is-working%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

                                Why do type traits not work with types in namespace scope?What are POD types in C++?Why can templates only be...

                                Will tsunami waves travel forever if there was no land?Why do tsunami waves begin with the water flowing away...

                                Simple Scan not detecting my scanner (Brother DCP-7055W)Brother MFC-L2700DW printer can print, can't...