Ok, here is the issue I have..
I wrote a script that builds disk groups using vxvm, and it works really good. I added a feature that would tell you the max size you could build your your lvol to. I do this by getting the size of the disks I am using in KB, I subtract 5104 from it, and then I multiply it by the number of disks I am using to build my disk group. I set this to a variable called $NUMBER for use throughout the script. The function is finished, it outputs the answer to a file called value.txt. For some reason it works great until $NUMBER = 5 or more.
Below is the section of the script that is giving me issues:
function adder_func
{
TYPE=$1
if [ -s sizes.$TYPE ]; then
let sum=0
for i in `cat sizes.$TYPE`
do
((i=$i - 5104))
((new_sum=$i + $sum))
sum=$new_sum
done
((last_sum=$new_sum*$NUMBER))
echo ${last_sum}
else
break
fi
}
## Call the adder_func function and output to value.txt to get the max size for your lvol.
adder_func size > value.txt
When the function is with an option called 'size' it reads from a file called sizes.size (sizes.$TYPE). As you see, the size option is the same as the $TYPE variable.
Output from sizes.size (which is the size of the disks in KB):
524288000
Here is the output from value.txt when the $NUMBER variable = 5:
-1149269920
When I do the math, of course it shouldn't be a large negative number:
root@server:/root_home> bc -l
524288000-5104
524282896
524282896*5
2621414480
So it should be 2621414480 or 2499.97GB, or about 2.5TB.
Am I surpassing the numerical limits of the function?