So, we got a puppy and wanted a way to keep an eye on him when we left the house to make sure he behaved. So I thought I’d try out UniFi Protect since we already have a UniFi Dream Machine Pro. The G3 Instant Camera is $30, has infrared night vision, two-way audio, and connects via WiFi, so I can plug it in when we leave or unplug it and stow it away when home (I don’t really want to be under video surveillance).
I have a number of 2TB HGST HDDs, so I thought I’d add one to the UDM Pro.
The procedure to add a drive to the UDMP is to power off, add the drive, power it back on, and the UDM Pro should automatically format it and make it available to UniFi Protect. Sounds easy.
This didn’t happen for me.
Recording Capacity shows 0d 0h 0m. Zero capacity.
The Camera Settings show “Recording disabled”. There is no option to set the recording to “Always” or “Motion.”
The drive shows up as /dev/sda in the UDM Pro. Using ssh I deleted the partitions on /dev/sda, rebooted the UDM Pro around four times to no avail. It saw the drive, showed up in UniFi Protect, and even created a Linux partition. But the UDM Pro never created a filesystem or mounted the drive. Apparently deleting the partitions isn’t enough.
Fixing the Problem with Fdisk
Note that on my UDM SE the external drive showed up as /dev/sdb instead of /dev/sda. It’s a good idea to use the “p” command in fdisk and verify the drive size is what you’re expecting before moving further.
I suspect that this may be because I had pulled the drive from a ZFS system which may have had some special properties on the partition table. I SSHed into the UDM Pro and ran the following fdisk commands to create a new partition table (wiping the ZFS signature). Commands in bold.
# fdisk /dev/sda Welcome to fdisk (util-linux 2.31.1). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): p Disk /dev/sda: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: gpt Disk identifier: 6AECF181-6CD3-904B-BED1-B5F7886D865E Device Start End Sectors Size Type /dev/sda1 2048 3907029134 3907027087 1.8T Linux filesystem Command (m for help): m Help: Generic d delete a partition F list free unpartitioned space l list known partition types n add a new partition p print the partition table t change a partition type v verify the partition table i print information about a partition Misc m print this menu x extra functionality (experts only) Script I load disk layout from sfdisk script file O dump disk layout to sfdisk script file Save & Exit w write table to disk and exit q quit without saving changes Create a new label g create a new empty GPT partition table G create a new empty SGI (IRIX) partition table o create a new empty DOS partition table s create a new empty Sun partition table Command (m for help): d Selected partition 1 Partition 1 has been deleted. Command (m for help): o Created a new DOS disklabel with disk identifier 0x6898bec1. The old zfs_member signature will be removed by a write command. Command (m for help): p Disk /dev/sda: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x6898bec1 Command (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks. #
I restarted, and it immediately recognized the drive and was available in Protect.
Now, I can keep an eye on our puppy.