Solving some NFS issues on Hikvision cameras

LittleBrother

Pulling my weight
Joined
Sep 16, 2014
Messages
480
Reaction score
119
This problem can be worked-around without a firmware patch by enabling quotas on the share/NFS volume and then setting the quota for the user by whom the camera's files are created lower than the available space prior to the Format operation. I got this directly from HikVision support/R&D in China after my problem report was escalated. HikVision does not yet view this as their bug; the NAS system is violating their assumption about the camera having access to every last byte on the share (rather than just the free space at the time of the Format operation).
Well of course they are wrong, as evidenced by the number of people who've had problems with it, and the behavior of the camera that coincides with absolutely no actionable information to the user about what happened or why.
 

ivordurham

n3wb
Joined
Sep 29, 2014
Messages
8
Reaction score
0
Couldn't agree more. Still working to make that case with them. Error reporting in general is terrible with this product. If you actually do get an error message, it is likely "Parameter error" rather than something actually informative about what is wrong.
 

LittleBrother

Pulling my weight
Joined
Sep 16, 2014
Messages
480
Reaction score
119
Couldn't agree more. Still working to make that case with them. Error reporting in general is terrible with this product. If you actually do get an error message, it is likely "Parameter error" rather than something actually informative about what is wrong.
It's just lazy inept programming, and I say that as a software developer. I wouldn't expect my users to put up with such inane error messages, and I wouldn't ask them to. And for those systems I support that have the ever-helpful "contact administrator", I can provide them detailed reasons as to what happened and how to correct it in a timely manner.

Before I stumbled into the approach that works for me of a dedicated drive that is not too large (and since haven't had any drives magically uninitialize) I saw the drives uninitialized themselves on a whim, and ran into regular problems formatting. Basically I think a lot of the code for the firmware looks like this:

on error go to next line

Thus you can keep using the system, but have no idea what happened and how to correct your mistake, insofar as the software thinks you made one.
 

jimmyt

Getting the hang of it
Joined
Sep 12, 2014
Messages
101
Reaction score
4
similar problems with 5.2

I suppose I am having the same issues with 5.2. The camera can see the NAS (freenas NFS share) but wont initialize it. I also created a SMB share in Windows and it sees it and will format it, say its good to go, then it goes to uninitialized after a few minutes. The freenas is a 200gb share and the SMB is 100gb. I also created a 1tb smb share and it treats it like the NFS share. With the freenas NFS share and the larger SMB share it says formatting and then immediately goes to "Complete" and says uninitialzed. Doesnt matter what size the NFS share is - the original NFS share was 900GB. With 5.2 there is a test button to test each connection. Each time, it passes for all shares. I know it works because if I change a parameter, then it errors on the test. Also, there is no username and password allowed for an NFS share - is that normal? SMB requires it.

I have FTP to the FreeNas working - on motion is shoots a shot every second for 10 seconds and works well. I even have motion email alerts working. But recording is another story. I even have hikvision's android app working via their EZVIZ dns service.

With my limited unix skills I can telent into the camera and issue the "df" command and see that all the shares are shown by the camera, but it wont go anywhere from there. Any thoughts or suggestions?

So far I like the camera (3mp turret dome) and am looking forward to adding a few more down the road, just need to get recording working!
 

Attachments

LittleBrother

Pulling my weight
Joined
Sep 16, 2014
Messages
480
Reaction score
119
I suppose I am having the same issues with 5.2. The camera can see the NAS (freenas NFS share) but wont initialize it. I also created a SMB share in Windows and it sees it and will format it, say its good to go, then it goes to uninitialized after a few minutes. The freenas is a 200gb share and the SMB is 100gb. I also created a 1tb smb share and it treats it like the NFS share. With the freenas NFS share and the larger SMB share it says formatting and then immediately goes to "Complete" and says uninitialzed. Doesnt matter what size the NFS share is - the original NFS share was 900GB. With 5.2 there is a test button to test each connection. Each time, it passes for all shares. I know it works because if I change a parameter, then it errors on the test. Also, there is no username and password allowed for an NFS share - is that normal? SMB requires it.

I have FTP to the FreeNas working - on motion is shoots a shot every second for 10 seconds and works well. I even have motion email alerts working. But recording is another story. I even have hikvision's android app working via their EZVIZ dns service.

With my limited unix skills I can telent into the camera and issue the "df" command and see that all the shares are shown by the camera, but it wont go anywhere from there. Any thoughts or suggestions?

So far I like the camera (3mp turret dome) and am looking forward to adding a few more down the road, just need to get recording working!
I have a 200 GB and 250 GB SMB setup now and it's been rock solid for over a week. When you say you setup a 100 GB share for SMB, did you create a specific new hard drive partition JUST for that? One of my SMB shares is on an external USB and I just deleted everything off it, put a single folder on it, within windows selected it to share, and I'm using a full admin account (probably don't need to, and a specific user account would be safer which I'll get to eventually) from the camera to that particular folder.

For the other SMB share I used windows disk management to shrink a 1 TB volume I had by 200 GB. When that shrank it gave me another 200 GB drive letter. Again, put a folder in there, and shared it. Either I had bad luck or read of others having bad luck initializing right at the root, hence the first subfolder.
 
Last edited by a moderator:

ivordurham

n3wb
Joined
Sep 29, 2014
Messages
8
Reaction score
0
Enabling disk quotas on FreeNAS

I have FTP to the FreeNas working - on motion is shoots a shot every second for 10 seconds and works well. I even have motion email alerts working. But recording is another story. I even have hikvision's android app working via their EZVIZ dns service.

With my limited unix skills I can telent into the camera and issue the "df" command and see that all the shares are shown by the camera, but it wont go anywhere from there. Any thoughts or suggestions?
Here's a link with a recipe for setting disk quotas on FreeNAS: http://it.thelibrarie.com/weblog/2011/12/user-quota-freenas/ (I am not a FreeNAS user, so Google will be your friend if you run into problems.) On your shared volume double-check which user created the formatting files for the camera and then set the quota for that user lower than the available space after you delete all of Hik-created formatting files. Then you should be able to re-perform the Format operation. The acid test of evading the Normal->Uniitialized problem is to reboot the camera: If the HDD remains "Normal" after a re-boot you are all set. Then remember to check the Trigger Channel box as well as setting the recording schedule.

I have a 2Tb share working successfully once I enabled quotas.
 
Last edited by a moderator:

jimmyt

Getting the hang of it
Joined
Sep 12, 2014
Messages
101
Reaction score
4
thanks for the advice.. problem is, no files get created for the camera on the NAS. I've checked the logs and there is no attempt by the camera to do anything??? very strange.. I was hopeing freenas would work as I have it running on an old PC and was going to invest in a new case, power supply and the works.. I am wondering if just ploping down the extra cash for a synology is worth it?!? I really cant find anyone that has gotten it to work with freenas :(

Here's a link with a recipe for setting disk quotas on FreeNAS: http://it.thelibrarie.com/weblog/2011/12/user-quota-freenas/ (I am not a FreeNAS user, so Google will be your friend if you run into problems.) On your shared volume double-check which user created the formatting files for the camera and then set the quota for that user lower than the available space after you delete all of Hik-created formatting files. Then you should be able to re-perform the Format operation. The acid test of evading the Normal->Uniitialized problem is to reboot the camera: If the HDD remains "Normal" after a re-boot you are all set. Then remember to check the Trigger Channel box as well as setting the recording schedule.

I have a 2Tb share working successfully once I enabled quotas.
 

jimmyt

Getting the hang of it
Joined
Sep 12, 2014
Messages
101
Reaction score
4
Thanks! I did not partition anything. I simply created a shared folder under the root on each drive, and created a user called camera with admin permissions. I will look into hanewin in the short term and may also look into partitioning the drive into a smaller one. My goal was to build a NAS for the cameras and for general household data backup and maybe streaming of movies that get ripped from blue ray and dont need a backup. I had hoped to do it with freenas and building an itx pc the cost was about the same as a synology, but the advantage was I had more than 2 drives.. I am now starting to rethink that... thanks again!

I have a 200 GB and 250 GB SMB setup now and it's been rock solid for over a week. When you say you setup a 100 GB share for SMB, did you create a specific new hard drive partition JUST for that? One of my SMB shares is on an external USB and I just deleted everything off it, put a single folder on it, within windows selected it to share, and I'm using a full admin account (probably don't need to, and a specific user account would be safer which I'll get to eventually) from the camera to that particular folder.

For the other SMB share I used windows disk management to shrink a 1 TB volume I had by 200 GB. When that shrank it gave me another 200 GB drive letter. Again, put a folder in there, and shared it. Either I had bad luck or read of others having bad luck initializing right at the root, hence the first subfolder.
 

ivordurham

n3wb
Joined
Sep 29, 2014
Messages
8
Reaction score
0
thanks for the advice.. problem is, no files get created for the camera on the NAS. :(
Before looking for the camera to create files, confirm that it can connect to the NAS with your chosen user name and password using the Test button that is on the NAS Storage tab for the HDD you want to use. (I am running the 5.2.0 firmware in case you don't see a Test button.) I ultimately succeeded using SMB/CIFS to connect to a Samba share from a Linux server instead of NFS to that same server. Proceed to the Format operation only after the connection test succeeds and you have established a quota for the user. Given the camera software's very weak error handling it is best to test and check each small step that you can.
 
Last edited by a moderator:

jimmyt

Getting the hang of it
Joined
Sep 12, 2014
Messages
101
Reaction score
4
I took an old 80gb hard drive and added it to my windows 7 system - formatted it as NTFS, added 1 folder, shared it and low and behold it works as a SMB share. Not sure why it works and why freenas does not. No matter what I shared, the "Test" button in the software was always accurate even with the nas - the only thing with the nas setup it would not allow me to put in a username and password. At least now I have somewhere to start. I may bring up an old pc and throw windows 7 on it and go from there until I figure out how to get a nas working. With all that being said, I am having trouble using motion recording.. That is probably user error :) Thanks for the advice!
 

LittleBrother

Pulling my weight
Joined
Sep 16, 2014
Messages
480
Reaction score
119
I took an old 80gb hard drive and added it to my windows 7 system - formatted it as NTFS, added 1 folder, shared it and low and behold it works as a SMB share. Not sure why it works and why freenas does not. No matter what I shared, the "Test" button in the software was always accurate even with the nas - the only thing with the nas setup it would not allow me to put in a username and password. At least now I have somewhere to start. I may bring up an old pc and throw windows 7 on it and go from there until I figure out how to get a nas working. With all that being said, I am having trouble using motion recording.. That is probably user error :) Thanks for the advice!
Great! I've been able to get my 200 GB SMB shares working, so don't want to mess with it. If we used third party software like blue iris we wouldn't have had any of these problems, but mine are running pretty well now.
 

ivordurham

n3wb
Joined
Sep 29, 2014
Messages
8
Reaction score
0
With all that being said, I am having trouble using motion recording.. That is probably user error :) Thanks for the advice!
Motion-triggered recording requires configuration in two places: Advanced Configuration->Events->Motion Detection (Area, Sensitivity > 0, Arming Schedule, and Trigger Channel checked); Advanced Configuration->Storage->Record Schedule for Motion Detection. Good luck.
 

