Hi all, just wondering if everything was taken care of, I looked in etc/fstab and see no mention of "noatime" or anything else. I know I can always do a manual trim but maybe a weekly or monthly one might be a good idea, please could someone tell me what is the default setting in Kubuntu 18.04 for TRIM on SSDs?? greatly apreciated, thank you
Announcement
Collapse
No announcement yet.
Any steps needed to setup TRIM for SSD
Collapse
This topic is closed.
X
X
-
Here's an interesting comment on TRIM, and why it's not enabled by default in Ubuntu. It does suggest running TRIM via fstrim in a chron job.
https://www.howtogeek.com/176978/ubu...e-it-yourself/The next brick house on the left
Intel i7 11th Gen | 16GB | 1TB | KDE Plasma 5.27.11| Kubuntu 24.04 | 6.8.0-31-generic
- Top
- Bottom
-
So I got a little more curious about fstrim, and found that the cron job for running fstrim ("on supported filesystems") is already setup on my 16.04.4 and that fstrim was installed with util-linux:
Code:john@John-Desktop:~$ dpkg -L util-linux|grep fstrim /etc/cron.weekly/fstrim /sbin/fstrim /usr/share/man/man8/fstrim.8.gz /usr/share/doc/util-linux/examples/fstrim.timer /usr/share/doc/util-linux/examples/fstrim.service /usr/share/bash-completion/completions/fstrim
The next brick house on the left
Intel i7 11th Gen | 16GB | 1TB | KDE Plasma 5.27.11| Kubuntu 24.04 | 6.8.0-31-generic
- Top
- Bottom
Comment
-
That howtogeek info is five years old. Btrfs in 16.04 is currently at the 4.4 version. The latest version is 4.17.
The Btrfs Wiki FAQ states:
Does Btrfs support TRIM/discard?
There are two ways how to apply the discard:
- during normal operation on any space that's going to be freed, enabled by mount option discard
- on demand via the command fstrim
"-o discard" can have some negative consequences on performance on some SSDs or at least whether it adds worthwhile performance is up for debate depending on who you ask, and makes undeletion/recovery near impossible while being a security problem if you use dm-crypt underneath (see http://asalor.blogspot.com/2011/08/t...-problems.html ), therefore it is not enabled by default. You are welcome to run your own benchmarks and post them here, with the caveat that they'll be very SSD firmware specific.
The fstrim way is more flexible as it allows to apply trim on a specific block range, or can be scheduled to time when the filesystem perfomace drop is not critical.
"A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
– John F. Kennedy, February 26, 1962.
- Top
- Bottom
Comment
-
Thanks guys, I forgot to mention I use ext4...but will take a look and am not too fussed about a cron job because I can just do a sudo fstrim -v / once every couple of weeks or something manually. I did read some of the many debates about trim being applied too frequently, I think it was when (until recently) I was using Manjaro...I wont bother setting up a cron, but by the looks of it there is already one as per jglens reply but he is mentioning 16.04...I was just wondering about 18.04 and Kubuntu specifically...thanks for replies
Looks like systemd is doing somethig with trim here is my output
Code:nexus6@Bladerunner:~$ dpkg -L util-linux|grep fstrim /lib/systemd/system/fstrim.service /lib/systemd/system/fstrim.timer /sbin/fstrim /usr/share/bash-completion/completions/fstrim /usr/share/man/man8/fstrim.8.gz
- Top
- Bottom
Comment
-
"A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
– John F. Kennedy, February 26, 1962.
- Top
- Bottom
Comment
-
I followed most of the advice on this page https://sites.google.com/site/easylinuxtipsproject/ssd to set up trim as a daily cron job.
The advantages of running it daily is that it only takes a few seconds (on my system anyway) to complete.
Here is the syslog output of the trim done tonight after a fresh restart. It took longer than usual (four seconds) and seems to have trimmed most of the system partition. Usually, it just trims a few Gb and the process takes no more than two seconds.
Code:Jun 25 00:00:02 Core-i5 systemd[1]: Starting Discard unused blocks... Jun 25 00:00:06 Core-i5 fstrim[4303]: /: 44.6 GiB (47822770176 bytes) trimmed
Last edited by Rod J; Jun 24, 2018, 06:52 AM.Desktop PC: Intel Core-i5-4670 3.40Ghz, 16Gb Crucial ram, Asus H97-Plus MB, 128Gb Crucial SSD + 2Tb Seagate Barracuda 7200.14 HDD running Kubuntu 18.04 LTS and Kubuntu 14.04 LTS (on SSD).
Laptop: HP EliteBook 8460p Core-i5-2540M, 4Gb ram, Transcend 120Gb SSD, currently running Deepin 15.8 and Manjaro KDE 18.
- Top
- Bottom
Comment
-
Originally posted by Rod J View PostI followed most of the advice on this page https://sites.google.com/site/easylinuxtipsproject/ssd to set up trim as a daily cron job.
The advantages of running it daily is that it only takes a few seconds (on my system anyway) to complete.
Here is the syslog output of the trim done tonight after a fresh restart. It took longer than usual (four seconds) and seems to have trimmed most of the system partition. Usually, it just trims a few Gb and the process takes no more than two seconds.
Code:Jun 25 00:00:02 Core-i5 systemd[1]: Starting Discard unused blocks... Jun 25 00:00:06 Core-i5 fstrim[4303]: /: 44.6 GiB (47822770176 bytes) trimmed
"A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
– John F. Kennedy, February 26, 1962.
- Top
- Bottom
Comment
-
Originally posted by Return2Kubutnu View PostThanks guys, I forgot to mention I use ext4...but will take a look and am not too fussed about a cron job because I can just do a sudo fstrim -v / once every couple of weeks or something manually. I did read some of the many debates about trim being applied too frequently, I think it was when (until recently) I was using Manjaro...I wont bother setting up a cron, but by the looks of it there is already one as per jglens reply but he is mentioning 16.04...I was just wondering about 18.04 and Kubuntu specifically...thanks for replies
Looks like systemd is doing somethig with trim here is my output
Code:nexus6@Bladerunner:~$ dpkg -L util-linux|grep fstrim /lib/systemd/system/fstrim.service /lib/systemd/system/fstrim.timer /sbin/fstrim /usr/share/bash-completion/completions/fstrim /usr/share/man/man8/fstrim.8.gz
The next brick house on the left
Intel i7 11th Gen | 16GB | 1TB | KDE Plasma 5.27.11| Kubuntu 24.04 | 6.8.0-31-generic
- Top
- Bottom
Comment
-
I guess it depends on the installation, but here I have this file; /etc/cron.monthly/fstrim
and it contains
Code:#!/bin/sh # trim all mounted file systems which support it /sbin/fstrim --all || true
- Top
- Bottom
Comment
-
Originally posted by GreyGeek View Post4 seconds. Not too shabby. Are you using EXT4?
Better late than never I guess ... yes I'm still using EXT4.Desktop PC: Intel Core-i5-4670 3.40Ghz, 16Gb Crucial ram, Asus H97-Plus MB, 128Gb Crucial SSD + 2Tb Seagate Barracuda 7200.14 HDD running Kubuntu 18.04 LTS and Kubuntu 14.04 LTS (on SSD).
Laptop: HP EliteBook 8460p Core-i5-2540M, 4Gb ram, Transcend 120Gb SSD, currently running Deepin 15.8 and Manjaro KDE 18.
- Top
- Bottom
Comment
-
It seems Kubuntu 18.04 also automatically added fstrim.service to my system.
Code:specialed@specialed-Aspire-VN7-791:~$ dpkg -L util-linux|grep fstrim /lib/systemd/system/fstrim.service /lib/systemd/system/fstrim.timer /sbin/fstrim /usr/share/bash-completion/completions/fstrim /usr/share/man/man8/fstrim.8.gz
Code:specialed@specialed-Aspire-VN7-791:~$ systemd-analyze blame 15.071s fstrim.service 7.953s NetworkManager-wait-online.service 1.783s apt-daily-upgrade.service 1.324s networkd-dispatcher.service 1.192s gpu-manager.service 1.154s snapd.service 748ms mpd.service 660ms NetworkManager.service 647ms apt-daily.service 612ms motd-news.service 538ms colord.service 520ms dev-sdb1.device 470ms systemd-user-sessions.service 403ms virtualbox.service 263ms udisks2.service 217ms systemd-logind.service 200ms ModemManager.service 183ms systemd-resolved.service 180ms grub-common.service 172ms systemd-timesyncd.service 148ms systemd-udevd.service 147ms apparmor.service 129ms systemd-journal-flush.service 128ms systemd-rfkill.service 127ms upower.service 123ms wpa_supplicant.service 110ms accounts-daemon.service 93ms alsa-restore.service 77ms keyboard-setup.service 76ms apport.service 70ms systemd-udev-trigger.service 68ms plymouth-quit.service 65ms rsyslog.service 56ms polkit.service 55ms thermald.service 53ms swapfile.swap 45ms systemd-journald.service
If you think Education is expensive, try ignorance.
The difference between genius and stupidity is genius has limits.
- Top
- Bottom
Comment
-
Originally posted by SpecialEd View PostIt seems Kubuntu 18.04 also automatically added fstrim.service to my system.
This runs every time I boot the machine. The problem is it adds 15 seconds to my boot time.
I have done quite a few fresh installs of 18.04 and 18.10 recently and trim has always been setup to run weekly by default.
Unless you boot only once a week it shouldn't show up in your systemd -analayze report I guess?
Code:● fstrim.timer - Discard unused blocks once a week Loaded: loaded (/lib/systemd/system/fstrim.timer; enabled; vendor preset: enabled) Active: active (waiting) since Mon 2018-11-12 08:48:47 CET; 26min ago Trigger: Mon 2018-11-19 00:00:00 CET; 6 days left Docs: man:fstrim Nov 12 08:48:47 hermes systemd[1]: Started Discard unused blocks once a week.
- Top
- Bottom
Comment
Comment