
遍历所有挂载点,进行读写测试即可。

#!/bin/bash
for mount_m in `df |sed '1d' |grep -v 'tmpfs' | grep -v 'devtmpfs' |awk '{print $NF}'`
do
touch $mount_m/testfile && rm -f $mount_m/testfile
if [ $? -ne 0 ]
then
echo "$mount_m 读写 异常"
else
echo "$mount_m 读写 OK"
fi
done解析:
dfdf |grep -v 'tmpfs' |grep -v 'devtmpfs'sed '1d'awk '{print $NF}'&& —> touch testfile && rm -f testfile