Created
November 27, 2016 12:18
-
-
Save mratsim/81df761750022bd0b73758c71485da83 to your computer and use it in GitHub Desktop.
Auto trim SSD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# To find which FS support trim, we check that DISC-MAX (discard max bytes) | |
# is great than zero. Check discard_max_bytes documentation at | |
# https://www.kernel.org/doc/Documentation/block/queue-sysfs.txt | |
# | |
for fs in $(lsblk -o MOUNTPOINT,DISC-MAX,FSTYPE | grep -E '^/.* [1-9]+.* ' | awk '{print $1}'); do | |
fstrim "$fs" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment