From 0d929b23526e74b6f5a49e34b0019f928c7bfec1 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sat, 17 Nov 2018 09:52:10 +0000 Subject: [PATCH] Replace tar2iso example with badblocks example. --- 2019-fosdem/.gitignore | 2 +- 2019-fosdem/6450-cd.svg | 71 ------- 2019-fosdem/6450-plugins-shell-what.html | 36 +++- 2019-fosdem/6450-tarfile.svg | 251 ------------------------- 2019-fosdem/6500-shell-next | 13 +- 2019-fosdem/6500-shell.d/badblocks.sh.template | 7 + 2019-fosdem/9000-final.html | 1 + 2019-fosdem/badblocks.sh | 14 ++ 8 files changed, 62 insertions(+), 333 deletions(-) delete mode 100644 2019-fosdem/6450-cd.svg delete mode 100644 2019-fosdem/6450-tarfile.svg create mode 100755 2019-fosdem/6500-shell.d/badblocks.sh.template create mode 100755 2019-fosdem/badblocks.sh diff --git a/2019-fosdem/.gitignore b/2019-fosdem/.gitignore index aa996d7..1a52eaa 100644 --- a/2019-fosdem/.gitignore +++ b/2019-fosdem/.gitignore @@ -6,7 +6,7 @@ /2200-partitioning.d/.root.img /2200-partitioning.d/root.img /2200-partitioning.d/swap.img -/6500-shell.d/tar2iso.sh +/6500-shell.d/badblocks.sh /nbdview/error? /nbdview/log? /nbdview/sock? \ No newline at end of file diff --git a/2019-fosdem/6450-cd.svg b/2019-fosdem/6450-cd.svg deleted file mode 100644 index 881455e..0000000 --- a/2019-fosdem/6450-cd.svg +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/2019-fosdem/6450-plugins-shell-what.html b/2019-fosdem/6450-plugins-shell-what.html index a1ea8ea..caa0bbd 100644 --- a/2019-fosdem/6450-plugins-shell-what.html +++ b/2019-fosdem/6450-plugins-shell-what.html @@ -4,6 +4,38 @@

What shell script?

- + - +
+BADBLOCKS(8)                System Manager's Manual               BADBLOCKS(8)
+
+NAME
+       badblocks - search a device for bad blocks
+
+SYNOPSIS
+       badblocks  [  -svwnfBX  ]  [ -b block_size ] [ -c blocks_at_once ] [ -d
+       read_delay_factor ] [ -e max_bad_blocks ] [ -i input_file ] [  -o  out‐
+       put_file  ] [ -p num_passes ] [ -t test_pattern ] device [ last_block ]
+       [ first_block ]
+
+DESCRIPTION
+       badblocks is used to search for bad blocks on a device (usually a  disk
+       partition).   device  is  the  special file corresponding to the device
+       (e.g /dev/hdc1).  last_block is the last block to be checked; if it  is
+       not  specified,  the  last  block  on  the device is used as a default.
+       first_block is an optional parameter specifying the starting block num‐
+       ber  for  the  test, which allows the testing to start in the middle of
+       the disk.  If it is not specified the first block on the disk  is  used
+       as a default.
+
+       Important  note:  If  the output of badblocks is going to be fed to the
+       e2fsck or mke2fs programs, it is important that the block size is prop‐
+       erly  specified,  since  the block numbers which are generated are very
+
diff --git a/2019-fosdem/6450-tarfile.svg b/2019-fosdem/6450-tarfile.svg deleted file mode 100644 index ae57d1a..0000000 --- a/2019-fosdem/6450-tarfile.svg +++ /dev/null @@ -1,251 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/2019-fosdem/6500-shell-next b/2019-fosdem/6500-shell-next index 0fd1dd0..00e3d49 100755 --- a/2019-fosdem/6500-shell-next +++ b/2019-fosdem/6500-shell-next @@ -3,19 +3,16 @@ source functions # Title. -export title="Writing tar2iso.sh" +export title="Writing badblocks.sh" # History. -remember 'emacs tar2iso.sh &' -remember 'nbdkit sh ./tar2iso.sh file=~/nbdkit-1.9.0.tar.gz' +remember 'emacs badblocks.sh &' +remember 'nbdkit sh ./badblocks.sh' remember 'sudo nbd-client -b 512 localhost /dev/nbd0' -remember 'sudo mount /dev/nbd0 /tmp/mnt' +remember 'sudo badblocks /dev/nbd0' ./restore pushd 6500-shell.d >/dev/null -rm -f tar2iso.sh -echo '#!/bin/bash' > tar2iso.sh -echo >> tar2iso.sh -chmod +x tar2iso.sh +cp badblocks.sh.template badblocks.sh terminal popd >/dev/null diff --git a/2019-fosdem/6500-shell.d/badblocks.sh.template b/2019-fosdem/6500-shell.d/badblocks.sh.template new file mode 100755 index 0000000..1435c36 --- /dev/null +++ b/2019-fosdem/6500-shell.d/badblocks.sh.template @@ -0,0 +1,7 @@ +#!/bin/bash + +case "$1" in + + + *) exit 2 ;; +esac diff --git a/2019-fosdem/9000-final.html b/2019-fosdem/9000-final.html index e4e1c8c..7de2cb5 100644 --- a/2019-fosdem/9000-final.html +++ b/2019-fosdem/9000-final.html @@ -8,6 +8,7 @@
  • Loopback mounts — don't do much.
  • Loopback mounts with NBD and nbdkit — infinitely flexible.
  • Lots of plugins, or write your own. +
  • Software development and testing.
  • nbdkit 1.8 now available in all major Linux distros.
  • https://github.com/libguestfs/nbdkit
  • This talk: http://git.annexia.org/?p=libguestfs-talks.git diff --git a/2019-fosdem/badblocks.sh b/2019-fosdem/badblocks.sh new file mode 100755 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 -- 1.8.3.1