I want to write a script that will check all ext2/3/4 partitions with the command e2fsck. Following part detects and checks all partitions of type ext2/3/4:
Code:
while read dev _
do
echo "ext partition found = $dev"
e2fsck $dev
done <<< "$( blkid | grep 'TYPE="ext' | cut -d':' -f1 )"
How can I check if any of these partitions is mounted since it is not recommended to check mounted partitions? Or there is no need to modify this since the command e2fsck will not check a mounted partition? Thanks for your help.