Results 1 to 6 of 6

Thread: launcher for trim ssd

  1. #1
    Join Date
    Dec 2017
    Beans
    15

    launcher for trim ssd

    how about terminal code to create a launcher that runs" fstrim -v / "
    it would help...
    thanks

  2. #2
    Join Date
    Mar 2011
    Location
    19th Hole
    Beans
    Hidden!
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: launcher for trim ssd

    You appear to be addressing the forums as if to the developers. The forums are made up of, and managed by, ordinary users like you and me. The developers rarely, if ever, visit.

    As for your question, I believe that all current *buntu versions already run trim weekly. My Xenial install has:
    Code:
    duckhook@Zeus:~$  ll /etc/cron.weekly
    total 40
    <snip>
    -rwxr-xr-x   1 root root    86 Aug  4  2015 fstrim*
    <snip>
    …of which the contents are:
    Code:
    duckhook@Zeus:~$  cat /etc/cron.weekly/fstrim
    #!/bin/sh
    # trim all mounted file systems which support it
    /sbin/fstrim --all || true

  3. #3
    Join Date
    Jun 2007
    Beans
    17,016

    Re: launcher for trim ssd

    fstrim needs to be run as root so if you're really inclined to create a desktop launcher (whatever.desktop) that runs a root command, I'm sure you can search out the few solutions to that.
    Hardly seems worth the effort as it runs weekly anyway at least in 16.04 + ( I believe in 14.04 some ssd's were blacklisted, in many cases improperly..

    Preferred here is to modify /ect/cron-weekly/fstrim to create a log entry everytime it runs. Then you can just check the log every once & a while to make sure it's been running,ect.
    I change it to
    Code:
    #!/bin/sh
    LOG=/var/log/trim.log
    echo "*** $(date -R) ***" >> $LOG
    fstrim -v / >> $LOG
    After editing /ect/cron-weekly/fstrim to above can be tested by running this & then see if log is properly created.
    Code:
    sudo run-parts /etc/cron.weekly -v

  4. #4
    Join Date
    Mar 2011
    Location
    19th Hole
    Beans
    Hidden!
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: launcher for trim ssd

    Thanks, mc4man! That's a cool suggestion …and very useful.

    Does it get nerfed with the next update?

  5. #5
    Join Date
    Jun 2007
    Beans
    17,016

    Re: launcher for trim ssd

    Quote Originally Posted by DuckHook View Post
    Thanks, mc4man! That's a cool suggestion …and very useful.

    Does it get nerfed with the next update?
    No, I don't believe I've seen an update to whatever installs that cron script ever... (at least post release.
    I guess one could also modify to do all mounted partitions instead of just / though here I'm ok with a weekly on / as my data partition doesn't really need & any other Os's also runs same script themselves.

    Edit:
    Maybe that package has been updated though the modded script is still there in my 16.04 install though it's only 6 months old.
    The package is util-linux, will have to test..
    If I re-install util-linux it does not replace the cron file, can't say what an actual update would do...
    Last edited by mc4man; January 12th, 2018 at 11:28 PM.

  6. #6
    Join Date
    Jul 2008
    Location
    The Left Coast of the USA
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: launcher for trim ssd

    You could put it in cron.daily.

    Or you could create a job to do it hourly or every 5 minutes.
    Please read The Forum Rules and The Forum Posting Guidelines
    My Blog
    A thing discovered and kept to oneself must be discovered time and again by others. A thing discovered and shared with others need be discovered only the once.
    This universe is crazy. I'm going back to my own.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •