Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- # Finds all files in your filesystem and attempts to read all the blocks
- # referenced by the file. Files that contain bad blocks are noted in stdout.
- # Run as superuser.
- #
- #!/bin/bash
- count=0
- echo "Finding all files..."
- find / -type f > /tmp/files
- total=`wc -l /tmp/files | awk '{print $1}'`
- echo "Reading all files..."
- cat /tmp/files | while read -r file
- do
- let count=$count+1
- let mod=$count%1000
- if [ $mod -eq 0 ]
- then
- echo $count/$total
- fi
- if [ -f "$file" ]; then
- dd if="$file" of=/dev/null > /dev/null 2>&1
- fi
- if [ $? -ne 0 ]
- then
- echo Bad blocks found in: $file;
- fi
- done
Add Comment
Please, Sign In to add comment