Frank Steinmetzger wrote:
> Am Sun, Mar 23, 2025 at 04:41:58PM -0500 schrieb Dale:
>
>> Michael wrote:
>>> On Sunday, 23 March 2025 01:48:01 Greenwich Mean Time Dale wrote:
>>>> Michael wrote:
>>>>> Finally, consider TRIM being run on a cron job, or better use something
>>>>> like the SSDcronTRIM script once a month to decide and execute fstrim if
>>>>> needed.
>>> [snip ...]
>>>
>>>> The only thing on SSD is the OS itself.  I have partitions for /efi,
>>>> /boot with ext2, / and /var with ext4.  I'll set up fstrim later on. 
>>>> Given I have a 1TB stick and left well over 100GBs unused, I should have
>>>> room left over to last a while.  On my todo list tho.  Would once a
>>>> month be often enough tho?  I update each weekend.  Other than that, not
>>>> much changes really.  /home and such is on spinning rust still.  If I
>>>> did daily updates, might be a better plan.  Once a week, maybe monthly
>>>> will be OK. 
>>> Even once every 3-6 months would be more than enough.  The SSDcronTRIM will 
>>> check if your disk is filling up and will only run fstrim when/if it is 
>>> needed.
>>>
>>> https://chmatse.github.io/SSDcronTRIM/
>> That's not in the Gentoo tree.  Hmmmmm.  
> For systemd, fstrim ships with a unit file to run it once a week. You could 
> easily create something for cron. When my NAS is up again (my last remaining 
> Gentoo system) I could look at how I did it.
>
>> I ran fstrim on my root and var partitions and got this. 
>>
>>
>> root@Gentoo-1 / # fstrim -v /
>> /: 13.7 GiB (14676369408 bytes) trimmed
>> root@Gentoo-1 / # fstrim -v /var
>> /var: 43.9 GiB (47162359808 bytes) trimmed
>> root@Gentoo-1 / #
>>
>>
>> It looks like /var changes more than root does.
> The size in the output is usually simply the entire free space. AFAIK fstrim 
> does not remember what it trimmed at the previous run.

That doesn't match.  They may have changed something. 


%USED   USED     AVAILABLE  TOTAL MOUNTED ON
11.3%        24.2G    348.5G            392.7G /
37.1%        47.3G    110.8G            176.1G /var


I made those big since I hope to be using that thing for a while and
nothing is on LVM or anything.  Adding more space could get
interesting.  I went big and still have almost 200GBs unused. 


>> I kinda wish I just
>> could run it on the whole m.2 stick and it do its thing regardless of
>> mount point.  From the looks of the man page tho, that isn't a option. 
> fstrim -a runs on all file systems. If there is unassigned (unpartitioned) 
> space on your SSD, then that space is not written to anyways, thus there is 
> no need for trimming that.

I just created this.  I think this will work. 


root@Gentoo-1 / # cat /etc/cron.monthly/fstrim-nvme
#!/bin/sh

fstrim -v /
fstrim -v /var
root@Gentoo-1 / #


I'll try to remember when the next month comes up and see if it ran or
not.  It did when I ran run-parts thingy. 

I think once a month is plenty soon enough.  Weekly would just be to
much.  In another decade, we may not have to do anything to keep these
things going.  They just do their thing internally.  Heck, they have
improved a lot over the past decade. 

Dale

:-)  :-) 

Reply via email to