Friday, October 20, 2017

Upgrading the Hard Drive in a Ubiquiti UVC-NVR

If you find yourself needing more space in your Ubiquiti UVC-NVR the process may seem daunting at first but in all actuality isn't too difficult. This post outlines the process of replacing the internal disk with a larger capacity drive.



The Drive

First and foremost, you need to acquire the disk. The drive that shipped with my NVR was a Western Digital Blue 500GB disk (specifically a WD5000LPCX) which is a 7mm disk. I chose to replace it with a 2TB Seagate BarraCuda (ST2000LM015) which at the time ran me about $85 on Amazon.

Opening the UVC-NVR

Getting into you NVR is pretty simple. Looking at the two faces, one side has chrome studs and the reverse side has textured pads which hide the screws underneath. You might take your time and carefully remove those pads to replace instead of doing what I did which was to just drive a knife through them for quick removal. The cover removes from the same side as the screws. I used a screw driver to lift this panel but a wiser choice may be to use a guitar pick or narrow putty knife. Your drive will be clearly visible under this panel and is retained with four screws to a mounting bracket.

Cloning the Disk

I booted a Windows station using a SystemRescueCD LiveCD to get access to some free utilities for the cloning process. I used Clonezilla to clone my drive to the new drive - which makes a 1:1 copy of the drive. Using Clonezilla is outside the scope of this overview and there are many alternatives to this process but more than likely you'll end up with a 1:1 copy as I did. 

At this point your new drive is using 500GB of space just like the original drive. You'll need to extend the fourth partition to use the remaining disk. Using gparted I extended the LVM to use the remaining disk space.

Re-Install Drive

Mount your new drive to the mounting bracket and reinsert the disk in the case. Place the panel back on the case taking note of the orientation. There are thermal pads that rest over internal components. The longer pad rests over the USB ports.

Extend the Logical Volume

Once your system boots back up, you'll need to ssh into your NVR to extend the logical volume to use the remaining space and extend the filesystem. You might ask, "Didn't we do this in a previous step?" Earlier we allocated the space for the expansion - now we are actually making use of it. The default username:password on my NVR was ubnt:ubnt which I believe is pretty typical of Ubiquiti's equipment. Now depending on your disk size, the following command will vary. First, find the available space by issuing the following:

root@UniFi-Video:~# vgdisplay | grep "Free PE"
  Free PE / Size 357697 / 1.36 TiB

Next extend the logical volume using the physical extents returned by the above command:

root@UniFi-Video:~# lvextend -l +357697 /dev/lvm/data0
  Extending logical volume data0 to 1.81 TiB
  Logical volume data0 successfully resized

Next we extend filesystem:

root@UniFi-Video:~# resize2fs /dev/lvm/data0
resize2fs 1.42.5 (29-Jul-2012)
Filesystem at /dev/lvm/data0 is mounted on /srv; on-line resizing required
old_desc_blocks = 29, new_desc_blocks = 116
The filesystem on /dev/lvm/data0 is now 486424576 blocks long.

That completes the migration. No restart was required for my NVR to make use of the available space. It was reflected in the web interface immediately.

Conclusion

I hope you found this overview helpful in upgrading the physical drive in your Ubiquiti UVC-NVR. It isn't a complicated process and, depending on the amount of recordings saved on your 500GB drive, it doesn't take a terribly long time. I had a nearly full disk and it took about 6 hours to complete start to finish.

1 comment:

William Jessie said...

Nice article, Which you have shared here about the Ubiquiti. Your article is very informative and nicely describes the process of upgrading the hard drive in a Ubiquiti uvc-nvr. Thanks for sharing this article here. Ubiquiti Thailand