Page 1 of 1

4 Cam, 4 hard drives how modify function getDiskPercent ?

Posted: Mon Mar 01, 2010 12:11 pm
by Flav
Hi.
Y need modify the function iin nclude/fonction.php

Code: Select all

function getDiskPercent()
{
    $df = shell_exec( 'df '.ZM_DIR_EVENTS );
    $space = -1;
    if ( preg_match( '/\s(\d+)%/ms', $df, $matches ) )
        $space = $matches[1];
    return( $space );
}
I have 4 Hard drives mounting like this

sdc1 --> /usr/share/zoneminder/events/1
sdd1 --> /usr/share/zoneminder/events/2
sde1 --> /usr/share/zoneminder/events/3
sdf1 --> /usr/share/zoneminder/events/4

I want creat filter with the diskspace function but this one give me the space in /usr/share/zoneminder/events the first HD sda1
And i'm not and good dev can someone help me ?

thanks

Posted: Mon Mar 01, 2010 2:04 pm
by coke
Is there a good reason to have them all on separate disks? Have you considered LVM? It's great for attaching sets of disks, and when you decide to add more later it's just a few simple commands.

Posted: Mon Mar 01, 2010 5:30 pm
by Flav
coke wrote:Is there a good reason to have them all on separate disks? Have you considered LVM? It's great for attaching sets of disks, and when you decide to add more later it's just a few simple commands.
I dont take the good explain.

It's for a private parking My system is a ubuntu with scsi Disksbay
All cam are hight def and they ars in Record Mode
We must save 3 month of records

The disksbay is attached like this (and i can't change it)

3 x 1Tb RAID 5 --> SDC1 --> Monitor1
3 x 1Tb RAID 5 --> SDD1 --> Monitor2
3 x 1Tb RAID 5 --> SDE1 --> Monitor3
3 x 1Tb RAID 5 --> SDF1 --> Monitor4

Posted: Mon Mar 01, 2010 9:25 pm
by coke
LVM is a method of pooling the disks to appear as 1. If you could reformat/arrange the volumes into an LVM then your 4 1 terabyte raids would show up as one big 16 terabyte disk.

Warning: LVM is not for the faint of heart, or for the boot partition. Google LVM2 in your native language and see if it's something you could do/would want to do.

Posted: Mon Mar 01, 2010 9:33 pm
by coke
Meanwhile, my regex is too rusty to argue with the other lines, but you'll want to change line 3 to

Code: Select all

$df = shell_exec( 'df --total /usr/share/zoneminder/events/1 /usr/share/zoneminder/events/2 /usr/share/zoneminder/events/3 /usr/share/zoneminder/events/4' );
It's a start.

Posted: Mon Mar 01, 2010 10:16 pm
by Flav
coke wrote:LVM is a method of pooling the disks to appear as 1. If you could reformat/arrange the volumes into an LVM then your 4 1 terabyte raids would show up as one big 16 terabyte disk.

Warning: LVM is not for the faint of heart, or for the boot partition. Google LVM2 in your native language and see if it's something you could do/would want to do.
I know But the System Administrator don't want change to LVM

Thanks