Hard disk partitioning

Support and queries relating to all previous versions of ZoneMinder
Locked
gola10
Posts: 150
Joined: Wed Nov 01, 2006 3:16 pm
Location: Panama

Hard disk partitioning

Post by gola10 »

If i use a 200GB harddisk and would like to have a large partition only for EVENTS, how large should be the "/" main partition that holds everything else including the Mysql database?
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

dpends on your distro and setup, eg livecd stores events on the /var partition so / is about 5 gigs and the rest is /var for me
James Wilson

Disclaimer: The above is pure theory and may work on a good day with the wind behind it. etc etc.
http://www.securitywarehouse.co.uk
kevin_robson
Posts: 247
Joined: Sun Jan 16, 2005 11:26 am

Post by kevin_robson »

5G should do it but if I had 200G to play with I'd use 10G to be sure.

I also have my events parition as a LVM so I can resize it and add another partition at a later date - you may wish to consider that?
User avatar
tgutwin
Posts: 24
Joined: Thu Jan 12, 2006 4:02 am
Location: North Vancouver, Canada

Hard disk partitioning

Post by tgutwin »

As Kevin said 5G should be okay if you keep /var on a separate partition.
If you are going to only have 2 partitions (/, and /var) you might want to make the root / a bit bigger, because you will probably be doing source building in your /home and other installs that go into /usr somewhere

I would suggest setting up partitions:
/ 5GB
/home 15GB
/usr 20 GB<-- not necessarilly needed but if you want to keep the root partition small you can do that by making this a bit bigger
/var All The rest <-- make this a Logical Volume Managed partition so you can add discs transparently if needed.
This is so if/when you run out of drive space you can add a new physical drive and have it get added to (grow) an existing logical volume with out having to update any of the software accessing it.

A good overview of LVM can be found: http://www.mythtv.org/docs/mythtv-HOWTO-24.html

Here is my setup

Code: Select all

   - Drive layout on a 160GB SATA2 drive
     Device/partition   Type          FS        Mount        size(MB)
     ----------------------------------------------------------------
     /dev/sda1          Primary       ext3      /boot           100
     /dev/sda2          Primary       ext3      /             15000
     /dev/sda3          Primary       swap      swap           1000
     /dev/sda4          extended                            ~158000 (all the rest)
     /dev/sda5          logical       ext3      /var/media  ~158000 (all the rest)
     ------------------------------------------------------------------------------
Note I setup var/media as my huge space for events and other stuff.

LVM Tips:
When I added a new drive... this is how I did it:
NOTE: I later added a new 300GB drive to the logical volume
see http://howtos.linux.com/howtos/LVM-HOWT ... disk.shtml
and http://www.linux.org/docs/ldp/howto/LVM ... endlv.html for how to extend a volume
Use lvscan, lvdisplay, pvscan, pvdisplay, vgscan, vgdisplay to see what is already setup
these lvm programs are located in /usr/sbin

1st look to see what you have...

Code: Select all

     [root@dvr sbin]# /usr/sbin/lvdisplay
      --- Logical volume ---
      LV Name                /dev/VolGroup00/LogVol_Media
      VG Name                VolGroup00
      LV UUID                pqlqf3-IQRw-7Z5E-ojJ8-hdz1-g5D4-oQ2yQh
      LV Write Access        read/write
      LV Status              available
      # open                 1
      LV Size                412.00 GB
      Current LE             13184
      Segments               2
      Allocation             inherit
      Read ahead sectors     0
      Block device           253:0

    [root@dvr sbin]# pvscan
      PV /dev/sda5   VG VolGroup00   lvm2 [133.22 GB / 0    free]
      PV /dev/sdb1   VG VolGroup00   lvm2 [279.44 GB / 672.00 MB free]
      Total: 2 [412.66 GB] / in use: 2 [412.66 GB] / in no VG: 0 [0   ]

    [root@dvr sbin]# pvdisplay
      --- Physical volume ---
      PV Name               /dev/sda5
      VG Name               VolGroup00
      PV Size               133.22 GB / not usable 0
      Allocatable           yes (but full)
      PE Size (KByte)       32768
      Total PE              4263
      Free PE               0
      Allocated PE          4263
      PV UUID               wlYr65-rKQt-nAeV-C40f-0M29-u663-6j3WWw

      --- Physical volume ---
      PV Name               /dev/sdb1
      VG Name               VolGroup00
      PV Size               279.44 GB / not usable 0
      Allocatable           yes
      PE Size (KByte)       32768
      Total PE              8942
      Free PE               21
      Allocated PE          8921
      PV UUID               ZgBeQz-wruT-XwYK-Mv32-IBh6-mPP3-JttnCI
- Create a Primary partition on the NEW drive you bought
(This is absolutely required since you can add the whole drive at once)

Code: Select all

fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun or SGI
disklabel Building a new DOS disklabel. Changes will remain in memory
only, until you decide to write them. After that, of course, the
previous content won't be recoverable.

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1000, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1000, default 32000): 32000

Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Unknown)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: If you have created or modified any DOS 6.x partitions,
please see the fdisk manual page for additional information.

- Create the new Physical Volume (PV)

Code: Select all

pvcreate /dev/sdb1
- Add the new PV to the existing logical Volume that was created during Fedora install

Code: Select all

vgextend VolGroup00 /dev/sdb1
- Extend the Logical Vol Group to use the new space in the Log Volume

Code: Select all

 lvextend -L412.66G /dev/VolGroup00/LogVol_Media
- now extend the filesystem to absorb the new logical space
with all that is needed is to remount the drive with a resize option

Code: Select all

mount -o remount,resize /var/media
thats it... I now have over 400GB of media space.
plus I can add more as needed following the same steps again[/code]

Hope this helps you and others.
Tom
------------------------------------------------------------
Don't Let Software Push You Around... Push Back
------------------------------------------------------------
gola10
Posts: 150
Joined: Wed Nov 01, 2006 3:16 pm
Location: Panama

Post by gola10 »

I use Mandriva 2007 from Livecd and the 200gb disk is partitioned as follow.
5GB for "/"
4GB for swap
the rest for /var. (where events is)

i wanted to move /var to the first partition and reseve the large one only for /events.

Let see if i undestood it. i increase the first partition to 15GB and i could put /var into "/" and use the large partition only for event.

The option of using LVM seems interesting. Thanks for the information. I might do it this way due to the advantage of growing easily the EVENTS partition.

Thanks
Locked