Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- DISK="/dev/disk/by-id/ata-WDC_WD20NMVW-59AV3S3_WD-WXQ1EA4F4HS2"
- MAX_SECTORS=$(hdparm -I ${DISK} | grep sectors | grep LBA48 | rev | cut -d' ' -f1 | rev)
- JUMP=64
- LAST=$(cat last)
- while [ ${LAST} -lt ${MAX_SECTORS} ]; do
- if [ $(expr ${LAST} + ${JUMP}) -lt ${MAX_SECTORS} ]; then
- DIFF=${JUMP}
- else
- DIFF=${MAX_SECTORS} - ${LAST}
- fi
- RANGEEND=$(expr ${LAST} + ${DIFF})
- for i in $(seq ${LAST} ${RANGEEND}); do
- hdparm --yes-i-know-what-i-am-doing --write-sector ${i} ${DISK} 2>&1 | grep "sector" | awk '{printf "%s\r", $0}'
- done;
- LAST=$(expr ${LAST} + ${DIFF} + 1)
- echo -n ${LAST} > last
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement