#!/bin/sh -x

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

#
#... Test speed of gluster 
#
cd /testbrick02
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/testbrick02.log /root/testbrick02.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