fstrim: why more than one step?

Forum Forums General Software fstrim: why more than one step?

Tagged: , , ,

  • This topic has 6 replies, 3 voices, and was last updated Feb 27-12:43 am by stevesr0.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #99708
    Member
    mikey777

      Sometimes when I trim my SSD, e.g. using sudo fstrim -v /
      it takes a few goes, until trimming is complete. Why is this? (see screenshot below).

      • This topic was modified 2 months, 3 weeks ago by mikey777.
      Attachments:

      ▪ 32-bit antix19.4-core+LXDE installed on :
      - (2011) Samsung NP-N145 Plus (JP04UK) – single-core CPU Intel Atom N455@1.66GHz, 2GB RAM, integrated graphics.
      ▪ 64-bit antix21-base+LXDE installed on:
      - (2008) Asus X71Q (7SC002) – dual CPU Intel T3200@2.0GHz, 4GB RAM. Graphics: Intel Mobile 4 Series, integrated graphics
      - (2007) Packard Bell Easynote MX37 (ALP-Ajax C3) – dual CPU Intel T2310@1.46GHz, 2GB RAM. Graphics: Silicon Integrated Systems.

      #99724
      Member
      Xunzi_23
        Helpful
        Up
        0
        ::

        Hi mikey tripple 7, without knowing your etc fstab and filesystem setup it is not
        possible to give sane advice. If you for example use ext4 and discard option you
        lready have continous trim enabled.
        every trim you forcecauses complete memory blocks to be reallocated wearing out
        memorycells prematurely.

        • This reply was modified 2 months, 3 weeks ago by Xunzi_23.
        #99739
        Member
        mikey777
          Helpful
          Up
          0
          ::

          If you for example use ext4 and discard option you
          lready have continous trim enabled – every trim you forcecauses complete memory blocks to be reallocated wearing out
          memorycells prematurely.

          I have never used ‘discard’, for the reason you’ve just given. This is the line corresponding to ‘/’ in etc/fstab:
          UUID=5be186e2-1238-44c6-81e8-ef635ca05595 / ext4 noatime 1 1

          I’m unsure if that helps you answer my question – at least you can see the options I’ve used…

          • This reply was modified 2 months, 3 weeks ago by mikey777.

          ▪ 32-bit antix19.4-core+LXDE installed on :
          - (2011) Samsung NP-N145 Plus (JP04UK) – single-core CPU Intel Atom N455@1.66GHz, 2GB RAM, integrated graphics.
          ▪ 64-bit antix21-base+LXDE installed on:
          - (2008) Asus X71Q (7SC002) – dual CPU Intel T3200@2.0GHz, 4GB RAM. Graphics: Intel Mobile 4 Series, integrated graphics
          - (2007) Packard Bell Easynote MX37 (ALP-Ajax C3) – dual CPU Intel T2310@1.46GHz, 2GB RAM. Graphics: Silicon Integrated Systems.

          #99789
          Member
          Xunzi_23
            Helpful
            Up
            0
            ::

            Hi mikey, as detailed controller software code is a well kept secret, an assumption is there is a
            threshold programmed in under which the controller will not rewrite memory blocks. Seeing the results
            of your cleanup a percentage value comes to mind. Background is unlike HDD SSD and MMC
            devices must reallocate and rewrite memory blocks to delete data. Every write degrases memory.

            Nice present example is some high end samsung ssd lasting only weeks to months due code fault..

            With discard set the manufacturer may try and claim the customer is at fault for failure, reading how
            often trim was commanded is possible as is total writes. Seen warranty rejected for writes with figures.

            On an HDD delete a bit is set to show allowed write over. Maybe vastly simplified or distorted
            as again controllers from different manufacturers may/often must be programmed differently as
            algorithms are patented, those patents are held mostly by us companys and weaponized against rivals..

            Information is spread and often confusing, sorry if this is same.
            Reading the ssd manual is recommended, for Crucial Kingston, Sandisk which is owned by western digital
            Seagate recommendations are best followed. For some el cheapo devices nothing available, but that may
            not mean they are bad. Some are pretty good performance and longevity wise.
            Read one and two star reviews on amazon as well as the glowing reports to sieve info.

            #100637
            Member
            mikey777
              Helpful
              Up
              0
              ::

              @Xunzi_23
              Thanks for reaching out to help. I found this more succinct explanation online – for me personally it was a little easier to understand. I’ll leave it here for the record:

              The reason why you need to run the command multiple times is due to the way that the TRIM command works.
              The TRIM command is executed in three stages, and the third stage, which involves the actual erasure of the blocks, is typically performed in the background by the SSD’s controller. This means that even after the first TRIM command is executed, there may still be some blocks that have not yet been erased. Running the command multiple times can help ensure that all of the necessary blocks are trimmed.

              It’s also worth noting that the sudo fstrim -v / command should not be run too frequently, as it can potentially shorten the lifespan of the SSD. It’s generally recommended to run the command no more than once a week or once a month, depending on your usage patterns.

              I’d like to add that I’ve been using the Samsung 850 Evo series SSDs (120GB to 1TB), since they were first sold and haven’t had any problems with them, like the kinds of problems you mentioned. I normally trim them around once/month. They appear to be a very trustworthy SSD, though are a little more expensive than other brands, such as Crucial and Western Digital.

              • This reply was modified 2 months, 1 week ago by mikey777.
              • This reply was modified 2 months, 1 week ago by mikey777.
              • This reply was modified 2 months, 1 week ago by mikey777.

              ▪ 32-bit antix19.4-core+LXDE installed on :
              - (2011) Samsung NP-N145 Plus (JP04UK) – single-core CPU Intel Atom N455@1.66GHz, 2GB RAM, integrated graphics.
              ▪ 64-bit antix21-base+LXDE installed on:
              - (2008) Asus X71Q (7SC002) – dual CPU Intel T3200@2.0GHz, 4GB RAM. Graphics: Intel Mobile 4 Series, integrated graphics
              - (2007) Packard Bell Easynote MX37 (ALP-Ajax C3) – dual CPU Intel T2310@1.46GHz, 2GB RAM. Graphics: Silicon Integrated Systems.

              #100657
              Member
              Xunzi_23
                Helpful
                Up
                0
                ::

                Hi mikey 777, maybe worth taking a look athttps://documents.westerndigital.com/content/dam/doc-library/en_us/assets/public/western-digital/collateral/white-paper/white-paper-ssd-endurance-and-hdd-workloads.pdf

                The more you write, the more you trim the more a drive is degraded. Once a month is as far as I am aware a good option, but I would only
                issue the command once.

                Brand new drives degrading massively and in known cases and becoming defective within two months was/is a recent Samsung issue which probably
                most drive users do not know about.
                Cause bad controller software for which an update is available. It can not, does not fix the damage which is due memory cell degradation.

                Customers are expected to swallow the damage. My daughters phone burned, told out of warranty, no replace. Cheap power supply capacitors in expensive Monitors degraded/leaking in less than 3 years and had to be replaced. Any capable engineer would have known that was coming, planned breakdown. I buy no more Samsung devices.

                All of above does not mean other drives or companys are better. Experience may vary.

                #100704
                Member
                stevesr0
                  Helpful
                  Up
                  0
                  ::

                  Just a cautionary note.

                  Trimmed files/directories are generally unrecoverable. Users of SSDs that trim should be especially careful about backing up.

                  The nice trash script that PPC developed for zzzFM is especially valuable to avoid accidents, as it moves files to a trash directory rather than causing them to be immediately deleted.

                  stevesr0

                Viewing 7 posts - 1 through 7 (of 7 total)
                • You must be logged in to reply to this topic.