Add fstrim service and fstrim timer by default #2804
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add fstrim service and fstrim timer by default
This service (weekly) will let SSD firmware to do the garbage collection
after file-system deleted files. It could avoid slowness or
even READ-ONLY error due to SSD not being able to free the pages
even though the file system thinks there was a lot of space left.
Signed-off-by: Zhenggen Xu zxu@linkedin.com
- What I did
Add fstrim service and fstrim timer by default
- How I did it
Enable the service and timer for all platforms during the building process.
- How to verify it
After build image and load image:
sudo service fstrim status
● fstrim.service - Discard unused blocks
Loaded: loaded (/etc/systemd/system/fstrim.service; static)
Active: inactive (dead) since Tue 2019-03-26 05:25:29 UTC; 9min ago
Process: 22259 ExecStart=/sbin/fstrim -av (code=exited, status=0/SUCCESS)
Main PID: 22259 (code=exited, status=0/SUCCESS)
Mar 26 05:25:29 sonic fstrim[22259]: /var/log: 3.8 GiB (4072431616 bytes) trimmed
Mar 26 05:25:29 sonic systemd[1]: Started Discard unused blocks.
admin@sonic:~$ sudo systemctl list-timers
NEXT LEFT LAST PASSED UNIT ACTIVATES
Wed 2019-03-27 05:30:29 UTC 23h left Tue 2019-03-26 05:30:29 UTC 4min 57s ago systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service
Mon 2019-04-01 00:00:00 UTC 5 days left Tue 2019-03-26 05:25:29 UTC 9min ago fstrim.timer fstrim.service
2 timers listed.
Pass --all to see loaded but inactive timers, too.
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)