Solving some NFS issues on Hikvision cameras

afddwfadwfadwf

Young grasshopper
Joined
Mar 28, 2016
Messages
83
Reaction score
12
The problem is that with linux quota, an actual Windows will report the correct volume size, but Hikvision reports the actual disk size. So the camera is going to try writing more than allowed, resulting hdd errors and broken overwrite feature?

For example, quota for the camera user is 500GB on a 4TB drive. Windows reports the share as 500GB in size, but hikvision reports it as 4TB.... Isn't that going to cause problems?

Actually it did not work...After formatting it still says uninitialized...info.bin only has the serial number.

Can someone post your working info.bin?

The workaround is as mentioned earlier, mount a file of fixed size instead. But I prefer I cleaner way to fix this issue...



Hi everybody!
After 1 week of poking around NFS/Samba I finally managed to set it up correctly with SAMBA (because NFS version used by the cameras does not support user authentication (you'll see later on why we need this)!

Here is my setup:
  1. 4 Hikvision IP cameras, 3x DS-2CD2T22-I5, firmware V5.3.0 build 151016 and 1x DS-2CD2622FWD-IZS, firmware V5.3.6 build 151105
  2. powered through a POE switch
  3. 24h running Linux Fedora 22 X64 server (used for hosting Plex, BOINC, Seafile and other stuff), kernel 4.4.8-200
  4. RAID LVM partition of 8TB mounted under /storage where I want my cameras to write in
  5. Samba server ver. 4.2.11
  6. Quota ver. 4.03

Steps:
  1. Enabling quota - credits here.
    • look into etc/fstab for the words usrquota or grpquota next to the line mounting your desired partition. If it's not there, add it like this:
    • Code:
      /dev/mapper/alph--lvm-home    /storage    ext4    defaults[COLOR=#ff0000],usrquota,grpquota[/COLOR]    1 2
      (no space after the ,)
    • restart or remount if you don't have files in use
  2. Create one user for each camera with settings like below (8 character passwords, home directory and private group). I created 4 users camera1...4:
  3. Create one directory for each camera on your desired partition/location. I created 4 directories /storage/camera1...4
  4. Change owner and group of each directory to each corresponding user created above.
    • camera1 directory belongs to user and group camera1 and so on
  5. Create the quota files (aquota.user and aquota.group) using:
    Code:
    quotacheck -cug /storage
    - it has to be done under /storage
  6. Generate the table of current disk usage per file system with quotas enabled using:
    Code:
    quotacheck -avug
  7. Assign quota per user:
    • Code:
      edquota camera1
      replace the 0 under hard column with your desired value; for 400GB it is 419430400, for 200GB is 20971500. You can compute your own as another user on this thread was kind to tell us by using:
      Code:
      python -c "print [COLOR=#ff0000]XXX[/COLOR]*1024**"2"
      where XXX is your desired GB
    • do it for the other users as well
  8. Check if it's ok with
    Code:
    quota camera1
    . If you want to add more options like time limits etc... please look into the credits link.
  9. Now let's setup SAMBA. I used the GUI /usr/bin/system-config-samba. If you don't have it, install it.
    • click on Preferences, Samba Users and add all users created before, camera 1...4
    • click on Preferences, Server Settings, Security and make sure, you have it like this:
    • View attachment 10606
    • Click on add a Samba share and point to the directories created before, camera 1...4, assign a short name like camera1 and check Writable and Visible:
    • View attachment 10607
    • On tab Access select "Give access to these users and check one corresponding user for each camera
    • restart the Samba server by using
      Code:
      service smb restart
    • make it run at boot by using
      Code:
      systemctl enable smb
      and start it by using
      Code:
      systemctl start smb
    • check if it's OK by using
      Code:
      service smb status
  10. Going back to the camera storage setup. You have to use a short path in the File path exactly like this /camera1...4 with a / not a \. Click on test, then on save, then on HDD Management tab where you'll see the HDD without the values yet. Click again on NetHDD tab and again on test and on save and after you finally get back to HDD Management tab you can select the new HDD and format it.
  11. Restart everything
  12. In conclusion, you don't need to set it at around 200GB you can go as much as 400GB or even higher, thing is the camera needs to see all the free space and the capacity for itself, this is why you need to setup the quotas.
 
Last edited by a moderator:

Buggah

Young grasshopper
Joined
Jan 17, 2015
Messages
31
Reaction score
4
Location
Amsterdam
I have a DS-2CD3145F-I with v5.3.8 firmware and I mounted a CIFS share on my synology with a user quota of 500GB. I do it the same way as with all my other hikvisions which are running v 5.2.5.
The 2CD3145F keeps reporting 10152GB as capacity where the others just report the assigned quota. Is this a bug in 5.3.8?
 

afddwfadwfadwf

Young grasshopper
Joined
Mar 28, 2016
Messages
83
Reaction score
12
I have a DS-2CD3145F-I with v5.3.8 firmware and I mounted a CIFS share on my synology with a user quota of 500GB. I do it the same way as with all my other hikvisions which are running v 5.2.5.
The 2CD3145F keeps reporting 10152GB as capacity where the others just report the assigned quota. Is this a bug in 5.3.8?
I had the exact same issue with DS-2CD3345-I on v5.3.8 and v5.3.6. CIFS mount shows the size of the filesystem instead of usable size set by quota (linux quota). Windows client can report the usable size correctly. And the firmware does not support large shares (it can mount them, format, but stays uninitialized). I had to create 199GB filesystems. The firmware is so buggy. The camera does not support current version of samba and NFS
 

rdk8

n3wb
Joined
Jan 28, 2016
Messages
1
Reaction score
0
After trial and error based on the other posts in this thread, I'm posting my working setup in case it helps people:
5x IP cams (4x DS-2CD2342WD-I firmware 5.3.6 and 1x DS-2CD2D14WD/M firmware 5.3.0)
Windows 10 PC hosting mirrored 6TB drives

I created a partition for each camera and an empty folder in the root folder on each partition and shared that folder. The cameras don't like a non-empty folder to format and the root folder had hidden folders in it -- formatting only worked on the empty folder. Each of these partitions were shared with the same user. No quotas configured since I'm giving each camera a partition and it can use the whole partition.

Also I had old credentials that I had to delete by hitting the "X" button and the clicking on the save button in the web interface. (This tripped me up for a while because it didn't seem to take the new credentials until I did this).
 

Tolting Colt Acres

Pulling my weight
Joined
Jun 7, 2016
Messages
390
Reaction score
154
So, I have an issue with NFS on my cameras, I doubt this is anything I can fix, I may just have to swap to smb, but I figured I would ask first.

12 2042's and 1 2632 recording on motion via NFS to a CentOS 7 Linux box running 6x6TB drives w/ a PERC H700. Each camera has its own 1TB Virtual Disk carved out on the PERC, which is mounted under /data (e.g. /data/CAMERA1 /data/CAMERA2) and exported vis NFS. This all works well (for the post part).

my exports file

/data/CAMERA1 *(rw,sync,no_root_squash)
...
/data/CAMERAn *(rw,sync,no_root_squash)

The problem I have is: if for some reason the CentOS box reboots (which happens with some regularity as I live in the boonies and we occasionally have power outages, even with a UPS on the server, the battery backup will only last 15-20 minutes before shutting down), all of the cameras stop recording. The status will show as "Offline". They will not automatically reconnect when the server comes back online. They will stay offline, literally, for days. And, if the power failure happens overnight while sleeping, I may not even realize it until a few days later. The only way the cameras will start recording again is if I physically log in to each camera and reboot the camera for it to reestablish the nfs connection. this is becoming a full-time job :)

Is there a different way to configure the NFS exports so the cameras will reconnect? or
Is there a way to reboot the camera remotely, so I can set up a task when the NAS server boots to automatically go out and reboot the camera?
 

afddwfadwfadwf

Young grasshopper
Joined
Mar 28, 2016
Messages
83
Reaction score
12
The camera does automatically reconnect with cifs/samba.

Or you can probably use something less power hungry for live recording (Intel NUC?) and then move the files to a nearline storage? Or maybe invest in a generator?
 

Tolting Colt Acres

Pulling my weight
Joined
Jun 7, 2016
Messages
390
Reaction score
154
Already have an MEP-003, but I only use it for prolonged outages :)

I was hoping there was a command I could send thru a web browser (e.g. http://admin:password@mycamera/some/url?cmd=reboot) which I would then be able to automate on startup with lynx..... but, if I have to convert to SMB, I suppose I could, although I think its slower than NFS.

edit update:

updated all my cameras to use smb, reformatted all the shares. Test reboot, only 50% of the cameras reconnected, the others reported "error" or "offline" and required a reboot to connect to the samba server again. :(

Another update:

After much research, I was able to determine I could reboot the cameras remotely using the ISAPI interface. So, I set up a script in /etc/rc.d/rc.local to reboot all my cameras automatically when the NVR powers up:

curl -X PUT http://user : password@ipaddress : port/ISAPI/System/reboot
...
one line for each camera (remove spaces before and after :, had to put them in otherwise the forum converted my :'s into :p's)
...

This will ensure each of my cameras reboots and reconnects to the SMB share when the NVR reboots, regardless of how long the NVR may have been offline.
 
Last edited by a moderator:
Joined
Apr 22, 2015
Messages
6
Reaction score
2
I've also problems with an original DS-2CD2342WD-I.

Running the latest firmware: V5.4.1 build 160525

I'm running a Ubuntu Xenial VM with NFS functionality.

I tweaked the previous post in this topic for adding a loop device to use ext4.

PHP:
fallocate -l 256G dome01.img
mkfs -t ext4 dome01.img
file dome01.img
vi /etc/fstab
/mnt/dome/dome01.img    /mnt/dome/dome01        ext4    defaults        0       0
vi /etc/exports
/mnt/dome/dome01 192.168.1.21(rw,sync,no_root_squash,no_subtree_check)
reboot
Then reboot the camera. It sees the 256Gb export and I can format it and stays in normal mode.

Now is the only question what the file limit (read disk size) in the firmware is because the recording disk is a 1.2Tb.
 
Last edited:

cam235

Pulling my weight
Joined
Oct 5, 2016
Messages
320
Reaction score
162
I had the "NFS share always returns to unformatted" problem, using firmware 5.3.0 build 151016 on Hikvision DS-2CD2132F-IS. I didn't want to change the firmware, but I was able to work around the problem by creating a separate partition on the server's disk, with just one directory that I used for the camera. After doing that, it works.
 
Joined
Dec 17, 2016
Messages
2
Reaction score
0
Hey Folks,

New to the forum, but also was stuck for days o_O on how to setup the SMB/CIFS to connect to the Synology NAS.

CAM: DS-2CD2142FWD-IWS
Firmware: V5.3.8 build 151224

My first problem was I couldn't get the camera to successfully "Test" the connection when using "SMB/CIFS" even though I could test successfully using "NFS" with File Path "/Volume1/Rear1".

I finally was able to get a successful "test" when I corrected my "File Path". Due to the fact that I didn't remove "/Volume1" from "/Volume1/Rear1". When Using SMB/CIFS, Please only list the File Folder name "/Rear1" Hope this helps. to get those that were stuck to "Test" successfully.

I'm using SMB/CIFS, because it allows me to assign specific amounts of drive space for the camera recording. After the above, I was able to see the capacity I assigned in Quota and "Format" successfully. :cool:

The below is a step-by-step with pictures from HIKVISION on how to setup either NFS or SMB/CIFS for Synology. :)

http://overseas.hikvision.com/ueditor/net/upload/2015-06-10/ae9f2fc6-bed2-41f2-81fb-4bfea3d0e0a2.pdf

Now my issue is how to get the cameras to record directly to the NAS??
 

Buggah

Young grasshopper
Joined
Jan 17, 2015
Messages
31
Reaction score
4
Location
Amsterdam
I have some cams record directly to a synology nas. I used the same guide to make it work
 

wilkcards

n3wb
Joined
Jan 30, 2017
Messages
11
Reaction score
0
After trial and error based on the other posts in this thread, I'm posting my working setup in case it helps people:
5x IP cams (4x DS-2CD2342WD-I firmware 5.3.6 and 1x DS-2CD2D14WD/M firmware 5.3.0)
Windows 10 PC hosting mirrored 6TB drives

I created a partition for each camera and an empty folder in the root folder on each partition and shared that folder. The cameras don't like a non-empty folder to format and the root folder had hidden folders in it -- formatting only worked on the empty folder. Each of these partitions were shared with the same user. No quotas configured since I'm giving each camera a partition and it can use the whole partition.

Also I had old credentials that I had to delete by hitting the "X" button and the clicking on the save button in the web interface. (This tripped me up for a while because it didn't seem to take the new credentials until I did this).

Thanks, this worked for me. I had been using a usb hard drive connected to my router for nas recording, but it was painfully slow. After creating partition on hard drive I couldn't initialize because I was sharing the root folder. I created an empty folder as you suggested and was able to format through http interface. I haven't tested it yet but I'm sure the performance will be much better. Ty for the post....
 

smerrett79

n3wb
Joined
May 23, 2017
Messages
1
Reaction score
0
Hello everyone, I think I have a slightly different issue to those already overcome on this incredibly helpful forum but please point me in the right direction if I've missed a solution to my problem.

Setup
  1. Hikvision DS6704HFI video encoder. FW V1.2.5 build 150522, Encoding version 5.0 build 140409.
  2. Raspberry Pi 2 running OpenMediaVault with NFS share on USB flash drive with capacities of 32GB and 512GB (which I've left to one side until I can get the system working with 32GB as I know there are issues with large shares)
I can get OMV NFS share to show on the DS6704 HDD NAS page and the NFS is allowing a connection from the DS6704 as the log shows it allowing the mount: "May 23 15:52:40 raspberrypi rpc.mountd[22292]: authenticated mount request from 192.168.1.4:920 for /export/folder2 (/export)"

Here's the setting in the Hikvision configuration:
NASsettings.png
Which then leads to "a" share being detected (make a note of the size):
NASidentfied.png
So then to initialize I try formatting and once I've confirmed I want to format the drive, I get it to 6%:
NASformat6.png
And then this happens (it fails):
NASformatfail.png
So I SSH into the Pi to get a closer look at the drive mounts and directories and see the following, which gives me no idea which of the partitions is showing up as the share of size 3.16GB that the DS6407 sees above:NASdirs.png

Please could anyone help me get the NFS share recognised (and at least past 6% formatted) and able to record to it? I've been at this for days to no avail. What other configs would be useful to see in determining the problem/solution? What is the Hikvision seeing when it reports the share size is 3.16GB?

Thank you!
 

alastairstevenson

Staff member
Joined
Oct 28, 2014
Messages
15,386
Reaction score
6,218
Location
Scotland
I'd speculate that you have created the NSF shares under / as opposed to under the path that /dev/sdb1 is mounted to.
Out of curiosity, what do you see with a
ls -al /
Is there a directory /export ? And if so, do you see the folder2/datadir0 etc that the decoder would have started to create?
Helpful hint : In PuTTY there is a handy 'copy all to clipboard' in the top left menu, that allows you to grab a text transcript. Which you can then quite neatly edit / use in the 'code' tags of the forum, found under the '+' in the menu bar. Easier all round than screen images of command line stuff.
 

sanamon

n3wb
Joined
Nov 13, 2017
Messages
1
Reaction score
1
After fiddling with this also, I have found that the camera refuses to "format" the share if:
- Size of the filesystem shared is less than 10GB or bigger than 250? GB (unsure of upper limit)
- There are some files or folders in the share (like a folder "lost+found" for instance)
- Rights for the folder where the filesystem is mounted are not correct
- NFS options are not correct in /etc/exports, i use "async,unsecure,all_squash, anonuid=1000,anongid=1000", i think the unsecure is needed. And use "async" at own risk...
After experimenting with this i'm now able to use a Raspberry Pi (2) with USB thumb drives for the cameras, shared via NFS. I have one 32GB drive, partitioned into two 16GB partitions and one 16GB drive. I use EXT4 filesystems and recommend using UUID of the filesystems in /etc/fstab for mounting the drives.
 

scheka

n3wb
Joined
May 13, 2015
Messages
11
Reaction score
3
Hello everyone,

i have following issue,
i have some of hikvision cams, for example DS-2CD2032-I with fw 5.4.5, and its ran without any issues with my qnap TS253A Nas 4.3.4, connection via CMB/CIFS
But since one week, some of my cams have not taken any records, after some recheck, i could find out that some of them has lost connection to the nas.

Under storage managemant/ net hdd menu i could creat a new connection to the nas with successful test, but if i try to format hdd (hikvision menu), i get every time "device error"

anyone idea why i get this error.


i have allready tested with diverent size of storage (15, 150, 199, 250 GB) but without any results to make the hdd formated.
 

alastairstevenson

Staff member
Joined
Oct 28, 2014
Messages
15,386
Reaction score
6,218
Location
Scotland
i have some of hikvision cams, for example DS-2CD2032-I with fw 5.4.5, and its ran without any issues with my qnap TS253A Nas 4.3.4, connection via CMB/CIFS
But since one week, some of my cams have not taken any records, after some recheck, i could find out that some of them has lost connection to the nas.
Did you update the firmware in the NAS?
Anything else changed that could cause the problem?
 

pila

n3wb
Joined
Sep 28, 2015
Messages
25
Reaction score
2
Location
Croatia
hikvision cams, for example DS-2CD2032-I with fw 5.4.5, and its ran without any issues with my qnap TS253A Nas 4.3.4
Why would you do it like so? Use the QNAP Surveillance Station! It records perfectly fine 4 of my cameras when they issue an alarm. I do not see why would I save directly from 4 or less cameras to QNAP if it comes with decent program doing the job for up to 4 cameras for free and I can watch and search all my cameras on two TVs via HDMI?

I do not know if anyhting changes with different fw versions of the cameras, but I have described in detail how things work perfectly well without formatting disks in the post Solving some NFS issues on Hikvision cameras. For me, nothing changed in last 2 years.

I have used that same method for saving to my current NAS which is QNAP TS-253A as I described for Asustor NAS.. On QNAP - Made a folder: /Kamere/Balkon (all my cameras are recorded in the folder /Kamere, each has its own subfolder and user), create the user Balkon with 30 gb quota, create the network share /23Balkon (pointing it to /Kamere/Balkon) and give rw rights to the user Balkon (and others as needed). Then on the camera (e.g. Web interface), point it to NAS IP address, folder /23Balkon (entering / and not \), SMB/CIFS, test, save, change to the previous tab, select your new disk (you may see entire disk capacty now but should see 30gb and Unformatted), format, you will now see 30 gb, and save. And that is it. If not, delete contents of /23Balkon and repeat the process.

I use this method only for cameras over my QNAP 4 free licence limit. I have been test saving to folders at USB3 disk connected to my giga router (but that should never be done in normal usage as it is quite likely this data will get lost).
 
Last edited:

snickels

n3wb
Joined
Feb 19, 2018
Messages
4
Reaction score
0
I need to get video recording directly to the NAS on motion and it appears it does at random times and I can't figure out to make it consistently work.

I have a DS-2CD2542FWD and trying to get it to record on motion to my NAS Synology DS216. I followed the directions specified onhttp://overseas.hikvision.com/ueditor/net/upload/2015-06-10/ae9f2fc6-bed2-41f2-81fb-4bfea3d0e0a2.pdf. When the set up seemed complete, we tested with the Hikvision web browser under the HDD settings, it appears it automatically created a datadir0 through datadir34. Under each file was various empty video files. We didn't see any actual video being recorded.

Anytime I reboot the NAS it looks like new backupinfo01.bin and logcurlfile.bin are created in each of the datadir files. See attached screenshot.

In the screenshot you will see video files under the datadir0 for 2/16/18 and under the datadir1 for 2/17/18. I am using HIkvision's web browswer (See attached screenshot) to confirm the live view and the motion events are configured properly, but I don't see any new video files appearing in the NAS. I am expecting to see new video files as the motion is being detected....

Please help. What am I doing wrong?
 

Attachments

Top