git.annexia.org
/
libguestfs-talks.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Replace tar2iso example with badblocks example.
[libguestfs-talks.git]
/
2019-fosdem
/
badblocks.sh
diff --git a/2019-fosdem/badblocks.sh
b/2019-fosdem/badblocks.sh
new file mode 100755
(executable)
index 0000000..
863c6b5
--- /dev/null
+++ b/
2019-fosdem/badblocks.sh
@@ -0,0
+1,14
@@
+#!/bin/bash
+
+case "$1" in
+ open) ;;
+ get_size) echo 64M ;;
+ pread)
+ if [ $4 -le 100000 ] && [ $(( $4+$3 )) -gt 100000 ]; then
+ echo EIO Bad block >&2
+ exit 1
+ else
+ dd if=/dev/zero count=$3 iflag=count_bytes
+ fi ;;
+ *) exit 2 ;;
+esac