Categories

  • rpi

Introduction

This project came from the necessity to replace the NVR box for my Swann IP cameras due to two main issues. The first issue was the noise associated with this box. I have a small house an this box has a fan that always sounded like a little jet engine, it has irritated me for years.

The second issue is the software running on the provided NVR, mainly that it only really works with an attached monitor and mouse. Trying to use the provided software over the network or remotely accessing it using their software is a lesson in futility. The software only works with old versions of Microsoft Windows browsers/OS.

I wanted a method of being able to easily access this software through an iPad, desktop browser, or a linux based system. This is where Shinobi comes in.

Install Shinobi

I will not be covering getting your Raspbian insallation up and running, there are many other tutorials online for this.

  1. Install Shinobi with the following commands $ sudo su $ sh <(curl -s https://gitlab.com/Shinobi-Systems/Shinobi-Installer/raw/master/shinobi-install.sh)

This will kick off a script that has a few options for the installation, select the following options:

Opening Install Location : "/home"
Install the Development branch?
(y)es or (N)o? Default : No
n
Getting the Master Branch
sudo: unable to resolve host DuckWithMuscles: Name or service not known
Cloning into 'Shinobi'...
remote: Enumerating objects: 271, done.
remote: Counting objects: 100% (271/271), done.
remote: Compressing objects: 100% (141/141), done.
remote: Total 8770 (delta 151), reused 245 (delta 125), pack-reused 8499
Receiving objects: 100% (8770/8770), 10.58 MiB | 10.90 MiB/s, done.
Resolving deltas: 100% (6049/6049), done.
sudo: unable to resolve host DuckWithMuscles: Name or service not known
sudo: unable to resolve host DuckWithMuscles: Name or service not known
sudo: unable to resolve host DuckWithMuscles: Name or service not known
-------------------------------------
---------- Shinobi Systems ----------
Repository : https://gitlab.com/Shinobi-Systems/Shinobi
Product : Shinobi Professional (Pro)
Branch : master
Version : 511a4b4dd7200557a0d269be05434a5fb3bf23c5
Date : Thu 27 Aug 12:26:00 BST 2020
-------------------------------------
-------------------------------------
Shinobi Installer
========
Select your OS
If your OS is not on the list please refer to the docs.
========
1. Ubuntu - Fast and Touchless
2. Ubuntu - Advanced
3. CentOS
4. CentOS - Quick Install
5. MacOS
6. FreeBSD
7. OpenSUSE
========
1

Setup RAID

In my case I have 2 Western Digital USB3 hard drives hooked up to a powered USB hub.

  1. Check that your disks are visible Disk /dev/sda: 1.8 TiB, 2000365289472 bytes, 3906963456 sectors Disk model: My Passport 2626 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: 1507D6C4-3074-4D2E-83BC-EAB351ADAF0F

Device Start End Sectors Size Type /dev/sda1 2048 3906963422 3906961375 1.8T Linux filesystem

Disk /dev/sdb: 1.8 TiB, 2000365289472 bytes, 3906963456 sectors Disk model: My Passport 2626 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: 8CD8864E-751C-461A-AFA2-58E3F013E69C

Device Start End Sectors Size Type /dev/sdb1 2048 3906963422 3906961375 1.8T Linux filesystem

fdisk /dev/sda

Welcome to fdisk (util-linux 2.33.1). Changes will remain in memory only, until you decide to write them. Be careful before using the write command.

Command (m for help): d Selected partition 1 Partition 1 has been deleted.

Command (m for help): n Partition number (1-128, default 1): First sector (34-3906963422, default 2048): Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-3906963422, default 3906963422):

Created a new partition 1 of type ‘Linux filesystem’ and of size 1.8 TiB.

Command (m for help): w The partition table has been altered. Syncing disks.

fdisk /dev/sdb

Welcome to fdisk (util-linux 2.33.1). Changes will remain in memory only, until you decide to write them. Be careful before using the write command.

Command (m for help): d Selected partition 1 Partition 1 has been deleted.

Command (m for help): n Partition number (1-128, default 1): First sector (34-3906963422, default 2048): Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-3906963422, default 3906963422):

Created a new partition 1 of type ‘Linux filesystem’ and of size 1.8 TiB.

