Page 1 of 2
How to move ZM directories?
Posted: Sun Oct 19, 2008 4:56 pm
by zm2009
Hello, apologies up front if this has been asked/answered -- I did not find it.
Running ZM 1.23.x on Debian Etch. Works great.
I simply want to put all streaming/video/etc into a different directory -- for example /zm instead of /var/www/zm (/zm is actually an LVM setup specifically for zm's exclusive use)
How can this be done completely?
It appears to take more than just changing the link statement in the setup.
(i.e., sudo ln -s /usr/share/zoneminder /var/www/zm)
because there are cache directories that seem to be linked within this directory:
cgi-bin -> ../../lib/cgi-bin
events -> /var/cache/zoneminder/events
images -> /var/cache/zoneminder/images
temp -> /var/cache/zoneminder/temp
I would appreciate any guidance on this. Thanks
Posted: Sun Oct 19, 2008 7:35 pm
by zm2009
Well, I just found a post on moving the image/events directories ... this should be good enough for now.
http://www.zoneminder.com/forums/viewtopic.php?t=12202
Posted: Sun Oct 19, 2008 10:50 pm
by zm2009
Maybe I just don't understand symbolic links ... but this didn't really do anything but move the parent directory over -- the files still appear to be in the same place.
i.e.,
df -h
after the move from the above post still shows /var 76%
Any guidance would be appreciated.
(Yes, I know that I quoted my own post
)
Posted: Mon Oct 20, 2008 2:13 pm
by SlovakJoe
What I did was setup an LVM just for storing the events. That's the bulk of ZM's data anyways. I have this LVM mounted in /media/zm. To link ZM to it I simply created the following link
/var/www/zm/events -> /media/zm
Now ZM saves all the events to the LVM.
Here's my blog posting about how great LVM is for ZM:
http://www.jozefnagy.com/content/using_ ... y_software
Posted: Mon Oct 20, 2008 2:38 pm
by zm2009
SlovakJoe wrote:What I did was setup an LVM just for storing the events. That's the bulk of ZM's data anyways. I have this LVM mounted in /media/zm. To link ZM to it I simply created the following link
/var/www/zm/events -> /media/zm
Now ZM saves all the events to the LVM.
Here's my blog posting about how great LVM is for ZM:
http://www.jozefnagy.com/content/using_ ... y_software
SlovakJoe: Thank you! I will try that and see how it goes. (Nice blog article btw).
Yes, I am very familiar with the benefits of the LVM and that is exactly why I want to do this -- I realize that having a RAID1 may actually decrease performance a bit in this case but once you go RAID you rarely go back
.
PS: Call me crazy but I am trying to go "minimal" to the extreme -- though I have everything working perfectly on a standard PC running Debian, I am hoping to put this on an old HP Thin client running Debian from a 4GB USB Flash Drive with the expansion chassis containing a capture card. I have a 2nd 32GB Flash to be the "data drive." My biggest concern right now is the lifecycle of the flash and if I can somehow instead maybe rig an old laptop IDE drive externally somehow (I have an 80GB 2.5" laying around). I am testing it out now to mirror (no pun intended
) my "production" system -- what fun.
The goal: Complete Surveillance in under 13W electricity.
Thanks again
Posted: Mon Oct 20, 2008 9:59 pm
by zm2009
I followed SlovakJoe's example as well and it appears to be proper, i.e.,
Code: Select all
ls -alh
lrwxrwxrwx 1 www-data www-data 10 2008-10-20 17:37 events -> /zm/events
but ZM Console STILL says 78% full (i.e., 78% happens to be the percentage full of /var)
Code: Select all
df -h
/dev/mapper/xxx-var 12G 8.8G 2.5G 78% /var
/dev/mapper/yyy-zm 28G 173M 26G 1% /zm
So, does ZM just report the % full of where the web server lives even if Events directory is properly linked?
If so, then the cleanup "filter" when set to 85%, for example, will activate when /var fills up instead of when /zm/events fills up?
Should I move *all* the files in /usr/share/zoneminder to /zm ?
It would be counterproductive for the system to believe that it had a lot less free space than it actually does (in this case 28G free).
Posted: Tue Oct 21, 2008 1:40 am
by cordel
You should only have to move the events directory and symlink to it from where the zm php files reside whether they are in /usr/share/zm or /var/www/html/zm, etc.
Posted: Tue Oct 21, 2008 3:04 am
by zm2009
cordel wrote:You should only have to move the events directory and symlink to it from where the zm php files reside whether they are in /usr/share/zm or /var/www/html/zm, etc.
cordel: Thanks, can you be more specific?? Does it matter what your cwd is when you issue the ln command? (Sorry but the man page for ln is very poor IMHO and I have not used this command much)
Right now Actual ZM files are in /usr/share/zoneminder
Free space is at /zm
I have a symlink setup as
Code: Select all
ln -s /zm/events /var/www/zm/events
Does that seem correct?
ZM still reports the free space % as what is in /var
PS: I have
not modified the ZM_DIR_EVENTS value -- it still reads "events"
Posted: Tue Oct 21, 2008 3:22 am
by cordel
No, not correct. You appear to be cascading links.
You should remove the existing link to events in /usr/share/zoneminder and recreate that link to point directly to your /zm/events assuming of course it's setup how I think it is.
ZM_DIR_EVENTS can only relate to the web root, not the system root so it should always be: events
Posted: Tue Oct 21, 2008 3:29 am
by zm2009
cordel wrote:No, not correct. You appear to be cascading links.
You should remove the existing link to events in /usr/share/zoneminder and recreate that link to point directly to your /zm/events assuming of course it's setup how I think it is.
ZM_DIR_EVENTS can only relate to the web root, not the system root so it should always be: events
Do you mind kindly giving me the syntax (based on how you think I have it)??
Where I want Events to go: /zm/events
Where ZM is installed: /usr/share/zoneminder
Where http is: /var/www/zm
Thanks in advance
Posted: Tue Oct 21, 2008 5:05 am
by cordel
Instead of assuming, how about I get more information so I can give a proper solution.
What do you have in /var/www/zm?
What do you have in /usr/share/zoneminder?
It's very odd to have both unless you are speaking of having the binaries in /usr/share/zoneminder
What do you currently have configured for ZM_DIR_EVENTS?
Do you have apache configured with the directive to FollowSymLinks?
Posted: Tue Oct 21, 2008 11:39 am
by zm2009
cordel: Answers below, thanks. I would really like to be able to "port" all ZM data files to /zm, if possible. I could then replace hard drives (or better still, logical volumes) at will (by copying the old files over to the new LVM first) AND even replace the OS (i.e., /var directory), without impacting ZM. Ultimately, I want to experiment with it on a Thin Client running Debian with the images going to a USB Flash Drive or maybe a rigged up laptop hard drive. (Again ZM appears to be working perfectly fine in the current config, except for email notification
)
cordel wrote:Instead of assuming, how about I get more information so I can give a proper solution.
What do you have in /var/www/zm? That is a link to /usr/share/zoneminder as indicated in the setup instructions here
What do you have in /usr/share/zoneminder? All the Zoneminder files:
Code: Select all
drwxr-xr-x 5 www-data www-data 20K 2008-10-20 23:15 .
drwxr-xr-x 134 root root 12K 2008-10-07 12:20 ..
-rw-r--r-- 1 www-data www-data 46K 2008-10-05 11:28 cambozola.jar
lrwxrwxrwx 1 www-data www-data 17 2008-09-22 14:14 cgi-bin -> ../../lib/cgi-bin
drwxr-xr-x 2 www-data www-data 4.0K 2008-10-01 23:35 db
lrwxrwxrwx 1 www-data www-data 10 2008-10-20 23:15 events -> /zm/events
-rw-r--r-- 1 www-data www-data 318 2008-09-21 23:38 favicon.ico
drwxr-xr-x 2 www-data www-data 4.0K 2008-10-01 23:35 graphics
lrwxrwxrwx 1 www-data www-data 28 2008-09-22 14:14 images -> /var/cache/zoneminder/images
lrwxrwxrwx 1 www-data www-data 6 2008-10-01 23:35 index.php -> zm.php
-rw-r--r-- 1 www-data www-data 2.4K 2008-09-21 23:38 mootools.ext.js
drwxr-xr-x 2 www-data www-data 4.0K 2008-05-04 20:43 sounds
lrwxrwxrwx 1 www-data www-data 26 2008-09-22 14:14 temp -> /var/cache/zoneminder/temp
-rw-r--r-- 1 www-data www-data 44K 2008-09-21 23:38 zm_actions.php
-rw-r--r-- 1 www-data www-data 9.9K 2008-09-21 23:38 zm_config.php
-rw-r--r-- 1 www-data www-data 16K 2008-09-21 23:38 zm_control_funcs.php
-rw-r--r-- 1 www-data www-data 12K 2008-09-21 23:38 zm_control_funcsX.php
-rw-r--r-- 1 www-data www-data 4.7K 2008-09-21 23:38 zm_db.php
-rw-r--r-- 1 www-data www-data 9.2K 2008-09-21 23:38 zm_export_funcs.php
-rw-r--r-- 1 www-data www-data 49K 2008-09-21 23:38 zm_funcs.php
-rw-r--r-- 1 www-data www-data 3.8K 2008-09-21 23:38 zm_html_base.css
-rw-r--r-- 1 www-data www-data 8.4K 2008-09-21 23:38 zm_html_config.php
--More--
etc
It's very odd to have both unless you are speaking of having the binaries in /usr/share/zoneminder Yes, binaries are in /usr/share/zoneminder
What do you currently have configured for ZM_DIR_EVENTS? events
Do you have apache configured with the directive to FollowSymLinks? Yes
Code: Select all
Alias /zm /usr/share/zoneminder
<Directory>
php_flag register_globals off
Options Indexes FollowSymLinks
<IfModule>
DirectoryIndex index.php
</IfModule>
</Directory>
Posted: Thu Oct 30, 2008 12:53 am
by zm2009
Bump for the best way to do this. Thanks
Posted: Thu Oct 30, 2008 5:06 am
by throwgood
Quick question but why do you have the Alias directive in your config? Your document root is probably /var/www so if you go to <hostname>/zm it will take you to /usr/share/zoneminder because /var/www/zm is symlinked to it. As you have it now when you go to <hostname>/zm it by passes the symlink you have setup between /usr/share/zoneminder and /var/www/zm. I don't know if changing this will help but at least it will remove one more confusing factor. Let me know it helps out.
Currently I setup exactly what you are trying to accomplish.
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
5.7G 2.4G 3.1G 43% /
/dev/mapper/VolGroup00-LogVol03
660G 335G 292G 54% /data
/dev/mapper/VolGroup00-LogVol02
9.5G 397M 8.6G 5% /var
/dev/sda1 99M 19M 76M 20% /boot
tmpfs 983M 0 983M 0% /dev/shm
/var/www/html/zm
-rw-r--r-- 1 root root 46494 Jul 25 16:38 cambozola.jar
lrwxrwxrwx 1 root root 15 Aug 1 11:48 events -> /data/zm/events
-rw-r--r-- 1 apache apache 318 Jul 25 14:44 favicon.ico
drwxr-xr-x 2 apache apache 4096 Jul 25 14:44 graphics
lrwxrwxrwx 1 root root 15 Aug 1 11:48 images -> /data/zm/images
lrwxrwxrwx 1 root root 6 Jul 25 14:44 index.php -> zm.php
-rw-r--r-- 1 apache apache 2393 Jul 25 14:44 mootools.ext.js
lrwxrwxrwx 1 root root 16 Aug 1 11:48 sounds -> /data/zm/sounds/
When I log into zoneminder my disk value is what's listed for /data. So for one of your questions I'm not sure if ZoneMinder just takes the value for the size of the mount that /events points to.
Posted: Thu Oct 30, 2008 6:11 am
by cordel
His configuration is just not right and some how there are duplicates which means somethings were done that should have never been.
The question becomes what was done as it needs to be undone.
my guess would be the php files should be in the /usr/share/zoneminder directory as aliased in the http.zm.conf as it's how most of the packagers do since we started packaging rpms a couple years back. But it don't really matter so long as you configure apahe correctly.
Remove the link from /var/www as you should not need it and whom ever told you to put it there don't know what he is doing. If apache is using the link, it should not be.
Restart apache and everything should still work. If it don't, report back the error reported by apache.