Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
What format is your file system and is it mounted using the "discard" option?
This is not distribution specific, but file system specific.
If you are using a file system that understands SSD and has the "discard" option then it does "trim" dynamically and automagicly as blocks are allocated and deallocated. For those file systems you might never need fstrim, but running it once per week or month will not hurt.
If your file system does not understand and detect SSD, and does not mount with "discard", then you might want to run fstrim on a schedule, but how often will depend upon your priorities and usage patterns.
The drive is formatted as an ex4 file system and is not mounted using the discard option.
mount says:
Code:
/dev/sda1 on / type ext4 (rw,relatime,data=ordered)
Cheers Nigel
EXT4 is a great file system, but it does not autodetect SSD and does not add "discard" by default. You can change the mouont to include that option, as it is supported in the newer ext4 drivers. Check your man pages for detail.
If you do NOT add the option, or if it is not supported at your level, then run fstrim either on boot or a safe schedule for your usage profile. (Your usage profile is based upon how often files change allocations on your disk. The more often you change the disk allocation the more often you should trim the fs. )
NOT adding the discard option is valid, as dynamic trim can impact performance. If you need the maximum I/O speed from the SSD, do not enable discard on mount, but do run fstrim.
Note that there is not much advantage in doing trim on only one level. Someone using crypt, lvm, and ext4 would have to enable trim at three different levels to resolve all of the allocation repair. If you keep things simple life is easier, and this is very doable.
thanks for the info; i had a look at the "easylinuxtips" link, but then also had a look at my native https://wiki.archlinux.org/index.php/SSD - it had this to say about discard:
Quote:
Warning: Unfortunately, there are wide quality gaps of SSD's bios' to perform continuous TRIM, which is also why using the discard mount flag is recommended against generally by ext filesystem developer Theodore Ts'o. If in doubt about your hardware, apply #Periodic TRIM instead.
since i bought the cheapest SSD available, i did that:
Quote:
The util-linux package provides fstrim.service and fstrim.timer systemd unit files. Enabling the timer will activate the service weekly.
the arch wiki does not mention noatime, but i think i'll try it at least.
Ideally, I guess it's best to check before assuming.
to run trim at boot up : fstab : on a time schedule cron : or command line using a calendar to keep track of time past. forming a question eliminates the assumption and puts the burden on the second party. And from what @ondoho posted it looks like their is even another option now out there that I did not know about, as I don't systemD (much).
~]# journalctl -u fstrim
-- Logs begin at Sun 2018-01-14 16:00:11 AEDT, end at Wed 2018-06-06 17:35:28 AEST. --
Jun 04 11:01:49 localhost.localdomain systemd[1]: Starting Discard unused blocks...
Jun 04 11:01:51 localhost.localdomain systemd[1]: Started Discard unused blocks.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.