Is TRIM enabled on my Ubuntu 18.04 installation?












19















I know that weekly TRIM is enabled by default from 14.10 onwards. Source: How to enable TRIM?
But running sudo nano /etc/cron.weekly/fstrim returns an empty file. Also tail -n1 /etc/cron.weekly/fstrim says that this file does not exist.



Running lsblk -D returns non zero values for DISC-GRAN and DISC-MAX
so TRIM is supported on my SSD. Is weekly TRIM actually enabled for my SSD or not?



I am using a Kingston SSD










share|improve this question



























    19















    I know that weekly TRIM is enabled by default from 14.10 onwards. Source: How to enable TRIM?
    But running sudo nano /etc/cron.weekly/fstrim returns an empty file. Also tail -n1 /etc/cron.weekly/fstrim says that this file does not exist.



    Running lsblk -D returns non zero values for DISC-GRAN and DISC-MAX
    so TRIM is supported on my SSD. Is weekly TRIM actually enabled for my SSD or not?



    I am using a Kingston SSD










    share|improve this question

























      19












      19








      19


      4






      I know that weekly TRIM is enabled by default from 14.10 onwards. Source: How to enable TRIM?
      But running sudo nano /etc/cron.weekly/fstrim returns an empty file. Also tail -n1 /etc/cron.weekly/fstrim says that this file does not exist.



      Running lsblk -D returns non zero values for DISC-GRAN and DISC-MAX
      so TRIM is supported on my SSD. Is weekly TRIM actually enabled for my SSD or not?



      I am using a Kingston SSD










      share|improve this question














      I know that weekly TRIM is enabled by default from 14.10 onwards. Source: How to enable TRIM?
      But running sudo nano /etc/cron.weekly/fstrim returns an empty file. Also tail -n1 /etc/cron.weekly/fstrim says that this file does not exist.



      Running lsblk -D returns non zero values for DISC-GRAN and DISC-MAX
      so TRIM is supported on my SSD. Is weekly TRIM actually enabled for my SSD or not?



      I am using a Kingston SSD







      18.04 trim






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked May 9 '18 at 18:11









      m.umarm.umar

      205117




      205117






















          1 Answer
          1






          active

          oldest

          votes


















          30














          TRIM is enabled to run weekly by default in 18.04.



          It is a systemd service managed via systemctl, not CRON.



          View fstrim.timer status:



          $ systemctl status fstrim.timer
          ● fstrim.timer - Discard unused blocks once a week
          Loaded: loaded (/lib/systemd/system/fstrim.timer; enabled; vendor preset: enabled)
          Active: active (waiting) since Thu 2018-07-05 05:45:11 BST; 4h 42min ago
          Trigger: Mon 2018-07-09 00:00:00 BST; 3 days left
          Docs: man:fstrim


          Start/Stop/Restart fstrim.timer:

          (immediate activate/deactivate/reactivate, does not change startup status)



          $ sudo systemctl [start/stop/restart] fstrim.timer


          Enable/Disable fstrim.timer:

          (add to/remove from startup, does not change immediate active status)



          $ sudo systemctl [enable/disable] fstrim.timer


          View fstrim.timer configuration:



          $ systemctl cat fstrim.timer
          # /lib/systemd/system/fstrim.timer
          [Unit]
          Description=Discard unused blocks once a week
          Documentation=man:fstrim

          [Timer]
          OnCalendar=weekly
          AccuracySec=1h
          Persistent=true

          [Install]
          WantedBy=timers.target


          View fstrim.service configuration:



          $ systemctl cat fstrim.service
          # /lib/systemd/system/fstrim.service
          [Unit]
          Description=Discard unused blocks

          [Service]
          Type=oneshot
          ExecStart=/sbin/fstrim -av


          View related systemd journal entries:



          $ journalctl -u fstrim.timer
          Jul 04 14:18:41 user-laptop systemd[1]: Started Discard unused blocks once a week.
          Jul 04 21:59:26 user-laptop systemd[1]: Stopped Discard unused blocks once a week.
          etc...

          $ journalctl -u fstrim.service
          Jun 25 10:59:44 user-laptop systemd[1]: Starting Discard unused blocks...
          Jun 25 10:59:48 user-laptop fstrim[955]: /: 92.5 GiB (99335237632 bytes) trimmed
          Jun 25 10:59:48 user-laptop systemd[1]: Started Discard unused blocks.
          -- Reboot --
          Jul 02 04:27:41 user-laptop systemd[1]: Starting Discard unused blocks...
          Jul 02 04:27:46 user-laptop fstrim[1032]: /: 92.3 GiB (99150807040 bytes) trimmed
          Jul 02 04:27:46 user-laptop systemd[1]: Started Discard unused blocks.
          etc...





          share|improve this answer





















          • 2





            For reference, the when is controlled by /lib/systemd/system/fstrim.timer (OnCalendar=weekly) and the what by /lib/systemd/system/fstrim.service (ExecStart=/sbin/fstrim -av).

            – Moilleadóir
            Jul 5 '18 at 8:46






          • 1





            Fine post! I suggest you change the "cat" commands by the dedicated systemctl commands: cat /lib/systemd/system/fstrim.timer -> systemctl cat fstrim.timer. In general, that command shows the version of the service that is in effect. That might be the one under /lib/systemd, but it might also be a modified version under /etc/systemd.

            – vanadium
            Jul 14 '18 at 6:15













          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%2f1034169%2fis-trim-enabled-on-my-ubuntu-18-04-installation%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









          30














          TRIM is enabled to run weekly by default in 18.04.



          It is a systemd service managed via systemctl, not CRON.



          View fstrim.timer status:



          $ systemctl status fstrim.timer
          ● fstrim.timer - Discard unused blocks once a week
          Loaded: loaded (/lib/systemd/system/fstrim.timer; enabled; vendor preset: enabled)
          Active: active (waiting) since Thu 2018-07-05 05:45:11 BST; 4h 42min ago
          Trigger: Mon 2018-07-09 00:00:00 BST; 3 days left
          Docs: man:fstrim


          Start/Stop/Restart fstrim.timer:

          (immediate activate/deactivate/reactivate, does not change startup status)



          $ sudo systemctl [start/stop/restart] fstrim.timer


          Enable/Disable fstrim.timer:

          (add to/remove from startup, does not change immediate active status)



          $ sudo systemctl [enable/disable] fstrim.timer


          View fstrim.timer configuration:



          $ systemctl cat fstrim.timer
          # /lib/systemd/system/fstrim.timer
          [Unit]
          Description=Discard unused blocks once a week
          Documentation=man:fstrim

          [Timer]
          OnCalendar=weekly
          AccuracySec=1h
          Persistent=true

          [Install]
          WantedBy=timers.target


          View fstrim.service configuration:



          $ systemctl cat fstrim.service
          # /lib/systemd/system/fstrim.service
          [Unit]
          Description=Discard unused blocks

          [Service]
          Type=oneshot
          ExecStart=/sbin/fstrim -av


          View related systemd journal entries:



          $ journalctl -u fstrim.timer
          Jul 04 14:18:41 user-laptop systemd[1]: Started Discard unused blocks once a week.
          Jul 04 21:59:26 user-laptop systemd[1]: Stopped Discard unused blocks once a week.
          etc...

          $ journalctl -u fstrim.service
          Jun 25 10:59:44 user-laptop systemd[1]: Starting Discard unused blocks...
          Jun 25 10:59:48 user-laptop fstrim[955]: /: 92.5 GiB (99335237632 bytes) trimmed
          Jun 25 10:59:48 user-laptop systemd[1]: Started Discard unused blocks.
          -- Reboot --
          Jul 02 04:27:41 user-laptop systemd[1]: Starting Discard unused blocks...
          Jul 02 04:27:46 user-laptop fstrim[1032]: /: 92.3 GiB (99150807040 bytes) trimmed
          Jul 02 04:27:46 user-laptop systemd[1]: Started Discard unused blocks.
          etc...





          share|improve this answer





















          • 2





            For reference, the when is controlled by /lib/systemd/system/fstrim.timer (OnCalendar=weekly) and the what by /lib/systemd/system/fstrim.service (ExecStart=/sbin/fstrim -av).

            – Moilleadóir
            Jul 5 '18 at 8:46






          • 1





            Fine post! I suggest you change the "cat" commands by the dedicated systemctl commands: cat /lib/systemd/system/fstrim.timer -> systemctl cat fstrim.timer. In general, that command shows the version of the service that is in effect. That might be the one under /lib/systemd, but it might also be a modified version under /etc/systemd.

            – vanadium
            Jul 14 '18 at 6:15


















          30














          TRIM is enabled to run weekly by default in 18.04.



          It is a systemd service managed via systemctl, not CRON.



          View fstrim.timer status:



          $ systemctl status fstrim.timer
          ● fstrim.timer - Discard unused blocks once a week
          Loaded: loaded (/lib/systemd/system/fstrim.timer; enabled; vendor preset: enabled)
          Active: active (waiting) since Thu 2018-07-05 05:45:11 BST; 4h 42min ago
          Trigger: Mon 2018-07-09 00:00:00 BST; 3 days left
          Docs: man:fstrim


          Start/Stop/Restart fstrim.timer:

          (immediate activate/deactivate/reactivate, does not change startup status)



          $ sudo systemctl [start/stop/restart] fstrim.timer


          Enable/Disable fstrim.timer:

          (add to/remove from startup, does not change immediate active status)



          $ sudo systemctl [enable/disable] fstrim.timer


          View fstrim.timer configuration:



          $ systemctl cat fstrim.timer
          # /lib/systemd/system/fstrim.timer
          [Unit]
          Description=Discard unused blocks once a week
          Documentation=man:fstrim

          [Timer]
          OnCalendar=weekly
          AccuracySec=1h
          Persistent=true

          [Install]
          WantedBy=timers.target


          View fstrim.service configuration:



          $ systemctl cat fstrim.service
          # /lib/systemd/system/fstrim.service
          [Unit]
          Description=Discard unused blocks

          [Service]
          Type=oneshot
          ExecStart=/sbin/fstrim -av


          View related systemd journal entries:



          $ journalctl -u fstrim.timer
          Jul 04 14:18:41 user-laptop systemd[1]: Started Discard unused blocks once a week.
          Jul 04 21:59:26 user-laptop systemd[1]: Stopped Discard unused blocks once a week.
          etc...

          $ journalctl -u fstrim.service
          Jun 25 10:59:44 user-laptop systemd[1]: Starting Discard unused blocks...
          Jun 25 10:59:48 user-laptop fstrim[955]: /: 92.5 GiB (99335237632 bytes) trimmed
          Jun 25 10:59:48 user-laptop systemd[1]: Started Discard unused blocks.
          -- Reboot --
          Jul 02 04:27:41 user-laptop systemd[1]: Starting Discard unused blocks...
          Jul 02 04:27:46 user-laptop fstrim[1032]: /: 92.3 GiB (99150807040 bytes) trimmed
          Jul 02 04:27:46 user-laptop systemd[1]: Started Discard unused blocks.
          etc...





          share|improve this answer





















          • 2





            For reference, the when is controlled by /lib/systemd/system/fstrim.timer (OnCalendar=weekly) and the what by /lib/systemd/system/fstrim.service (ExecStart=/sbin/fstrim -av).

            – Moilleadóir
            Jul 5 '18 at 8:46






          • 1





            Fine post! I suggest you change the "cat" commands by the dedicated systemctl commands: cat /lib/systemd/system/fstrim.timer -> systemctl cat fstrim.timer. In general, that command shows the version of the service that is in effect. That might be the one under /lib/systemd, but it might also be a modified version under /etc/systemd.

            – vanadium
            Jul 14 '18 at 6:15
















          30












          30








          30







          TRIM is enabled to run weekly by default in 18.04.



          It is a systemd service managed via systemctl, not CRON.



          View fstrim.timer status:



          $ systemctl status fstrim.timer
          ● fstrim.timer - Discard unused blocks once a week
          Loaded: loaded (/lib/systemd/system/fstrim.timer; enabled; vendor preset: enabled)
          Active: active (waiting) since Thu 2018-07-05 05:45:11 BST; 4h 42min ago
          Trigger: Mon 2018-07-09 00:00:00 BST; 3 days left
          Docs: man:fstrim


          Start/Stop/Restart fstrim.timer:

          (immediate activate/deactivate/reactivate, does not change startup status)



          $ sudo systemctl [start/stop/restart] fstrim.timer


          Enable/Disable fstrim.timer:

          (add to/remove from startup, does not change immediate active status)



          $ sudo systemctl [enable/disable] fstrim.timer


          View fstrim.timer configuration:



          $ systemctl cat fstrim.timer
          # /lib/systemd/system/fstrim.timer
          [Unit]
          Description=Discard unused blocks once a week
          Documentation=man:fstrim

          [Timer]
          OnCalendar=weekly
          AccuracySec=1h
          Persistent=true

          [Install]
          WantedBy=timers.target


          View fstrim.service configuration:



          $ systemctl cat fstrim.service
          # /lib/systemd/system/fstrim.service
          [Unit]
          Description=Discard unused blocks

          [Service]
          Type=oneshot
          ExecStart=/sbin/fstrim -av


          View related systemd journal entries:



          $ journalctl -u fstrim.timer
          Jul 04 14:18:41 user-laptop systemd[1]: Started Discard unused blocks once a week.
          Jul 04 21:59:26 user-laptop systemd[1]: Stopped Discard unused blocks once a week.
          etc...

          $ journalctl -u fstrim.service
          Jun 25 10:59:44 user-laptop systemd[1]: Starting Discard unused blocks...
          Jun 25 10:59:48 user-laptop fstrim[955]: /: 92.5 GiB (99335237632 bytes) trimmed
          Jun 25 10:59:48 user-laptop systemd[1]: Started Discard unused blocks.
          -- Reboot --
          Jul 02 04:27:41 user-laptop systemd[1]: Starting Discard unused blocks...
          Jul 02 04:27:46 user-laptop fstrim[1032]: /: 92.3 GiB (99150807040 bytes) trimmed
          Jul 02 04:27:46 user-laptop systemd[1]: Started Discard unused blocks.
          etc...





          share|improve this answer















          TRIM is enabled to run weekly by default in 18.04.



          It is a systemd service managed via systemctl, not CRON.



          View fstrim.timer status:



          $ systemctl status fstrim.timer
          ● fstrim.timer - Discard unused blocks once a week
          Loaded: loaded (/lib/systemd/system/fstrim.timer; enabled; vendor preset: enabled)
          Active: active (waiting) since Thu 2018-07-05 05:45:11 BST; 4h 42min ago
          Trigger: Mon 2018-07-09 00:00:00 BST; 3 days left
          Docs: man:fstrim


          Start/Stop/Restart fstrim.timer:

          (immediate activate/deactivate/reactivate, does not change startup status)



          $ sudo systemctl [start/stop/restart] fstrim.timer


          Enable/Disable fstrim.timer:

          (add to/remove from startup, does not change immediate active status)



          $ sudo systemctl [enable/disable] fstrim.timer


          View fstrim.timer configuration:



          $ systemctl cat fstrim.timer
          # /lib/systemd/system/fstrim.timer
          [Unit]
          Description=Discard unused blocks once a week
          Documentation=man:fstrim

          [Timer]
          OnCalendar=weekly
          AccuracySec=1h
          Persistent=true

          [Install]
          WantedBy=timers.target


          View fstrim.service configuration:



          $ systemctl cat fstrim.service
          # /lib/systemd/system/fstrim.service
          [Unit]
          Description=Discard unused blocks

          [Service]
          Type=oneshot
          ExecStart=/sbin/fstrim -av


          View related systemd journal entries:



          $ journalctl -u fstrim.timer
          Jul 04 14:18:41 user-laptop systemd[1]: Started Discard unused blocks once a week.
          Jul 04 21:59:26 user-laptop systemd[1]: Stopped Discard unused blocks once a week.
          etc...

          $ journalctl -u fstrim.service
          Jun 25 10:59:44 user-laptop systemd[1]: Starting Discard unused blocks...
          Jun 25 10:59:48 user-laptop fstrim[955]: /: 92.5 GiB (99335237632 bytes) trimmed
          Jun 25 10:59:48 user-laptop systemd[1]: Started Discard unused blocks.
          -- Reboot --
          Jul 02 04:27:41 user-laptop systemd[1]: Starting Discard unused blocks...
          Jul 02 04:27:46 user-laptop fstrim[1032]: /: 92.3 GiB (99150807040 bytes) trimmed
          Jul 02 04:27:46 user-laptop systemd[1]: Started Discard unused blocks.
          etc...






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 2 days ago

























          answered May 9 '18 at 18:33









          BroadswordeBroadsworde

          8851822




          8851822








          • 2





            For reference, the when is controlled by /lib/systemd/system/fstrim.timer (OnCalendar=weekly) and the what by /lib/systemd/system/fstrim.service (ExecStart=/sbin/fstrim -av).

            – Moilleadóir
            Jul 5 '18 at 8:46






          • 1





            Fine post! I suggest you change the "cat" commands by the dedicated systemctl commands: cat /lib/systemd/system/fstrim.timer -> systemctl cat fstrim.timer. In general, that command shows the version of the service that is in effect. That might be the one under /lib/systemd, but it might also be a modified version under /etc/systemd.

            – vanadium
            Jul 14 '18 at 6:15
















          • 2





            For reference, the when is controlled by /lib/systemd/system/fstrim.timer (OnCalendar=weekly) and the what by /lib/systemd/system/fstrim.service (ExecStart=/sbin/fstrim -av).

            – Moilleadóir
            Jul 5 '18 at 8:46






          • 1





            Fine post! I suggest you change the "cat" commands by the dedicated systemctl commands: cat /lib/systemd/system/fstrim.timer -> systemctl cat fstrim.timer. In general, that command shows the version of the service that is in effect. That might be the one under /lib/systemd, but it might also be a modified version under /etc/systemd.

            – vanadium
            Jul 14 '18 at 6:15










          2




          2





          For reference, the when is controlled by /lib/systemd/system/fstrim.timer (OnCalendar=weekly) and the what by /lib/systemd/system/fstrim.service (ExecStart=/sbin/fstrim -av).

          – Moilleadóir
          Jul 5 '18 at 8:46





          For reference, the when is controlled by /lib/systemd/system/fstrim.timer (OnCalendar=weekly) and the what by /lib/systemd/system/fstrim.service (ExecStart=/sbin/fstrim -av).

          – Moilleadóir
          Jul 5 '18 at 8:46




          1




          1





          Fine post! I suggest you change the "cat" commands by the dedicated systemctl commands: cat /lib/systemd/system/fstrim.timer -> systemctl cat fstrim.timer. In general, that command shows the version of the service that is in effect. That might be the one under /lib/systemd, but it might also be a modified version under /etc/systemd.

          – vanadium
          Jul 14 '18 at 6:15







          Fine post! I suggest you change the "cat" commands by the dedicated systemctl commands: cat /lib/systemd/system/fstrim.timer -> systemctl cat fstrim.timer. In general, that command shows the version of the service that is in effect. That might be the one under /lib/systemd, but it might also be a modified version under /etc/systemd.

          – vanadium
          Jul 14 '18 at 6:15




















          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%2f1034169%2fis-trim-enabled-on-my-ubuntu-18-04-installation%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

          Category:香港粉麵

          List *all* the tuples!

          Channel [V]