Migrate your Unifi Cloud Controller

Moving Unifi Cloud Controllers can be difficult. You may need to do this because you are:

  • Hosting on an old operating system
  • Moving platforms
  • You want to change the FQDN or inform address
  • Like making life hard for yourself

There is no defined way on how to do this – however, we’ve found a way that works quite well.


We had a very old Ubuntu server running Unifi Cloud Controller. The version had a few issues, specifically around mongodb database packages. Instead of trying to fix this, we decide to move to a new server based on Debian 9.5.

We tried simply standing up another server with Debian 9.5 installed with a backup of our Unifi Cloud Controller applied. We then change our DNS to point from the old server to the new server.

This didn’t work

We got many issues around too many devices being connected at once. This is the new DDoS protection built in to the Cloud Controller. Also, some devices simply refused to connect to the new server, even though everything was essentially the same.

The Correct Way

We found the correct way to do this is to migrate your sites. In order to do this you need to have your second server built. We configured a new server, again on Debian 9.5 on AWS.

Old Server: wireless.contoso.com
New Server: unifi.contoso.com

Now you are ready to migrate your sites.

  1. Log in to your old controller and select the site you want to migrate
  2. Select settings -> Site and click Export Site
  3. You will first need to download the settings from this site and apply it to your new server
  4. Once this is done, select next confirming you have applied the settings, then set the FQDN of the new server and the devices which you want to migrate
  5. You will now see the device show up on your new Unifi Controller – note they will re-provision and anything connected will be briefly disconnected
  6. The last option is to forget the device on the old controller. I wouldn’t do this unless you are sure. Make sure your device is working as expected on the new server before the old device is removed.

There you go – you’ve done it.

Unifi Upgrade – MongoDB does not start

Recently had an issue where upgrading Unifi resulted in MongoDB not starting. Looking to the /var/log/unifi/mongod.log we see:

ERROR: Insufficient free space for journal files
[initandlisten] Please make at least 3379MB available in /usr/lib/unifi/data/db/journal or use --smallfiles
[initandlisten] exception in initAndListen: 15926 Insufficient free space for journals, terminating
[initandlisten] dbexit:
[initandlisten] shutdown: going to close listening sockets...
[initandlisten] shutdown: going to flush diaglog...
[initandlisten] shutdown: going to close sockets...
[initandlisten] shutdown: waiting for fs preallocator...
[initandlisten] shutdown: lock for final commit...
[initandlisten] shutdown: final commit...
[initandlisten] shutdown: closing all files...
[initandlisten] closeAllFiles() finished
[initandlisten] journalCleanup...
[initandlisten] removeJournalFiles
[initandlisten] shutdown: removing fs lock...
[initandlisten] dbexit: really exiting now

This is caused by the disk space being too low (under 3.3GB). Taking a look at the filesystem, we can see this is the case:

The type service unifi restart and you should be good to go.

One issue I found from this is that the MongoDB is increasing at a rapid rate. I found an excellent script here which prunes the content in MongoDB for Unifi Controllers.