Quick-tip: Put the UniFi wireless controller on a separate LV

I’ve been running a Ubiquiti UniFi wireless controller in production for a while known that it requires quite some amount of storage. But it heavily depends on how many APs and users you are having, larger setups will have to take that into account earlier, others might just be happy with it. As Ubiquiti states for auditing purpose the UniFi server keeps a lot of date around which can easily grow a couple of gigabytes per – let’s say 4 months – in my current experience. In the Debian and Ubuntu packages the data from the controller is principialy located in:

  • /var/lib/unifi: Database, AP config files
  • /usr/lib/unifi: Firmware binaries, base config files

For other platforms like FreeBSD it might be else where like somewhere in /usr/local/…

The first one seems to be the one to take care little more closely. While it will initially grow to roughly +3GB at first run the MongoDB preallocation files are generally OK and disabling journaling isn’t worth the risk and hassle during power outage either. However this can easily grow and if you forget about it, it might fill up the partition and either cause other services to stop working (actually 2.4.x seems to continue quite happily as long as you don’t try adopting new APs, that’s when I experienced problems)*

Anyhow from lessons learned I’d suggest putting at least “/var/lib/unifi” on a separate partition , or (likely easier to grow online) a LVM logical volume and have it mounted there. – For sure if you have something like ZFS things are even easier by creating a new ZFS and adding a mountpoint to it with some limitation so it doesn’t outgrow the other disk space available. Of course you have to stop the unifi daemon first, create that new volume/fs move the data over there and be happy.

Afterwards consider to look at Ubiquiti’s pruning script in their FAQ and decide how much data you really need to retain and consider pruning on more-or-less regular basis. I hope putting it on a extra volume keeps me

* The config files for a new AP can’t be written to disk, thus the newly adopted AP won’t get any valid config and you then might have to forgt, reset and re-adopt the AP to get it working.

Leave a Reply

January 7, 2014

Posted In: Uncategorized

Tags: , ,

Leave a Comment