Guest User

test-storage.sh

a guest
May 1st, 2017
116
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. apt install -y fio ioping
  3. sleep 2
  4. sync
  5. cd /root
  6. iozone -e -I -a -s 100M -r 4k -r 16k -r 512k -r 1024k -r 16384k -i 0 -i 1 -i 2 >/tmp/storage-details.txt
  7. sleep 2
  8. sync
  9. echo -e "\n" >>/tmp/storage-details.txt
  10. ioping -c 10 . >>/tmp/storage-details.txt
  11. sleep 2
  12. sync
  13. echo -e "\n" >>/tmp/storage-details.txt
  14. fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=test --filename=test --bs=4k --iodepth=64 --size=100M --readwrite=randrw --rwmixread=75 >>/tmp/storage-details.txt
  15. sleep 2
  16. sync
  17.  
  18. StartTime=$(date "+%s")
  19. echo ${StartTime} >/tmp/omv-installation-start-time.txt
  20. cp -p /etc/default/cpufrequtils /etc/default/cpufrequtils.bak
  21. locale-gen "en_US.UTF-8"
  22. locale-gen "C"
  23. export LANG=C LC_ALL="en_US.UTF-8"
  24.  
  25. #Add OMV source.list and Update System
  26. cat > /etc/apt/sources.list.d/openmediavault.list <<- EOF
  27. # deb http://packages.openmediavault.org/public erasmus main
  28. deb https://openmediavault.github.io/packages/ erasmus main
  29. ## Uncomment the following line to add software from the proposed repository.
  30. # deb http://packages.openmediavault.org/public erasmus-proposed main
  31. deb https://openmediavault.github.io/packages/ erasmus-proposed main
  32.  
  33. ## This software is not part of OpenMediaVault, but is offered by third-party
  34. ## developers as a service to OpenMediaVault users.
  35. # deb http://packages.openmediavault.org/public erasmus partner
  36. EOF
  37.  
  38. # Add OMV and OMV Plugin developer keys
  39. debconf-apt-progress -- apt-get update
  40. apt-get --yes --force-yes --allow-unauthenticated install openmediavault-keyring
  41. apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 7AA630A1EDEE7D73
  42.  
  43. # install debconf-utils, postfix and OMV
  44. debconf-set-selections <<< "postfix postfix/mailname string openmediavault"
  45. debconf-set-selections <<< "postfix postfix/main_mailer_type string 'No configuration'"
  46. apt-get --yes --force-yes --allow-unauthenticated --fix-missing --no-install-recommends \
  47. -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install \
  48. debconf-utils postfix
  49. read HOSTNAME </etc/hostname
  50. sed -i -e "s/^::1 localhost.*/::1 ${HOSTNAME} localhost ip6-localhost ip6-loopback/" \
  51. -e "s/^127.0.0.1 localhost.*/127.0.0.1 ${HOSTNAME} localhost/" /etc/hosts
  52. sed -i -e "s/^mydestination =.*/mydestination = ${HOSTNAME}, localhost.localdomain, localhost/" \
  53. -e "s/^myhostname =.*/myhostname = ${HOSTNAME}/" /etc/postfix/main.cf
  54. export DEBIAN_FRONTEND=noninteractive
  55. apt-get --yes --force-yes --allow-unauthenticated --fix-missing --no-install-recommends \
  56. -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install \
  57. openmediavault
  58.  
  59. # install OMV extras, enable folder2ram, tweak some settings
  60. FILE=$(mktemp)
  61. wget http://omv-extras.org/openmediavault-omvextrasorg_latest_all3.deb -qO $FILE && dpkg -i $FILE && rm $FILE
  62. /usr/sbin/omv-update
  63.  
  64. # Netatalk performance fix
  65. mkdir -p /var/lib/netatalk/CNID
  66.  
  67. # use folder2ram instead of log2ram with OMV
  68. apt-get -y install openmediavault-flashmemory
  69. sed -i -e '/<flashmemory>/,/<\/flashmemory>/ s/<enable>0/<enable>1/' \
  70. -e '/<ssh>/,/<\/ssh>/ s/<enable>0/<enable>1/' /etc/openmediavault/config.xml
  71. sed -i '/^EOF$/itmpfs\t\t/var/lib/netatalk/CNID' /usr/share/openmediavault/mkconf/flashmemory
  72. /usr/sbin/omv-mkconf flashmemory
  73. systemctl disable log2ram
  74. /sbin/folder2ram -enablesystemd
  75. sed -i 's|-j /var/lib/rrdcached/journal/ ||' /etc/init.d/rrdcached
  76.  
  77. # some performance tuning: Samba, cpufreq behaviour, IO scheduling/priority
  78. . /usr/share/openmediavault/scripts/helper-functions
  79. SMB_Options="min receivefile size = 16384\nwrite cache size = 524288\ngetwd cache = yes\nsocket options = TCP_NODELAY IPTOS_LOWDELAY"
  80. xmlstarlet ed -L -u "/config/services/smb/extraoptions" -v "$(echo -e "${SMB_Options}")" ${OMV_CONFIG_FILE}
  81. mv /etc/default/cpufrequtils.bak /etc/default/cpufrequtils
  82. grep -q ondemand /etc/default/cpufrequtils && sed -i '/^exit\ 0/i \
  83. echo ondemand >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor \
  84. sleep 0.1 \
  85. cd /sys/devices/system/cpu \
  86. for i in cpufreq/ondemand cpu0/cpufreq/ondemand cpu4/cpufreq/ondemand ; do \
  87. if [ -d $i ]; then \
  88. echo 1 >${i}/io_is_busy \
  89. echo 25 >${i}/up_threshold \
  90. echo 10 >${i}/sampling_down_factor \
  91. fi \
  92. done \
  93. ' /etc/rc.local
  94. StopTime=$(date "+%s")
  95. echo ${StopTime} >/tmp/omv-installation-stop-time.txt
  96. Duration=$(( ${StopTime} - ${StartTime} ))
  97. echo -e "\n\n\nInstallation took ${Duration} seconds"
RAW Paste Data