shell脚本内容(文件比较大时会很慢):
#!/bin/bash
echo "readzfsobj.sh <poolname> <objectid> <outfile>"
touch $3
#zdb -ddddd $1/ $2 |sed -n "/^ *[0123456789abcdef]* *L0 * /p" |awk '{print $3}'|while read line
zdb -ddddd $1/ $2 |sed -n "/^ *[0123456789abcdef]* *L0 * /p" |awk '{print $3":"$4}'|awk -F ':|L' '{print $1":"$2":"$4}'|while read line
do
#echo "zy:$line"
zdb -R $1 $line:r >>$3
done
并发模式:
#!/bin/bash
concurrent=100 ## 并发数
echo "readzfsobj.sh <poolname> <objectid> <outfile>"
touch $3
zdb -ddddd $1/ $2 |sed -n "/^ *[0123456789abcdef]* *L0 * /p" |awk '{print $3":"$4}'|awk -F ':|L' '{print $1":"$2":"$4}' > $2_list
cat $2_list |xargs -P $concurrent -I {} sh -c "zdb -R $1 {}:r > {}"
for line in `cat $2_list`
do
cat $line>>$3
rm -f $line
done
rm -f $2_list
参考:ZFS调试命令zdb之进阶用法_张宇(数据恢复)的技术博客_51CTO博客
原创文章,作者:,如若转载,请注明出处:https://blog.ytso.com/268174.html