chmatse / SSDcronTRIM

Intelligent cron job script which automatically decides how often to trim one or more SSD partitions
GNU General Public License v3.0
26 stars 7 forks source link

Select cron periodicity from global SSD disk usage #2

Closed ymartin59 closed 10 years ago

ymartin59 commented 10 years ago

It is not relevant to select cron periodicity per filesystem. It should be evaluated for a whole SSD device on its own, as all filesystems allocated on a single device share the same free block pool. You may have a small almost full filesystem with almost no write activities like "/opt" but if the SSD is only allocated to 50% there is no need to trig fstrim hourly. To evaluate SSD allocation, unallocated partition space and unallocated LVM volume group space must be taken into account too.

chmatse commented 10 years ago
It is not relevant to select cron periodicity per filesystem.
It should be evaluated for a whole SSD device on its own, as all
filesystems allocated on a single device share the same free block pool.

They may share the same block pool, but fstrim does only discard unused blocks on a mounted filesystem and not on the whole block pool.

[...]
fstrim  is  used  on  a mounted filesystem to discard (or "trim") blocks which are
not in use by the filesystem.
[...]

So as long as fstrim does not free up the space on the whole disk, it is relevant to trim it per filesystem.

You may have a small almost full filesystem with almost no write activities
like "/opt" but if the SSD is only allocated to 50% there is no need to trig
fstrim hourly.

I agree with you. But in such a case i would just recommend to NOT put /opt into SSD_MOUNT_POINTS. Therefore this filesystem will also not be trimmed.

ymartin59 commented 10 years ago

Right. I wrote my message with the idea the script may process all filesystems in a whole by detecting where fstrim is required. I am testing some code...