jimmyt

Getting the hang of it
Joined
Sep 12, 2014
Messages
101
Reaction score
4
Operator error.. Forgot to trigger channel :shame:
 

Cgy-User

n3wb
Joined
Nov 2, 2014
Messages
15
Reaction score
7
Location
Canada
OK, here’s the bug:
When you “format” the hard drive, a file “info.bin” is generated in the root of the directory. It contains the number of “datadirs” at the very end, i.e. available space in the network share divided by maximum size of a single datadir.
When the firmware tries to reconnect to the NFS share, it assumes that the full drive capacity (not the free space) reported by the NFS server can be fully utilized. The file “info.bin” only contains the number associated with the free available space (<= HDD capacity) so it fails. I've patched out that check in /dav/davinci so everything's working now.

5.0.2 Version

telnet into the device, copy /dav/davinci to your network share (‘mount’ tells you the directory). open the file with a hex editor, search this hexadecimal string:
5001D4C09DE52C00001A07005CE12A00001A
replace with:
5001D4C09DE50000000007005CE100000000
save. copy the file from the network share back to /dav, reboot the device.

5.1 Version

search for the following hex string:
5001DCC09DE54900001A0B005CE14700001A
and change it to
5001DCC09DE5000000000B005CE100000000
Hi..... I have two DS-2CD2732F-IS Camera's... After messing around with this problem for a while, and then upgrading one of them from 5.1.6 to 5.2.0. I came upon this thread and applied the change to my 5.1 version Camera.. Everything worked.. And all was fine.... However, now I have a camera that is at 5.2 version, and sadly, things aren't so happy for this camera as it still has the same problem, despite the obvious fix, ( not sure why HIKVISION hasn't fixed this yet!)

Anyway, I was wondering if anyone has found a fix/patch for the 5.2 version. Sadly when I attempt to GUNZIP the davinci.tar.gz file on the 5.2 version not only does my gunzip not recognize it as a gzip file, nor does any other program that I have that normally unzips files, and especially troubling, is that the gzip supplied with the DS-2CD2732F-IS also does not recognize it as a gzip file....

Hoping someone has had some success with this, as I don't know where to find a copy of version 5.1 that I can backout to....


Thanks in advance...
 

networkcameracritic

Getting the hang of it
Joined
Mar 10, 2014
Messages
719
Reaction score
203
What Hikvision did as an anti-hacking measure to make sure you can't enjoy the camera as you have is they put a checksum on the davinci file. So if you change 1 bit, the camera will hang and you'll have to use TFTP to fix it. If someone took the time to figure out the checksum, it would be possible. In the meantime, you can go back to 5.1 or 5.1.2 by using the TFTP method and then apply the patch.
 

Cgy-User

n3wb
Joined
Nov 2, 2014
Messages
15
Reaction score
7
Location
Canada
What Hikvision did as an anti-hacking measure to make sure you can't enjoy the camera as you have is they put a checksum on the davinci file. So if you change 1 bit, the camera will hang and you'll have to use TFTP to fix it. If someone took the time to figure out the checksum, it would be possible. In the meantime, you can go back to 5.1 or 5.1.2 by using the TFTP method and then apply the patch.
I don't suppose you or anyone else has a copy of the 5.1.6 english software kicking around anywhere?
 

BarRH

n3wb
Joined
Nov 16, 2014
Messages
1
Reaction score
0
Hi, is there anybody having 2032 (V5.2) working properly with WD My Cloud as the motion detection recording storage ???
If so, please me give me detailed instructions how to set it.
I spent hours but still the same issue: SMB/CIFS connection test succeed, formated well, but the status changes to unitialized after a while or reboot.
Any help would be very appreciated.
 

darrylb

n3wb
Joined
Nov 17, 2014
Messages
24
Reaction score
1
Ever find a fix? I too am trying to apply to v5.2 but after reviewing davinci file, don't feel confident the fix will work the same...


Hi..... I have two DS-2CD2732F-IS Camera's... After messing around with this problem for a while, and then upgrading one of them from 5.1.6 to 5.2.0. I came upon this thread and applied the change to my 5.1 version Camera.. Everything worked.. And all was fine.... However, now I have a camera that is at 5.2 version, and sadly, things aren't so happy for this camera as it still has the same problem, despite the obvious fix, ( not sure why HIKVISION hasn't fixed this yet!)

Anyway, I was wondering if anyone has found a fix/patch for the 5.2 version. Sadly when I attempt to GUNZIP the davinci.tar.gz file on the 5.2 version not only does my gunzip not recognize it as a gzip file, nor does any other program that I have that normally unzips files, and especially troubling, is that the gzip supplied with the DS-2CD2732F-IS also does not recognize it as a gzip file....

Hoping someone has had some success with this, as I don't know where to find a copy of version 5.1 that I can backout to....


Thanks in advance...
 
Top