Page 1 of 2

[SOLVED] Zoneminder Disk space issue

PostPosted: Jun 11th, '12, 09:41
by freetibet
Hi.
I have installed zoneminder.
I used the ordinary terminal and did it using "su" and so as root.
I noticed in a previous install that the disk space was used up very quickly.
Now I can see on initial install zone minder says the disk is 29% full…
If I look at the system there is 945 GB free out of 1 TB…
Obviously zone minder is not seeing the disk correctly…
So this must be the issue with my last install.

Re: Zonminder Disk space issue

PostPosted: Jun 11th, '12, 22:47
by barjac
Can you please post the output from a terminal of:-
Code: Select all
df


Also, please read /usr/share/doc/zoneminder/README.Mageia.

Re: Zonminder Disk space issue

PostPosted: Jun 11th, '12, 22:51
by freetibet
Code: Select all
[cctvadmin@dhcppc7 ~]$ df
Filesystem      Size  Used Avail Use% Mounted on
rootfs           12G  3.3G  8.1G  29% /
devtmpfs        981M     0  981M   0% /dev
tmpfs           987M  357M  631M  37% /dev/shm
tmpfs           987M  4.1M  983M   1% /run
/dev/sda1        12G  3.3G  8.1G  29% /
tmpfs           987M     0  987M   0% /sys/fs/cgroup
/dev/sda3       915G   14G  901G   2% /home
[cctvadmin@dhcppc7 ~]$


and no I didn't read that but I will…

looking at this it looks like it is using /dev/sd1
maybe that tech note says something I will look...

Re: Zonminder Disk space issue

PostPosted: Jun 11th, '12, 22:53
by freetibet
odd nothing there really...

Re: Zonminder Disk space issue

PostPosted: Jun 11th, '12, 23:08
by doktor5000
freetibet wrote:[cctvadmin@dhcppc7 ~]$ df
Filesystem Size Used Avail Use% Mounted on
rootfs 12G 3.3G 8.1G 29% /
[cctvadmin@dhcppc7 ~]$


Well, AFAIK stuff will get saved below /var somwhere (i don't know zoneminder, but that should be the place according to FHS, or maybe /srv or so) which resides on the /-partition in your case. You only have ~900GB available in /home, but that's not where stuff is saved if you didn't adjust the configuration. So ZoneMinder is just telling you the truth ...

Re: Zonminder Disk space issue

PostPosted: Jun 11th, '12, 23:18
by freetibet
I don't understand,
Why did it set it's self up like that ?
How can I change it ?
is the OS sitting on the wrong partition as well ?

Re: Zonminder Disk space issue

PostPosted: Jun 11th, '12, 23:52
by freetibet
doktor5000 wrote:
freetibet wrote:[cctvadmin@dhcppc7 ~]$ df
Filesystem Size Used Avail Use% Mounted on
rootfs 12G 3.3G 8.1G 29% /
[cctvadmin@dhcppc7 ~]$


Well, AFAIK stuff will get saved below /var somwhere (i don't know zoneminder, but that should be the place according to FHS, or maybe /srv or so) which resides on the /-partition in your case. You only have ~900GB available in /home, but that's not where stuff is saved if you didn't adjust the configuration. So ZoneMinder is just telling you the truth ...


why is the file system so small ? why is it allocated a tiny space ? Is this normal in Mageia ?
Can I re allocate the space ?
Also how do I just allocate one disk for everything ?
Used unix for 5 years never seen this happen before...
Thanks...

Re: Zonminder Disk space issue

PostPosted: Jun 12th, '12, 00:08
by barjac
freetibet wrote:I don't understand,

OK that's fine - I will try to explain.
Why did it set it's self up like that ?

Because this is the way it should be. ZoneMinder is intended primarily for use on a dedicated server (as explained in the README) and stores all the image data below /var as doktor5000 pointed out.
How can I change it ?

1. Add a big hard drive and assign it all to /var.
2. Reduce the size of /home and create a new partition for /var
is the OS sitting on the wrong partition as well ?

No

The simplest solution is 1. After adding a new drive, use mcc -> local disks ->manage disk partitions to create a large partition on it and set the partiton's mount point to /var. You will be told that you already have a /var folder and asked if you wish to move the data to the new partition. Answer yes. Job done.

EDIT - this (second solution) won't work - see Ken-Bergen's post below.
The second solution involves shrinking your /home folder which is not without risk so a backup is in order.
This can also be done from mcc -> local disks ->manage disk partitions. After shrinking /home, create a new partition in the free space and set it's mount point to /var (as in 1.)

Having done all that you can still eventually run out of space unless you set a filter in ZoneMinder to delete old images once you reach say 90% full.

I hope that helps ;)

Re: Zonminder Disk space issue

PostPosted: Jun 12th, '12, 00:21
by freetibet
thankyou.
Previously I used have used Debian and cent os so never encountered this issue before…
as the server is now 100 miles away again… I went up there today….
I will try to shrink the /home which is way bigger than any disk for a user needs to be…
Problem is now I need VNC to work and it does not… ( my other thread ) however I have SSH.
next time i install Mageia I would like just one partition for OS and all system / user files… can I do that ?

Re: Zonminder Disk space issue

PostPosted: Jun 12th, '12, 00:34
by doktor5000
freetibet wrote:next time i install Mageia I would like just one partition for OS and all system / user files… can I do that ?

Yep, surely. But i'd only do that if you don't need much space for normal users (i.e. in /home).
Normally if you run a server you should give a thought or two about partitioning, as you should know what is
stored where and where you need how much space.

For a common desktop installation it's best to keep / and /home separated like with your current installation ...

Re: Zonminder Disk space issue

PostPosted: Jun 12th, '12, 00:38
by Ken-Bergen
barjac wrote:The second solution involves shrinking your /home folder which is not without risk so a backup is in order.
This can also be done from mcc -> local disks ->manage disk partitions. After shrinking /home, create a new partition in the free space and set it's mount point to /var (as in 1.)
It's not that simple Barry.
You can't shrink a partition while it's mounted and you can't unmount a partition that is in use as /home is with any user other than root logged in.

The shrinking of /home could be done with a Live CD but the creation of the new /var must be done in the running system for the automatic moving of data.

Re: Zonminder Disk space issue

PostPosted: Jun 12th, '12, 01:10
by barjac
Ken-Bergen wrote:
barjac wrote:The second solution involves shrinking your /home folder which is not without risk so a backup is in order.
This can also be done from mcc -> local disks ->manage disk partitions. After shrinking /home, create a new partition in the free space and set it's mount point to /var (as in 1.)
It's not that simple Barry.
You can't shrink a partition while it's mounted and you can't unmount a partition that is in use as /home is with any user other than root logged in.

The shrinking of /home could be done with a Live CD but the creation of the new /var must be done in the running system for the automatic moving of data.


Yes sorry you are correct - getting late here ;)

There is third option. He could move /var/www/html/zm to /home/$USER/zm and symlink it - I never tried it but I don't see a problem.

EDIT Just tested it quickly and this works fine here on my test set-up. You may also need to :-
cd
su
chown -R apache:apache zm

Here's what happens without a filter set BTW.
Image
Every picture tells a story :)

Re: Zonminder Disk space issue

PostPosted: Jun 12th, '12, 09:57
by freetibet
doktor5000 wrote:
freetibet wrote:next time i install Mageia I would like just one partition for OS and all system / user files… can I do that ?

Yep, surely. But i'd only do that if you don't need much space for normal users (i.e. in /home).
Normally if you run a server you should give a thought or two about partitioning, as you should know what is
stored where and where you need how much space.

For a common desktop installation it's best to keep / and /home separated like with your current installation ...

I don't understand.
Why can't /home be on the same partition it seems odd, I don't seem to have encountered this issue before…

Thanks...

Re: Zonminder Disk space issue

PostPosted: Jun 12th, '12, 10:01
by freetibet
barjac wrote:
Ken-Bergen wrote:
barjac wrote:The second solution involves shrinking your /home folder which is not without risk so a backup is in order.
This can also be done from mcc -> local disks ->manage disk partitions. After shrinking /home, create a new partition in the free space and set it's mount point to /var (as in 1.)
It's not that simple Barry.
You can't shrink a partition while it's mounted and you can't unmount a partition that is in use as /home is with any user other than root logged in.

The shrinking of /home could be done with a Live CD but the creation of the new /var must be done in the running system for the automatic moving of data.


Yes sorry you are correct - getting late here ;)

There is third option. He could move /var/www/html/zm to /home/$USER/zm and symlink it - I never tried it but I don't see a problem.

EDIT Just tested it quickly and this works fine here on my test set-up. You will also need to :-
cd
su
chown -R apache:apache zm

Here's what happens without a filter set BTW.
Image
Every picture tells a story :)

Yes, I always set a filter with zone minder to thin out the disk… I've been using it for 3 years, and always installed manually by hand, recompiling various options myself. So I know about the disk filling up etc… however my issue arises because by default it seems Mageia has plonked zone minder on to a tiny disk, which seems an illogical thing to do with an automatic installation script such as the one I used with Mageia i.e. "zmsetup"
I don't know what to do now….
Probably have to go up again…with a new installation on a disk with just one partition ...

Re: Zonminder Disk space issue

PostPosted: Jun 12th, '12, 12:49
by barjac
however my issue arises because by default it seems Mageia has plonked zone minder on to a tiny disk

Whoa... As has been pointed out in earlier posts - you, as system administrator are responsible for the system layout, and considering your experience I find it odd for you to blame Mageia for the sizes of your partitions - over which it has no control whatsoever.
I don't know what to do now….
Probably have to go up again…with a new installation on a disk with just one partition ...

One single partition is a bad idea - but it's your system.

If you have ssh access then why not use the symlink method I suggested?
It may save a long trip and should be OK as a temporary measure.
ssh into your server as normal user then:-
Code: Select all
cd
su
systemctl stop zoneminder.service
mv -T /var/www/html/zm zm
ln -sf /home/$USER/zm /var/www/html/zm
systemctl start zoneminder.service

The above comes with the usual disclaimers, however it works for me.

Re: Zonminder Disk space issue

PostPosted: Jun 12th, '12, 12:55
by freetibet
I'm not blaming mageia,
Simply saying I am un familiar with this scenario.

If you were installing Zoneminder how would you set up disk partitioning ?

I will use your suggestion upon my next install..


I will try your suggestion,
Thanks.

Re: Zonminder Disk space issue

PostPosted: Jun 12th, '12, 16:05
by barjac
My current ZM server has a single 160GB drive.
Image

Partitioning is simple
Code: Select all
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       3.9G  2.6G  1.2G  71% /
/dev/sda6       179G  125G   45G  74% /var

Swap is 4GB

There are as many ways to set up partitioning schemes as there are users in Linux and most are probably correct for the particular intended use.
In my case it was solely for ZM so no separate /home was required.
The installation was LXDE using an RC of Mageia 2 dual CD now fully updated to Mageia 2.

As you can see there is currently no provision for local backup, so this is something I will be addressing with extra
drives in the future.

EDIT Normally root sits at 1.7GB used - I have some extra stuff in there at present that's not related to ZM ;)

Re: Zonminder Disk space issue

PostPosted: Jun 13th, '12, 00:13
by doktor5000
freetibet wrote:
doktor5000 wrote:
freetibet wrote:next time i install Mageia I would like just one partition for OS and all system / user files… can I do that ?

Yep, surely. But i'd only do that if you don't need much space for normal users (i.e. in /home).
[...]

I don't understand.
Why can't /home be on the same partition it seems odd, I don't seem to have encountered this issue before…



Huh, where did you read that? Please reread what you quoted above. You can use whatever partitioning you want. Seems you should read up a bit on partitioning and basic system layout. For that you can have a look at http://docteam.mageia.nl/installer/cont ... Disks.html and the subsequent pages ...

Re: Zonminder Disk space issue

PostPosted: Jun 15th, '12, 00:42
by freetibet
barjac wrote:systemctl stop zoneminder.service
mv -T /var/www/html/zm zm
ln -sf /home/$USER/zm /var/www/html/zm
systemctl start zoneminder.service[/code]
The above comes with the usual disclaimers, however it works for me.


do I use $USER or may own user name… ?

Re: Zonminder Disk space issue

PostPosted: Jun 15th, '12, 00:54
by doktor5000
Doesn't matter, if you run that command as your user, $USER (an environment variable) automatically expands to your username, kinda like a magic placeholder ;)

Re: Zonminder Disk space issue

PostPosted: Jun 15th, '12, 01:02
by freetibet
opps

I did it as root….
have I broken it ?
Not quite sure of the code to put it all back…


Access forbidden!

You don't have permission to access the requested object. It is either read-protected or not readable by the server.

If you think this is a server error, please contact the webmaster.

Error 403

88.96.6.132
Apache/2.2.22 (Mageia/ITK-12.mga2)


OK done this… after the above…

Code: Select all
cd
su
systemctl stop zoneminder.service
mv -T /var/www/html/zm zm
ln -sf /home/$USER/zm /var/www/html/zm
systemctl start zoneminder.service

still get permission denied.

Re: Zonminder Disk space issue

PostPosted: Jun 15th, '12, 01:35
by freetibet
looks like zm is in the right directory…

Code: Select all
root@localhost cctvadmin]# ls
Desktop/  Documents/  Downloads/  Music/  Pictures/  Templates/  tmp/  Videos/  zm@


maybe just a permissions issue…

Code: Select all
[root@localhost cctvadmin]# ls
Desktop/  Documents/  Downloads/  Music/  Pictures/  Templates/  tmp/  Videos/  zm@
[root@localhost cctvadmin]# cd zm
bash: cd: zm: Too many levels of symbolic links

Re: Zonminder Disk space issue

PostPosted: Jun 15th, '12, 09:14
by freetibet
so it's not working but if someone can point me in the right direction I am sure it will work very easily.
Thanks.

Re: Zonminder Disk space issue

PostPosted: Jun 15th, '12, 11:03
by barjac
Hi,
You appear to have the symlink in your home folder.
The symlink should be in /var/www/html/ pointing at the real files in ~/zm (~/ is shorthand for /home/youruser/)
If you did that procedure twice, then you moved the zm folder to your home on the first occasion, on the second you moved the symllink and overwrote the folder in your home.
I suspect that a re-install of zm is the only option now, followed by the procedure to symlink the zm folder.
Please post the output of :-
Code: Select all
ls -l /home/$USER/
ls -l /var/www/html/
EDIT Do the above as regular user logged in to your server.

Also please use code tags when posting output - to do this simply copy/paste the output to the forum edit box, then highlight the code and click on the 'Code' button above the box.

Re: Zonminder Disk space issue

PostPosted: Jun 15th, '12, 11:06
by freetibet
Code: Select all
[root@localhost cctvadmin]# ls -l /home/$USER/
total 32
drwxr-xr-x 2 cctvadmin cctvadmin 4096 Jun 10 13:55 Desktop/
drwxr-xr-x 2 cctvadmin cctvadmin 4096 Jun 10 13:55 Documents/
drwxr-xr-x 2 cctvadmin cctvadmin 4096 Jun 10 13:55 Downloads/
drwxr-xr-x 2 cctvadmin cctvadmin 4096 Jun 10 13:55 Music/
drwxr-xr-x 2 cctvadmin cctvadmin 4096 Jun 10 13:55 Pictures/
drwxr-xr-x 2 cctvadmin cctvadmin 4096 Jun 10 13:55 Templates/
drwx------ 2 cctvadmin cctvadmin 4096 Jan 11  2011 tmp/
drwxr-xr-x 2 cctvadmin cctvadmin 4096 Jun 10 13:55 Videos/
lrwxrwxrwx 1 root      root        18 Jun 15 00:01 zm -> /home/cctvadmin/zm
[root@localhost cctvadmin]# ls -l /var/www/html/
total 4
-rw-r--r-- 1 root root 131 May  2 22:31 index.html
lrwxrwxrwx 1 root root  18 Jun 15 00:28 zm -> /home/cctvadmin/zm
[root@localhost cctvadmin]#


and


Code: Select all
[cctvadmin@localhost ~]$ ls -l /home/$USER/
total 32
drwxr-xr-x 2 cctvadmin cctvadmin 4096 Jun 10 13:55 Desktop/
drwxr-xr-x 2 cctvadmin cctvadmin 4096 Jun 10 13:55 Documents/
drwxr-xr-x 2 cctvadmin cctvadmin 4096 Jun 10 13:55 Downloads/
drwxr-xr-x 2 cctvadmin cctvadmin 4096 Jun 10 13:55 Music/
drwxr-xr-x 2 cctvadmin cctvadmin 4096 Jun 10 13:55 Pictures/
drwxr-xr-x 2 cctvadmin cctvadmin 4096 Jun 10 13:55 Templates/
drwx------ 2 cctvadmin cctvadmin 4096 Jan 11  2011 tmp/
drwxr-xr-x 2 cctvadmin cctvadmin 4096 Jun 10 13:55 Videos/
[cctvadmin@localhost ~]$ ls -l /var/www/html/
total 4
-rw-r--r-- 1 root root 131 May  2 22:31 index.html
lrwxrwxrwx 1 root root  18 Jun 15 11:14 zm -> /home/cctvadmin/zm
[cctvadmin@localhost ~]$