Add Storage via Mount Point



  • Greetings!

    I am new to the Shinobi tool, but needed to move away from ZM. I am running the current CE Shinobi version on an Ubuntu 18.04 LTS Standard container via Proxmox. So far, I have been able to configure it to work with my cameras pretty well. One thing I tried to get working was additional storage via a second volume. To do this, I created a mount point to a 32GB raw VM disk in Proxmox and path'd it to:
    /root/Shinobi/external

    I then booted the VM, started Shinobi, edited the config.json with:
    "addStorage": [
    {"name":"local2","path":"__DIR__/videos2"},
    {"name":"External","path":"__DIR__/external"}
    ]

    After restarting:
    pm2 restart all

    I launched the browser and went to a camera setting. Sure enough, under storage, was "External". I selected it and saved. Then I triggered the camera manually by setting it to Record mode. When I checked for videos, nothing showed up in the Videos List. I logged in via a terminal and navigated to /root/Shinobi/external/<userEmail>/cam1 and sure enough, there was a video listed. So it seems to have recorded to the mount point, but I cannot see it in the web GUI video list.

    I then tried the same add storage procedure on the local disk at /root/Shinobi/video3 and it worked. I was able to record, see the files in the console and in the web GUI video list. So adding storage is working, just not when the target path is a mount point and only when trying to retrieve the videos?



  • Well, in classic form, I got it to work about 15 minutes after posting. The problem is that I am not sure exactly what I did...
    But, I will post this in case it helps others.

    I could see the video files getting created in the external storage location I created, but not in the web GUI Videos List. The mySQL DB was responsible for maintaining the video locations, so I figured I would start there. I lauched mySQL prompt and set the default user:

    > mysql
    MariaDB [(none)]> use ccio;

    Listed the tables:

    MariaDB [ccio]> show tables;
    +----------------+
    | Tables_in_ccio |
    +----------------+
    | API |
    | Events |
    | Logs |
    | Monitors |
    | Presets |
    | Users |
    | Videos |
    +----------------+

    Checked the contents of the Videos table:

    MariaDB [ccio]> select * from Videos;
    +------+-----------------------+------+---------------------+----------+----------+--------+---------------------+--------+-----------------------------------+

    | mid | ke | ext | time | duration | size | frames | end | status | details |

    +------+-----------------------+------+---------------------+----------+----------+--------+---------------------+--------+-----------------------------------+

    | Cam2 | [email protected] | mp4 | 2018-07-27 00:35:54 | NULL | 61552000 | NULL | 2018-07-27 00:37:54 | 2 | {} |

    | Cam2 | [email protected] | mp4 | 2018-07-27 01:46:03 | NULL | 61337900 | NULL | 2018-07-27 01:48:03 | 1 | {} |

    | Cam2 | [email protected] | mp4 | 2018-07-27 01:49:38 | NULL | 61464900 | NULL | 2018-07-27 01:51:38 | 1 | {} |

    | Cam2 | [email protected] | mp4 | 2018-07-27 01:51:56 | NULL | 61419300 | NULL | 2018-07-27 01:53:56 | 1 | {} |

    | Cam2 | [email protected] | mp4 | 2018-07-27 01:54:21 | NULL | 59079400 | NULL | 2018-07-27 01:56:21 | 1 | {} |

    | Cam2 | [email protected] | mp4 | 2018-07-27 01:56:34 | NULL | 61496500 | NULL | 2018-07-27 01:58:34 | 1 | {} |

    | Cam2 | [email protected] | mp4 | 2018-07-27 01:59:08 | NULL | 61416600 | NULL | 2018-07-27 02:01:09 | 1 | {} |

    | Cam2 | [email protected] | mp4 | 2018-07-27 02:02:02 | NULL | 61422700 | NULL | 2018-07-27 02:04:03 | 1 | {} |

    | Cam2 | [email protected] | mp4 | 2018-07-27 02:13:30 | NULL | 61380400 | NULL | 2018-07-27 02:15:30 | 1 | {} |

    | Cam2 | [email protected] | mp4 | 2018-07-27 02:17:34 | NULL | 61728700 | NULL | 2018-07-27 02:19:35 | 1 | {} |

    | Cam2 | [email protected] | mp4 | 2018-07-27 02:52:47 | NULL | 61587800 | NULL | 2018-07-27 02:54:47 | 1 | {} |

    | Cam2 | [email protected] | mp4 | 2018-07-27 02:59:37 | NULL | 61514900 | NULL | 2018-07-27 03:01:37 | 1 | {} |

    | Cam2 | [email protected] | mp4 | 2018-07-27 03:44:15 | NULL | 61863100 | NULL | 2018-07-27 03:46:15 | 2 | {} |

    | Cam2 | [email protected] | mp4 | 2018-07-27 05:36:57 | NULL | 61988500 | NULL | 2018-07-27 05:38:57 | 2 | {} |

    | Cam2 | [email protected] | mp4 | 2018-07-27 05:43:08 | NULL | 45032500 | NULL | 2018-07-27 05:45:07 | 2 | {} |

    | Cam2 | [email protected] | mp4 | 2018-07-27 12:44:47 | NULL | 61698800 | NULL | 2018-07-27 12:46:47 | 2 | {} |

    | Cam2 | [email protected] | mp4 | 2018-07-27 13:01:04 | NULL | 62416700 | NULL | 2018-07-27 13:03:04 | 1 | {} |

    | Cam2 | [email protected] | mp4 | 2018-07-27 15:07:43 | NULL | 61313700 | NULL | 2018-07-27 15:09:43 | 1 | {} |

    | Cam2 | [email protected] | mp4 | 2018-07-27 15:11:10 | NULL | 61462900 | NULL | 2018-07-27 15:13:10 | 1 | {} |

    | Cam2 | [email protected] | mp4 | 2018-07-27 15:13:37 | NULL | 61639400 | NULL | 2018-07-27 15:15:37 | 1 | {} |

    | Cam2 | [email protected] | mp4 | 2018-07-27 15:15:43 | NULL | 61121100 | NULL | 2018-07-27 15:17:43 | 1 | {} |

    | Cam2 | [email protected] | mp4 | 2018-07-27 15:22:52 | NULL | 61110000 | NULL | 2018-07-27 15:24:52 | 2 | {} |

    | Cam2 | [email protected] | mp4 | 2018-07-27 15:30:12 | NULL | 61329400 | NULL | 2018-07-27 15:32:12 | 1 | {} |

    | Cam2 | [email protected] | mp4 | 2018-07-27 15:32:19 | NULL | 61504400 | NULL | 2018-07-27 15:34:19 | 2 | {} |

    | Cam2 | [email protected] | mp4 | 2018-07-27 22:02:47 | NULL | 61484800 | NULL | 2018-07-27 22:04:47 | 1 | {} |

    | Cam2 | [email protected] | mp4 | 2018-07-27 22:06:20 | NULL | 61496500 | NULL | 2018-07-27 22:08:20 | 1 | {} |

    | Cam2 | [email protected] | mp4 | 2018-07-27 22:11:25 | NULL | 34111400 | NULL | 2018-07-27 22:22:54 | 1 | {} |

    | Cam2 | [email protected] | mp4 | 2018-07-27 22:30:09 | NULL | 61518900 | NULL | 2018-07-27 22:32:09 | 1 | {} |

    | Cam2 | [email protected] | mp4 | 2018-07-27 22:34:23 | NULL | 61367500 | NULL | 2018-07-27 22:36:23 | 2 | {} |

    | cam1 | [email protected] | mp4 | 2018-07-27 23:43:46 | NULL | 5275080 | NULL | 2018-07-27 23:43:54 | 1 | {} |

    | cam1 | [email protected] | mp4 | 2018-07-27 23:52:57 | NULL | 6272050 | NULL | 2018-07-27 23:53:08 | 1 | {"dir":"/root/Shinobi/videos2/"} |

    | cam1 | [email protected] | mp4 | 2018-07-27 23:54:02 | NULL | 6500860 | NULL | 2018-07-27 23:54:13 | 1 | {"dir":"/root/Shinobi/external/"} |

    +------+-----------------------+------+---------------------+----------+----------+--------+---------------------+--------+-----------------------------------+l'

    Video entries were absent. I then switched the storage location of a camera in the web GUI to the secondary local storage location 'local2' mapped to /root/Shinobi/videos2 from my above post and triggered some video. As expected, this worked and I could see the new videos in the table with the alternate directory path under the 'Details' column. So, pushing my luck, I again tried switching the storage location to 'External' and triggered more video. When I went to list the Videos table, I fully expected to see no new entries, but it worked! I saw a new video entry with the path to external in the Details column. I checked the Video List in the web UI and there it was!

    Uuuumm....Why?? Was it simply because I launched the mySQL console?



  • Continuing this thread, I have noticed some inconsistent behavior with mySQL that perhaps can be explained, or used to correct a potential problem.

    It seems like the database needs some "cooling off" period after it is altered. I notice that when I delete videos from a monitor and immediately try to trigger new recordings (usually with some camera settings changed for testing) I do not get database additions. However, I always get the new video files created on the hard drive, so clearly the motion detection operated. However, if I wait a while, then try a new recording, it seems to work as expected. I print the Videos table and can confirm there are missing entries for files that were created.

    I am also seeing this happen for manually triggered recordings (changing the monitor from Watch Only to Record and back) regardless of how long I wait. I get a new MP4 file in the storage location, but no entry in the Video List.


 

Looks like your connection to Shinobi Forum was lost, please wait while we try to reconnect.