#!/bin/sh -x

#
#... create gluster volume
#
gluster volume create testbrick01 gfstest.corvidtec.com:/data/brick01/testbrick01
gluster volume start testbrick01
mkdir /testbrick01
mount -t glusterfs gfstest.corvidtec.com:/testbrick01 /testbrick01 -o transport=tcp,_netdev

#
#... Test speed of gluster 
#
cd /testbrick01
cp /root/boost_1_57_0.tar .
time tar -xPf boost_1_57_0.tar; mv boost_1_57_0 ztemp01
time tar -xPf boost_1_57_0.tar; mv boost_1_57_0 ztemp02
time tar -xPf boost_1_57_0.tar; mv boost_1_57_0 ztemp03
time tar -xPf boost_1_57_0.tar; mv boost_1_57_0 ztemp04
time tar -xPf boost_1_57_0.tar; mv boost_1_57_0 ztemp05
time tar -xPf boost_1_57_0.tar; mv boost_1_57_0 ztemp06
time tar -xPf boost_1_57_0.tar; mv boost_1_57_0 ztemp07
time tar -xPf boost_1_57_0.tar; mv boost_1_57_0 ztemp08
time tar -xPf boost_1_57_0.tar; mv boost_1_57_0 ztemp09
time tar -xPf boost_1_57_0.tar; mv boost_1_57_0 ztemp10
time du -h -s ztemp01
time find ztemp02 | wc
time ls -R ztemp03 >& /dev/null
mv /var/log/glusterfs/testbrick01.log /root/testbrick01.log.1

#
#... Test underlying XFS file system
#
mkdir /data/brick01/temptest
cd    /data/brick01/temptest
cp /root/boost_1_57_0.tar .
time tar -xPf boost_1_57_0.tar; mv boost_1_57_0 ztemp01
time tar -xPf boost_1_57_0.tar; mv boost_1_57_0 ztemp02
time tar -xPf boost_1_57_0.tar; mv boost_1_57_0 ztemp03
time du -h -s ztemp01
time find ztemp02 | wc
time ls -R ztemp03 >& /dev/null
rm -rf /data/brick01/temptest

#... Reboot the machine and run speedtest2 script