Announcement

Collapse
No announcement yet.

To trim or not to trim....

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    To trim or not to trim....

    I installed a new SSD, but I've read some places that you should enable trim and some that you shouldn't.

    I have a Kingston SSDNow 300 120 gb drive and from what I can understand, it's simply plug and play and the sandforce controller should take care of everything. But I'm not sure and articles online aren't too clear. Can anyone clear the air just a bit for me?

    #2
    My : Do not enable trim as a mount option. It's not necessary to run it 24/7 and it will decrease your performance noticeably, and in theory cause excessive wear. You can run trim periodically manually or use (my method) a cron job. I run trim once monthly.

    Also, use noatime unless you really need to know when you last touched every file. There are several other options you can play with that will increase performance if you really want to squeeze every nanosec. out of it.

    Please Read Me

    Comment


      #3
      I concur with oshunluvr. I used to include discard in my mount options, but I've dropped it and routine performance of my SSDs has increased. I'm relying on the controller's logic to handle trimming whenever it sees fit.

      Comment


        #4
        Originally posted by SteveRiley View Post
        I concur with oshunluvr. I used to include discard in my mount options, but I've dropped it and routine performance of my SSDs has increased. I'm relying on the controller's logic to handle trimming whenever it sees fit.
        So basically, you're just letting the SSD controller do everything, correct? No trim?

        Comment


          #5
          Originally posted by oshunluvr View Post
          My : Do not enable trim as a mount option. It's not necessary to run it 24/7 and it will decrease your performance noticeably, and in theory cause excessive wear. You can run trim periodically manually or use (my method) a cron job. I run trim once monthly.

          Also, use noatime unless you really need to know when you last touched every file. There are several other options you can play with that will increase performance if you really want to squeeze every nanosec. out of it.
          I've done some research into cron, but I'm still a newb even after 3 or so years of using Linux and am a bit confused. How do you set up such a cron job?

          Comment


            #6
            I'm not at my linux computer at the moment. I'll post my cron job when I get a chance. It's really easy. The command is fstrim / and you put in into a root crontab with sudo crontab -e.

            If you want a log file of actions taken, envoking a script file is better. Something like:

            Code:
            #!/bin/sh
            LOG=/var/log/trim.log
            echo "*** $(date -R) ***" >> $LOG
            fstrim -v / >> $LOG
            fstrim -v /home >> $LOG
            Here's some help on crontab:

            https://help.ubuntu.com/community/CronHowto

            Please Read Me

            Comment


              #7
              Originally posted by charles052 View Post
              So basically, you're just letting the SSD controller do everything, correct? No trim?
              Well, I thought I was, but after more research I've realized the controller actually has no idea which blocks on an SSD are in use. That's because "in use" is something only the file system knows. I removed discard from my mount options several months ago. Just now I ran sudo trim -v / and zeroed out 54 GB of unused space!

              I will add a weekly crontab entry.

              Soon, we may not need to worry about this anymore. Serial ATA 3.1 defines queued trimming, which allows an operating system to trim a file system during idle periods. Kernel 3.12 includes support for queued trimming.

              Comment


                #8
                Originally posted by oshunluvr View Post
                I'm not at my linux computer at the moment. I'll post my cron job when I get a chance. It's really easy. The command is fstrim / and you put in into a root crontab with sudo crontab -e.

                If you want a log file of actions taken, envoking a script file is better. Something like:

                Code:
                #!/bin/sh
                LOG=/var/log/trim.log
                echo "*** $(date -R) ***" >> $LOG
                fstrim -v / >> $LOG
                fstrim -v /home >> $LOG
                Here's some help on crontab:

                https://help.ubuntu.com/community/CronHowto
                Well, I finally got around to it and set up a monthly trim on my SSD since I mostly use it for my OS and keep all my files on a mechanical HD. That and I had to do a reinstall of my OS on my desktop.

                Anyways, everything worked like a charm! Many thanks!

                Comment


                  #9
                  Originally posted by SteveRiley View Post
                  Well, I thought I was, but after more research I've realized the controller actually has no idea which blocks on an SSD are in use. That's because "in use" is something only the file system knows. I removed discard from my mount options several months ago. Just now I ran sudo trim -v / and zeroed out 54 GB of unused space!

                  I will add a weekly crontab entry.

                  Soon, we may not need to worry about this anymore. Serial ATA 3.1 defines queued trimming, which allows an operating system to trim a file system during idle periods. Kernel 3.12 includes support for queued trimming.
                  That'll be great. Although, I've heard that 14.04 has auto trim already enabled as well. I wonder if we'll be able to change it from a daily trim to weekly/monthly?

                  Comment


                    #10
                    IIRC, in 14.04 it's in the system's crontab, so you should be able to adjust it however you'd like.

                    Comment


                      #11
                      Originally posted by SteveRiley View Post
                      IIRC, in 14.04 it's in the system's crontab, so you should be able to adjust it however you'd like.
                      How does this work exactly? I dont know much about cron jobs....

                      Comment


                        #12
                        See CronHowTo
                        Using Kubuntu Linux since March 23, 2007
                        "It is a capital mistake to theorize before one has data." - Sherlock Holmes

                        Comment

                        Working...
                        X