Created
April 18, 2015 19:42
-
-
Save darrik/5a0cd70c899d90c6df03 to your computer and use it in GitHub Desktop.
Finding files on zfs that has copies=2 (or more)
This file contains hidden or 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 | |
for file in $(/bin/ls *.jpg); do | |
size=$(/bin/ls -l $file | awk '{printf $5}') | |
dusize=$(du --block-size=1 $file | awk '{print $1}') | |
verify=$(echo $size*1.5/1 | bc) | |
if [ $dusize -gt $verify ]; then | |
dusize=$(printf "%'d" $dusize) | |
size=$(printf "%'d" $size) | |
echo "$file has copies>1 ($dusize > $size)" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment