How do I allocate Hard Disk space

Support and queries relating to all previous versions of ZoneMinder
Locked
snake61
Posts: 64
Joined: Thu Jul 17, 2008 1:44 pm
Location: South Carolina

How do I allocate Hard Disk space

Post by snake61 »

I've searched many threads but cant find the answer. I have a new hd installed 500g. Frsh install of zm 1.23. Two cameras. Right now it reads 0 events for both cameras, but the load is 1.27 and disk space 27%. Is zm using the entire 500g-that what i want-this is dedicated only to zm nothing else. How do I know zm is setup to use all 500 g? if not, how do i allocate the entire hd or at least the majority of it?

Thanks.
Thanks for all the Help.
New to Linux
kevin_robson
Posts: 247
Joined: Sun Jan 16, 2005 11:26 am

Post by kevin_robson »

df -k
will show a breakdown of your disk usage.
ZM uses the apache web server document root, which will vary depending on your linux distro.
How did you install it? If you compiled from source it will be in your configure statement. It will also be in the zm.conf file - probably in /usr/local/etc
snake61
Posts: 64
Joined: Thu Jul 17, 2008 1:44 pm
Location: South Carolina

Hard Drive Allocation

Post by snake61 »

I installed it with a PCLOS liveCD from 2008. I can got to the PCC and see what the hard drive allocation is and it reads as follows:

Mount Point: / hdd1 journalised FS: ext3, 7.8GB
Mount Point: Swap hdd5 Linux swap 3.8GB
Mount Point: /home hdd6 journalised FS ext3 454GB

I would like to use at least 400GB for the ZM storage space.

How do I get ZM to use that space?
Thanks for all the Help.
New to Linux
bb99
Posts: 943
Joined: Wed Apr 02, 2008 12:04 am

Post by bb99 »

I assign a whole partition using the /var mount point as the storage location. The location of /var is the key.
curtishall
Posts: 440
Joined: Sat Sep 25, 2004 12:45 am
Location: Fulton, MO

Post by curtishall »

bb99 wrote:I assign a whole partition using the /var mount point as the storage location. The location of /var is the key.
I don't know if I agree with _all_ of /var instead of just the directory that Zoneminder is storing files. If you create a new partition for /var you _will_ want to boot into single user mode and copy the log files (or make sure you stop mysql) and then make sure /var is mounted in fstab during startup or really bad things will happen.
--
Curtis Hall
Bluecherry
www.bluecherrydvr.com
store.bluecherry.net
bb99
Posts: 943
Joined: Wed Apr 02, 2008 12:04 am

Post by bb99 »

I only assign mount points during installation after that. I agree, too much potential for "bad things". I should've stated that.
kevin_robson
Posts: 247
Joined: Sun Jan 16, 2005 11:26 am

Post by kevin_robson »

Well it is fixable, but depends how comfortable you are with linux, and how risk averse you are.

Your first task is to resize /home - you will have to google to see how but the best way is likely to be to use a livecd like ubuntu and its partitioner, but ENSURE you DONT go past the partition page into the install page, and ensure you dont format anything. I believe the ubuntu partitioner can resize linux filesystems - I know it can windows ones.

Once you've done that you'd have to stop zm etc.
create a new partition with rest of space
mount it somewhere temporerily
copy -rp /var/www to new partition
mv original /var/www to /var/www.old
change mountpoint of your new partition to /var/www

I guess you'll have to decide for yourself how comfortable you are with all of that, and whether you want to risk it.
Flasheart
Posts: 342
Joined: Thu Jul 06, 2006 2:27 pm

Post by Flasheart »

I just mount a dedicated hdd as /cameras or /security or something, delete the existing events/ images/ etc dirs and symlink them to ones within the new mount.

Doesn't really matter which way you do it, just personal taste :)
snake61
Posts: 64
Joined: Thu Jul 17, 2008 1:44 pm
Location: South Carolina

Allocating HDD space fro ZM

Post by snake61 »

So, it's really no bother for me to start from scratch. I can reinstall PCLOS from the live cd and ZM anew, but during the partitioning process, instead of going with what the package suggests, what partitions should I enhance for ZM to use the max amount of HD space?
Thanks for all the Help.
New to Linux
bb99
Posts: 943
Joined: Wed Apr 02, 2008 12:04 am

Post by bb99 »

I use /, swap, and /var as a minimum. Your posted sizes are ok but I'd make the swap about 2GB. Use the 7.8 GB for root and set the mount point of the 454 GB partition to /var. RDMelin's live CD will take care of the rest and ZM will be storing to the 454 GB.
snake61
Posts: 64
Joined: Thu Jul 17, 2008 1:44 pm
Location: South Carolina

SOLVED-Allocating HDD space for ZM

Post by snake61 »

Well. I followed some other advice regarding assigning a port to ZM because I couldn't get the WIFI to work unless I disconnected the LAN. That suggestion ened up trashing everything so I did a new install and manually allocated the 400GB to /var and all appears to be well. I hope this is correct.

It appears it s best to do this at initial install, after the fact can get troublesome unless you're a guru.

Thanks all.
Thanks for all the Help.
New to Linux
nausser
Posts: 18
Joined: Sat Oct 09, 2010 9:08 pm
Location: South Florida

I agree with Flashheart....

Post by nausser »

**Flashheart has the best solution for migrating storage to another hard disk issue. It is the best and quickest way to manage your memory without reinstalling everything.

My version is 1.24.2 but this thread is the only one that is directly related that I am aware of.

It is also my opinion not to break off the entire /var root just for this purpose, although that will work to an extent.

I just finished putting in my new hard drive to use for the zm grunt work instead of my system hard drive.

Here is a "little" breakdown in case you could use the help....
I want to encompass what you will be doing before you begin. It is really quite easy. You need to get the new drive formatted and ready to mount and install it. Copy over the specified directories, delete the old ones and sym-link the new ones on the new drive.


First, format your new drive in another computer(or whatever one is handy) using a SATA to USB converter. You can use whatever file system you feel to be best. For a program on Ubuntu, I used "Disk Utility". I stuck to EXT4. Now with a freshly formatted and labeled drive, find the UUID of the drive to configure the fstab in the machine it is going in ahead of time before the restart. To do this, run:

Code: Select all

ls -l /dev/disk/by-uuid/
This shows the drives on your system including the UUID of the soon to be installed drive currently plugged in via a SATA to USB device. Deduce what UUID is the drive you are working with and copy the UUID down for editing the fstab on the ZM machine(if its different).

Next, edit the fstab on the ZM machine so that the hard disk will be available right after the first boot and ready to go.
Make a new directory in your /mnt folder by:

Code: Select all

sudo mkdir /mnt/whatever_you_want_to_call_the_directory
I used "/mnt/security" This is only an example.
Next edit your fstab: (example is if you know vi; you can use whatever editor you want.... nano, joe, gedit if you're on the machine locally...)

Code: Select all

sudo vi /etc/fstab
Next, add these lines to the bottom of the file: (change directory names and UUID to your scenario...)

Code: Select all

#security_cams
UUID=your_harddisk's_uuid_from_earlier	/mnt/your_directory_from_earlier	your_choosen_file_system	relatime,errors=remount-ro	0	2
Here is an example of mine:

Code: Select all

#security_cams
UUID=0adc4b6b-0bb4-44be-bf0f-860b06e28b23	/mnt/security	ext4	relatime,errors=remount-ro	0	2
Now, when you shut down your ZM system, plug in the new drive via SATA, and fire it back up, it will be mounted and ready to go at /mnt/whatever_you_called_the_directory

Next you want to shut down ZM. Do this from the web page or from the command line. From the web page you simply click "running" in the top center and click apply in the little window that pops up. From the command line, type:

Code: Select all

sudo service zoneminder stop
At least this is how my Linux distro works (Ubuntu 10.04) **see your own Linux distro documentation for details on starting and stopping services if different from mine.**

Next you want to stop any other service that are using mysql on a regular basis. My machine is actually Mythbuntu obviously running mythtv services as well which use mysql very heavily. Stop these other services in the same way. You can even stop apache2 service to be totally sure.

After you have all mysql dependencies stopped, stop mysql itself by:

Code: Select all

sudo service mysql stop
Now everything is quiet and you are ready to migrate over to the new hard disk for the ZM grunt work.

There are two methods to doing this. Trash all your ZM security camera footage and start fresh (much much much faster) or keep all your existing data by copying everything over (much much much slower.... and the route I will cover because that is what I did).

First, verify your new disk is read and mounted properly where it is supposed to be. You can list your attached hard disks and their mount points by:

Code: Select all

df
Look for your new disk. It should be pointing to the directory you made in /mnt

If all is well so far, copy all your previous camera footage from the current location to the new drive. You want to copy a total of 3 folders and all their contents. Assuming that you haven't moved anything previously, this code should work nicely for you:

Code: Select all

cd /var/cache/zoneminder
then:

Code: Select all

sudo cp -Rvp events/ images/ temp/ /mnt/whatever_you_called_the_directory
Now you can take a break. Have a pizza or maybe even make a pizza.... from scratch. Depending on how many cameras you have, resolution and frames per second, this is going to take some time.

.....

After the copying is all completed, verify the data is all there by:

Code: Select all

ls -l /mnt/whatever_you_called_the_directory
You should see your copied data there, all accounted for. Make sure that the ownership is all correct, which it should be. If "root" user owns the copied directories, do this:

Code: Select all

sudo chown -R www-data:www-data /mnt/whatever_you_called_the_directory
Now everything should be under the correct ownership for ZM to function.

We aren't done yet though. The final things we need to to is delete the old directories we copied with their contents (free up some serious system space) and create symbolic links from /var/cache/zoneminder/* to the new hard drive.
Delete the three directories: (make sure this is correct for your system, an error could be catastrophic...)

Code: Select all

sudo rm -R /var/cache/zoneminder/*
Now create the symbolic links to the new drive. You need to do these one at a time for each folder you copied earlier. Lets do events first.

Code: Select all

sudo ln -s /mnt/whatever_you_called_the_directory/events /var/cache/zoneminder/events
Now the images directory:

Code: Select all

sudo ln -s /mnt/whatever_you_called_the_directory/images /var/cache/zoneminder/images
And finally temp:

Code: Select all

sudo ln -s /mnt/whatever_you_called_the_directory/temp /var/cache/zoneminder/temp
Great job! You're all finished! Now its just a matter of starting up your services in reverse order that you had to stop them.
Lets start mysql first since ZM in dependent on it:

Code: Select all

sudo service mysql start
Then start up ZoneMinder:

Code: Select all

sudo service zoneminder start
(or from the zm web console)
Don't forget to start up any other service you had to shut down earlier. Once again, my system is also a MythTV system so I had to start up mythtv-backend as well:

Code: Select all

sudo service mythtv-backend start
That's it! I know I went into crazy detail on this so I'm sure most of you will skip through it (maybe even pick out a mistake or inefficiency...)

Let me know if you have any more questions or need me to edit my post for some reason.

As a positive note, this also dropped my zma service from 24% down to 12%! Having a separate HDD for ZM grunt work makes systems happy!

I hope this helps!!!

ps... After going back into ZoneMinder, I had an extra event at the beginning with a crazy huge number dating to year 1906 or something. I simply selected the event from the ZM webpage and deleted it. Thankfully that cleared that up!

Happy spying... * cough*... I mean... securing![/code]
Time never ceases to accelerate.
Locked