daily pastebin goal
63%
SHARE
TWEET

Untitled

a guest Jun 21st, 2017 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2.  
  3. master1=master2
  4. slave1=slave2
  5. tests=10
  6. tests2=100
  7.  
  8. echo "Exporting master1 and slave1"
  9.  
  10. zpool export $master1
  11. zpool export $slave1
  12.  
  13. sleep 1
  14.  
  15. if [ -f blob00 ]; then
  16.   rm blob00
  17. fi
  18.  
  19. if [ -f blob11 ]; then
  20.   rm blob11
  21. fi
  22.  
  23. dd if=/dev/zero of=blob00 bs=1024k count=256
  24. dd if=/dev/zero of=blob11 bs=1024k count=256
  25.  
  26. sleep 1
  27. echo "Creating md devices"
  28.  
  29. md0=`mdconfig -a -t vnode blob00`
  30. md1=`mdconfig -a -t vnode blob11`
  31.  
  32. echo "Creating first pool"
  33.  
  34. zpool create $master1 "/dev/$md0"
  35.  
  36. echo "testing" > /$master1/test
  37.  
  38. sleep 1
  39. echo "Testing master1 export/import"
  40. for V in `seq 0 $tests`
  41. do
  42.         zpool export $master1
  43.         zpool import $master1
  44.         printf "\r(%d/%d)" $V $tests
  45. done
  46.  
  47. echo "Creating second pool"
  48. zpool create -O atime=off $slave1 "/dev/$md1"
  49.  
  50. echo "Testing slave1 export/import before snapshot"
  51. for V in `seq 0 $tests`
  52. do
  53.         zpool export $slave1
  54.         zpool import $slave1
  55.         printf "\r(%d/%d)" $V $tests
  56. done
  57.  
  58. echo "Importing slave1.."
  59. zpool export $slave1
  60. zpool import -N $slave1
  61.  
  62. echo "Creating snapshot..."
  63. zfs snapshot -r "$master1@today"
  64. zfs send -Rev "$master1@today" | zfs recv -Fu $slave1
  65. zpool list
  66.  
  67. zfs mount $slave1
  68. ls /$slave1
  69.  
  70. sleep 1
  71. echo "Final test of export/import for slave1"
  72. for V in `seq 0 $tests2`
  73. do
  74.         zpool export $slave1
  75.         zpool import $slave1
  76.         printf "\r(%d/%d)" $V $tests2
  77. done
  78.        
  79. zpool destroy $slave1
  80. zpool destroy $master1
  81. mdconfig -d -u $md0
  82. mdconfig -d -u $md1
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top