I read the whole thread now, and found one or two things I wasn't sure if they were true. Then I researched the whole thing for about two hours and started a giant reply, which I then turned into a blogpost. Hope thats ok
In reply to the thread though:
If we don’t perform TRIM regularly we won't be able to reclaim used space on the Drive over time which means the SSD will slow down and die
Trimming your SSD does not "free up space".
NAND flash, unlike HDD's, needs its blocks to be "cleared" (deleting the data) before you can write them again. with hdd's you can just write over it, but with SSDs the SSDs controller has to delete the block, and then you can use it.
This collides with how most filesystems work - they just delete the "metadata" about "where the file is" and then you can write to this space again.
Trimming your SSD instructs your SSD to actually overwrite those blocks. A systemd timer is setup by default on Debian and Ubuntu (there I checked) to run "weekly", which means Monday 00:00am, which executes this action (runs a
fstrim
). Debian expects your system to be mostly idle at mon 00:00am.
If you write to untrimmed blocks, your ssd will have to delete the block and THEN write the data. this leads to the write action needing more time. hence you do this regularly during idle hours.
So I conducted a little experiment running this command manually over several days.
If you dont generate and delete VAST amounts of data in short time periods, this should not be required.
Of cause it depends what I do on the computer.
yes
Above shows the amount of freed space
s/freed/processed
I checked with
df
on several servers I manage, and there is no freed space.
LOL nobody told me about trim is it like defrag?
no its not
Does this only work with SSD's or is it good for HDD's also?
with HDDs you can overwrite blocks directly without having to delete them first (having as in the SSDs controller does that for you)
No...never defrag an SSD it will kill it very fast. 1713676839653.gif
never is incorrect, as the linux distro maintainers set this to one week by default (see
/usr/lib/systemd/system/fstrim.timer
on debian based distros)
yes you can Trim an external HDD...I just did but don't need too.
man fstrim
first line: "This is useful for solid-state drives (SSDs) and thinly-provisioned storage."
Not sure what it actually did on your ssd.
also
man mount
-> search "-o discard": "If set, causes discard/TRIM commands to be issued to the block device when blocks are freed. This is useful for SSD devices and sparse/thinly-provisioned LUN"
If you run a VERY high write / delete system, yes, maybe.
If you ever needed to recover deleted files, like with testdisk or photorec, those can't recover deleted files that have been trimmed away.
Correct. Trimmed blocks on SSDs are gone.
the important thing is to provision 10-20% of SSD to not get used.
Correct, due to over provisioning. as this has not to much to do with trimming an ssd I did not write about it or research it much further, but, among not trimming your ssd, it is another cause of write amplification (a write operating taking more time than it should.
I have it set to to the default which is as often as I trim my nails, once every week.
yolo
))
SSD over-provisioning has been a thing for a while:
On this I'm not 100% sure but from what I understand the unused space is mostly used for wear leveling.
without you I would probably completely forgot to trim my SSD!
You CAN forget about it as the systemd timer described above does that for you
when nand blocks die, your SSD will "replace" their addresses with the spare ones. Also your ssd tries to keep the number of write operations similar for all blocks, so that your ssd's blocks age at a similar pace. thats all magic your ssd controller does for you under the hood, not a kernel thing.
I guess this one is more of a consumer thing, as in datacenters / cloud you don't really care if a SSD dies, ceph manages this for you and you just replace the SSD. If your laptop's ssd smokes off and you dont have backups, yes.
I think this might have been more for older generations of SSDs. Do backups and you can have swap on your laptop on SSD. Do backups if you dont
If in doubt just manage the
https://www.howtogeek.com/449691/what-is-swapiness-on-linux-and-how-to-change-it/ a bit. If you run
free -m
and you use swap at all, then download more ram. I have no box that uses swap and my monitoring alerts me if they do. Using swap means you need more ram - in my world at least (hosting and unless suspend to disk, correct).
The controlling technology is in the firmware of the ssd and helps even out the wearing on the cells. The ssds can be conceived to have their own little OSs managing the storage in conjunction with the user's OS.
gave you a thumbsup for the whole post
A 500GB SSD...install Mint (2.9GB) space now on Drive about 460GB because formatting takes up space
I might missunderstand you, but if you mean formatting as in creating a GPT and a filesystem, then (almost) no. If you mean the OS no idea what mint installs by default
thats another topic ofc.
If you're not running a server but a personal workstation then what's the reason to keep your system up for so long?
its called "collecting uptime" and its to increase your level of coolness x)
My dumb box turned off yesterday, forgot to attach the charger after a meeting. meh. cant join.
Jokes aside. Reboot your boxes to apply kernel upgrades and dont collect more than a week of uptime. configure your low-importance servers to reboot automatically on kernel upgrades
https://askubuntu.com/questions/1401765/reboot-automatically-when-kernel-is-upgraded or setup a monitoring alert for your needs-100%-uptime servers so you can manually do it.
Modern hardware has reached the point where I'm satisfied with the performance and my devices are lasting longer.
you need a gpu to run a LLM locally now
There will ALWAYS be something xD But yes I kinda agree with you lol
Here is the blogpost about
why linux fstrim runs weekly by default, and how it helps increase SSD write performance.