Last active
May 18, 2024 22:20
-
-
Save cachrisman/7b0e1b4bd17f9feb20a3 to your computer and use it in GitHub Desktop.
bash script to show speed, data remaining and estimated time to completion of Apple OS X FileVault 2 encryption/decryption process
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/bash | |
interval=5 # Sampling time in seconds | |
volumename="/Volumes/My Passport for Mac/" | |
total_size=$(diskutil cs info "$volumename" | grep -E "LV Size" | awk '{print $3}') | |
while [ true ]; do | |
first_size=$(diskutil cs info "$volumename" | grep -E "LV Bytes Converted" | awk '{print $4}') | |
sleep $interval | |
second_size=$(diskutil cs info "$volumename" | grep -E "LV Bytes Converted" | awk '{print $4}') | |
speed=$((($second_size-$first_size)/$interval)) | |
remaining=$((total_size-second_size)) | |
echo $speed | awk '{ speed = $1 / 1024 / 1024; printf "\rSpeed: %.1f MB/sec" , speed}' | |
echo $remaining | awk '{ remaining = $1 / (1024 * 1024 * 1024); printf " | Remaining: %.4f GB" ,remaining}' | |
echo $remaining $speed | awk '{ ETD = $1 / $2 / 60; printf " | Time Left: %.1f minutes",ETD }' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment