Storage: multiple partition

Anything you want added or changed in future versions of ZoneMinder? Post here and there's a chance it will get in! Search to make sure it hasn't already been requested.
Post Reply
azir
Posts: 14
Joined: Tue Jan 22, 2008 7:30 am
Location: Surabaya, Indonesia

Storage: multiple partition

Post by azir »

I run zm for 8 (set to modect) camera and a dedicated 320 GB disk (as one ext3 partition) to hold the recording.
During high cpu load and high disk activity (when most camera modect-ing), many events are skipped (incomplete/blank frame).
It seems that the slow disk write caused this, or may be I'm wrong ? then I change the mount option of the partition with

Code: Select all

-orw,data=writeback,noatime,nodiratime
it went better, less incomplete/blank frame stored.
I got best frames when splitting the disk into 4 partitions, ext3 with above mount option.
Each partition holds recording for 2 cams, this is the layout
partiions mnt_point
part1 /mnt/zm/part1
part2 /mnt/zm/part2
part3 /mnt/zm/part3
part4 /mnt/zm/part4

/path/to/zmwebrootdir/events/1 --> /mnt/zm/part1/m1
/path/to/zmwebrootdir/events/2 --> /mnt/zm/part1/m2
/path/to/zmwebrootdir/events/3 --> /mnt/zm/part2/m3
/path/to/zmwebrootdir/events/4 --> /mnt/zm/part2/m4
/path/to/zmwebrootdir/events/5 --> /mnt/zm/part3/m5
/path/to/zmwebrootdir/events/6 --> /mnt/zm/part3/m6
/path/to/zmwebrootdir/events/7 --> /mnt/zm/part4/m7
/path/to/zmwebrootdir/events/8 --> /mnt/zm/part4/m8
--> is symlink to
But the problem is that zmfilter only monitoring partition where zmwebrootdir/events (ZM_DIR_EVENTS) reside.
I think it's good if zm capable of handling multiple partitions for this situation. Or anyone has hack for this already ? let me know please...
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

The only thing affected by this is there is not availabe size for each disk. It would have to be managed by an external script instead of using PurgeWhenFull filter.
There is a couple scripts in the contribs topic that would be easy to change to suit your needs and zmaudit will remove the events from the database after the files are removed from the drive.

http://www.zoneminder.com/forums/viewtopic.php?t=9466
azir
Posts: 14
Joined: Tue Jan 22, 2008 7:30 am
Location: Surabaya, Indonesia

Post by azir »

Thanks for the quick reply.

Yes, I'm also thinking about handling it with external script, but it merely still a thinking :oops:
I will browse the contribs anyway, thanks for reminding me about this.
Gonna report it here as soon as I resolve this.
azir
Posts: 14
Joined: Tue Jan 22, 2008 7:30 am
Location: Surabaya, Indonesia

Post by azir »

I got it, changed getDiskPercent and checkFilter subroutine on zmfilter.pl, so look like:

Code: Select all

sub getDiskPercent
{
    my $fMon    = shift;
    my $command;
    if ( $fMon ) 
    {
	$command = "df " . ZM_PATH_WEB . '/' . ZM_DIR_EVENTS . '/' . $fMon;
    }
    else 
    {
	$command = "df .";
    }
    my $df = qx( $command );
    my $space = -1;
    if ( $df =~ /\s(\d+)%/ms )
    {
        $space = $1;
    }
    #print($command . " : " . $space . "\n");
    return( $space );
}
....
sub checkFilter
{
...
    my $sql     = $filter->{Sql};
    $sql =~ /M\.(Id|Name)\s+\=\s+\'([a-zA-Z0-9_-]+)\'/;
    my $df_mon = $2?$2:'';
    #print($df_mon."\n");
    if ( $filter->{HasDiskPercent} )
    {
        my $disk_percent = getDiskPercent( $df_mon );
        $sql =~ s/zmDiskPercent/$disk_percent/g;
    }
...
I don't know how to write perl script, only try n test (plus error).
just tried to match and get monitor id or monitor name from the sql query then pass it to the df command.
Probably will break on more complex sql query, but at least it works for me as i expected for simple filter like the following:
Archive Status equal to Unarchived Only
and Disk Percent greater than or equal to 70%
and MonitorId equal to 4
Still hoping for better caveats anyway...
Post Reply