Command (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks.

mdadm –create –verbose /dev/md/vol1 –level=1 –raid-devices=2 /dev/sda1 /dev/sdb1

mdadm: Note: this array has metadata at the start and may not be suitable as a boot device. If you plan to store ‘/boot’ on this device please ensure that your boot-loader understands md/v1.x metadata, or use –metadata=0.90 mdadm: size set to 1953348544K mdadm: automatically enabling write-intent bitmap on large array Continue creating array? y mdadm: Defaulting to version 1.2 metadata mdadm: array /dev/md/vol1 started.

mdadm –detail /dev/md/vol1

/dev/md/vol1: Version : 1.2 Creation Time : Thu Aug 27 14:59:25 2020 Raid Level : raid1 Array Size : 1953348544 (1862.86 GiB 2000.23 GB) Used Dev Size : 1953348544 (1862.86 GiB 2000.23 GB) Raid Devices : 2 Total Devices : 2 Persistence : Superblock is persistent

 Intent Bitmap : Internal

   Update Time : Thu Aug 27 15:00:08 2020
         State : clean, resyncing 
Active Devices : 2    Working Devices : 2
Failed Devices : 0
 Spare Devices : 0

Consistency Policy : bitmap

 Resync Status : 0% complete

          Name : DuckWithMuscles:vol1  (local to host DuckWithMuscles)
          UUID : 36970045:903f723d:b9efce69:dcd9e579
        Events : 8

Number   Major   Minor   RaidDevice State
   0       8        1        0      active sync   /dev/sda1
   1       8       17        1      active sync   /dev/sdb1

cat /proc/mdstat

Personalities : [raid1] md127 : active raid1 sdb1[1] sda1[0] 1953348544 blocks super 1.2 [2/2] [UU] [>………………..] resync = 0.3% (6674304/1953348544) finish=307.9min speed=105370K/sec bitmap: 15/15 pages [60KB], 65536KB chunk

unused devices:

mdadm –detail –scan » /etc/mdadm/mdadm.conf

mkfs.ext4 -v -m .1 -b 4096 -E stride=32,stripe-width=64 /dev/md/vol1

mount /dev/md/vol1 /mnt

mount

/dev/mmcblk0p2 on / type ext4 (rw,noatime) devtmpfs on /dev type devtmpfs (rw,relatime,size=1827808k,nr_inodes=97777,mode=755) sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime) proc on /proc type proc (rw,relatime) securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime) tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev) devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000) tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755) tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k) tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755) cgroup2 on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate) cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,name=systemd) none on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700) cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset) cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct) cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices) cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids) cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer) cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio) cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls) sunrpc on /run/rpc_pipefs type rpc_pipefs (rw,relatime) systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=37,pgrp=1,timeout=0,minproto=5,maxproto=5,direct) mqueue on /dev/mqueue type mqueue (rw,relatime) debugfs on /sys/kernel/debug type debugfs (rw,relatime) configfs on /sys/kernel/config type configfs (rw,relatime) /dev/mmcblk0p1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro) tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=391980k,mode=700,uid=1000,gid=1000) /dev/md127 on /mnt type ext4 (rw,relatime,stripe=64)

Now mounted as /dev/md127

blkid

/dev/mmcblk0p1: LABEL_FATBOOT=”boot” LABEL=”boot” UUID=”4AD7-B4D5” TYPE=”vfat” PARTUUID=”2412faf1-01” /dev/mmcblk0p2: LABEL=”rootfs” UUID=”2887d26c-6ae7-449d-9701-c5a4018755b0” TYPE=”ext4” PARTUUID=”2412faf1-02” /dev/md127: UUID=”cce2aa4f-7fd4-470c-ad5c-03cdab7cef09” TYPE=”ext4” /dev/sdb1: UUID=”36970045-903f-723d-b9ef-ce69dcd9e579” UUID_SUB=”d76582a4-0a5c-7f17-86b7-844bf366f9c0” LABEL=”DuckWithMuscles:vol1” TYPE=”linux_raid_member” PARTUUID=”1aae64d0-51aa-664c-8844-20016f4ff125” /dev/sda1: UUID=”36970045-903f-723d-b9ef-ce69dcd9e579” UUID_SUB=”e83c43d3-17fa-502c-28ba-3f91fcdb7774” LABEL=”DuckWithMuscles:vol1” TYPE=”linux_raid_member” PARTUUID=”10ae2afe-c832-9f4e-a845-5a4815bb397a” /dev/mmcblk0: PTUUID=”2412faf1” PTTYPE=”dos”

mkdir /cameras

umount /mnt

cp /etc/fstab /etc/fstab.bak vi /etc/fstab

Add in: UUID=cce2aa4f-7fd4-470c-ad5c-03cdab7cef09 /cameras ext4 defaults 0 0

mount -a mount

You will now see the md device mounted on the /cameras filesystem.