|
|
@@ -5,43 +5,17 @@ find / -type f -iname "thumbs.db" -exec rm {} \; 2> /dev/null &
|
|
|
find / -type f -iname ".ds_store" -exec rm {} \; 2> /dev/null &
|
|
|
find / -type f -name '._*' -exec rm -rf {} \; 2> /dev/null &
|
|
|
|
|
|
-# functions for asynchronous operations
|
|
|
-cleanup_ext4() {
|
|
|
- fstrim "$1"
|
|
|
- e4defrag "$1"
|
|
|
-}
|
|
|
-
|
|
|
-cleanup_btrfs() {
|
|
|
- fstrim "$1"
|
|
|
-
|
|
|
- btrfs balance start -dusage=1 "$1"
|
|
|
- btrfs balance start -musage=1 "$1"
|
|
|
- btrfs balance start -dusage=5 "$1"
|
|
|
- btrfs balance start -musage=5 "$1"
|
|
|
- btrfs balance start -dusage=10 "$1"
|
|
|
- btrfs balance start -musage=10 "$1"
|
|
|
- btrfs balance start -dusage=25 "$1"
|
|
|
- btrfs balance start -musage=25 "$1"
|
|
|
- btrfs balance start -dusage=50 "$1"
|
|
|
- btrfs balance start -musage=50 "$1"
|
|
|
-
|
|
|
- btrfs scrub start -qdB "$1"
|
|
|
-}
|
|
|
-
|
|
|
-# defragment and fstrim ext4 weekly
|
|
|
+# fstrim and defragment ext4
|
|
|
for filesystem in $(mount -t ext4 | awk '{print $3}'); do
|
|
|
- cleanup_ext4 "$filesystem" &
|
|
|
+ fstrim "$filesystem"
|
|
|
+ e4defrag "$filesystem"
|
|
|
done
|
|
|
|
|
|
-# defragment and rebalance ssd-only (hdd are too slow) btrfs weekly
|
|
|
+# rebalance and trim SSD btrfs (HDD are too slow and should be done manually)
|
|
|
for filesystem in $(mount -t btrfs | grep "ssd" | awk '{print $3}'); do
|
|
|
- cleanup_btrfs "$filesystem" &
|
|
|
-done
|
|
|
-
|
|
|
-# wait for jobs to complete
|
|
|
-for j in $(jobs -p); do
|
|
|
- wait $j
|
|
|
+ btrfs balance start -musage=11 dusage=10 "$filesystem"
|
|
|
+ fstrim "$filesystem"
|
|
|
done
|
|
|
|
|
|
# cleanup journalctl
|
|
|
-journalctl --vacuum-time=10d
|
|
|
+journalctl --vacuum-time=5d --vacuum-size=500M
|