Monitoring BTRFS Defragmenation – watching btrfs filesystem defrag
Step1. Start the command below
1 2 3 4 5 6 7 8 |
# COMMAND 1 Use this command if you have "watch" # ** use this as most likely you do have watch ** watch -n0.2 'ps uxeww | egrep "btrfs fi defrag|%CPU" | egrep -v "watch|awk|grep|sh"; ls -lisah /proc/$(ps ax | grep "btrfs fi defrag" | egrep -v "watch|awk|grep|sh" | awk "{print \$1}" 2> /dev/null)/fd/ 2> /dev/null;' # COMMAND 2: Use this command if you dont have "watch", and you only have while (notice change awk to single quotes and removed back slash), awk is best run with single quotes (but in reality it probably doesnt matter if you run with double quotes as long as you watch out for correct escapes with backslash) while true; do clear; ps uxeww | egrep "btrfs fi defrag|%CPU" | egrep -v "watch|awk|grep|sh"; ls -lisah /proc/$(ps ax | grep "btrfs fi defrag" | egrep -v "watch|awk|grep|sh" | awk '{print $1}' 2> /dev/null)/fd/ 2> /dev/null; done; |
NOTE: replace btrfs fi defrag with btrfs f.* de.* if you run btrfs fi defrag using its shorter name like btrfs f de, which also works because btrfs command is like theRead More…