Solving some NFS issues on Hikvision cameras

networkcameracritic

Getting the hang of it
Joined
Mar 10, 2014
Messages
719
Reaction score
203
I got this off comments people posted on my blog at NetworkCameraCritic.com, so hope it helps a wider audience. Thanks to s400py and peter. This is not for the novice, but hopefully after a few people do it they can comment on their experience.

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
 

jbaugh

n3wb
Joined
Mar 13, 2014
Messages
12
Reaction score
0
With a little help, maybe...

I got this off comments people posted on my blog at NetworkCameraCritic.com, so hope it helps a wider audience. Thanks to s400py and peter. This is not for the novice, but hopefully after a few people do it they can comment on their experience.

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
I am perhaps just 1 step above novice level and I'm wondering if this patch is something I can apply. I have the 5.1 version firmware. I am able to telnet into the camera and when I use the "mount" command I get the following:

# mount
rootfs on / type rootfs (rw)
/dev/root on / type ext2 (rw,relatime)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
ramfs on /home type ramfs (rw,relatime)
udev on /dev type tmpfs (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
/dev/ubi1_0 on /dav type ubifs (rw,relatime)
/dev/ubi3_0 on /davinci type ubifs (rw,relatime)
/dev/ubi4_0 on /config type ubifs (rw,relatime)
192.168.1.122:/volume1/hik on /mnt/nfs00 type nfs (rw,sync,relatime,vers=3,rsize=4096,wsize=4096,namlen=255,acregmin=0,acregmax=0,acdirmin=0,acdirmax=0,soft,noac,nolock,proto=tcp,port=65535,timeo=70,retrans=3,sec=sys,local_lock=all,addr=192.168.1.122)

What do I do next? I think I could handle modifying the hex string if I could be instructed as to how to download and then re-upload the correct /dav/davinci file. Or am I just dreaming and this is too much over my head? I certainly don't want to brick my camera. But with some explicit instructions and guidance I might be willing to proceed. I am working on the Mac OS X platform if that means anything. Perhaps the better part of valor would be to just wait for Hikvision to issue a firmware update. What do you think?
Thanks.
 

networkcameracritic

Getting the hang of it
Joined
Mar 10, 2014
Messages
719
Reaction score
203
I haven't done it but I can help with my Linux skills. That mount command returns back all mounted files system. Assuming you tried to do the NFS but didn't work, you'll have an NFS mount still active. This is shown in 192.168.1.122:/volume1/hik on /mnt/nfs00 type nfs (rw,sync,relatime,vers=3,rsize=4096,wsize=4096,nam and that's your mount point. The directory you access is /mnt/nfs00 and copy the file davinci file using a Linux copy command, for example, cp /dav/davinci /mnt/nfs00/davinci and you should see a file called davinci on your NAS /volume1/hik directory that you can hex edit. Of course, you do the opposite to copy if back, cp /mnt/nfs00/davinci /dav/davinci.

Sorry if there's any typos. I'm assuming you know to use the ls command to display the directory to first make sure the file exists and smart enough to keep a backup copy should you mess up the with the hex editor.

As for the Mac, nothing special there, are connecting via telnet to the camera as you already have done, copying a file from the camera to your NFS mount, editing it, copying it back. You are half way there.
 

jbaugh

n3wb
Joined
Mar 13, 2014
Messages
12
Reaction score
0
Thank you very much for your prompt response to my question. Based upon your response and my limited understanding of it I think I best not proceed. At least not until I've studied up a bit more about working in the Terminal environment. If I understand you correctly, simply typing "*cp /dav/davinci /mnt/nfs00davinci*" into Terminal while telneting in to the camera will result in the correct file being copied to the "hik" shared folder on my NAS. I'm a bit anxious about modifying the "hik" shared folder for fear of causing my NAS to become "uninitialized" again. As long as I allocate the full capacity of "volume1" to the Hikvision camera I have been able to maintain the "normal" status. Of course, the whole purpose of the proposed patch is to take away this limitation. And I certainly would like to remove this serious limitation if I can. I feel frustrated because as you have said, I am "half way there".

By the way, here is the read out with the ls command:

# ls
bin dav dev home linuxrc opt root srv tmp var
config davinci etc lib mnt proc sbin sys usr
 
Last edited:

networkcameracritic

Getting the hang of it
Joined
Mar 10, 2014
Messages
719
Reaction score
203
Yes, try copying the file, nothing to lose. If you can do that, copy that somewhere on your Mac for safe keeping. Then you can edit the file, put it back in. If you are not happy with the results, you can always put the copy you made on your Mac. Looking it on my camera, this file is just 8 bytes, not sure that's correct and maybe the davinci.tar.gz
 

jbaugh

n3wb
Joined
Mar 13, 2014
Messages
12
Reaction score
0
Yes, try copying the file, nothing to lose. If you can do that, copy that somewhere on your Mac for safe keeping. Then you can edit the file, put it back in. If you are not happy with the results, you can always put the copy you made on your Mac. Looking it on my camera, this file is just 8 bytes, not sure that's correct and maybe the davinci.tar.gz
I am tantalizingly closer but I still can't complete this task. I was able to copy the "davinci" file to the shared folder on my NAS. I then copied that to my desktop so I could work with it in HexEdit. The davinci file is indeed only 8 bytes. When I open it with HexEdit and try a hex string find nothing is found. I just get a beep sound when I click "Find Next". Here is a screen shot of HexEdit:

Hex Edit.jpg

I feel like I am right on the verge of getting this done.
 

networkcameracritic

Getting the hang of it
Joined
Mar 10, 2014
Messages
719
Reaction score
203
It's the davinci.tar.gz. You need to un-gzip, un-tar the file, get the davinci file out of that, edit the file, tar it, gzip it. There's a free program called 7Zip that should be able to do this in Windows.
 

jbaugh

n3wb
Joined
Mar 13, 2014
Messages
12
Reaction score
0
It's the davinci.tar.gz. You need to un-gzip, un-tar the file, get the davinci file out of that, edit the file, tar it, gzip it. There's a free program called 7Zip that should be able to do this in Windows.
Thanks. I'm sure this explains my problem. This weekend, when I get some free time, I will work on this and see if I can complete this project. Thank you very much for persevering with me through this.
 

arr

n3wb
Joined
Apr 23, 2014
Messages
1
Reaction score
0
hi .i have hikvison

I got this off comments people posted on my blog at NetworkCameraCritic.com, so hope it helps a wider audience. Thanks to s400py and peter. This is not for the novice, but hopefully after a few people do it they can comment on their experience.

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 hikvision dvr and i setup it to use NFS to save recording to synology nas ,it works ,but whenever i restart hikvison hard status change to uninitialized and i have to format my NAS with hikvision dvr and i cause to delete all recording
please help me
i have info.bin in root of my synology.
 

dvb

n3wb
Joined
Mar 28, 2014
Messages
9
Reaction score
1
Hi,
I am looking for v5.1.6 NFS fix.
Does anyone know string values to change ?

Thanks !
 

JjS

n3wb
Joined
Jun 23, 2014
Messages
1
Reaction score
0
I would like to confirm that the patch works for the V5.1.2 build 140116 fimware.

Camera:
DS-2CD2432F-IW
NFS (RH box):
nfs-utils-1.2.3-39.el6.x86_64nfs-utils-lib-1.1.5-6.el6.x86_64

 

gogreen

n3wb
Joined
Jun 28, 2014
Messages
3
Reaction score
0
Hi,
I am looking for v5.1.6 NFS fix.
Does anyone know string values to change ?

Thanks !
I too would be very interested in the search string for 5.1.6 as well. My new DS-2CD2032-I came with 5.1.6 pre-installed and my servers NFS share mount on the camera is only maintained for a few minutes and then the state goes back to 'un-formatted'.
 

gogreen

n3wb
Joined
Jun 28, 2014
Messages
3
Reaction score
0
I too would be very interested in the search string for 5.1.6 as well. My new DS-2CD2032-I came with 5.1.6 pre-installed and my servers NFS share mount on the camera is only maintained for a few minutes and then the state goes back to 'un-formatted'.
Seems like I can answer my own question :rolleyes: I found the same string as posted above for the 5.1 version in the 5.1.6 davinci file.
 

gogreen

n3wb
Joined
Jun 28, 2014
Messages
3
Reaction score
0
So I did change the string and put the firmware back on the camera, rebooted and I was able to log in via telnet and web interface. Alas, the web interface is now Chinese only, before applying the patch it was multi lingual. Guess I have to look into the next issue: finding and applying an english language patch for the 5.1.6 firmware.
 

Jacks5000

n3wb
Joined
Jul 1, 2014
Messages
2
Reaction score
0
Hi
I just purchased a Hikvision camera and trying to recorded to a NAS and having the same problem like everyone else, I'm on firmware 5.1 , I tried doing the patch but luck, I'm using putty to telnet to my camera andI get to the mount try to copy using this commands cp/dav/davinci /mnt/nfs00 and I get this copy for source to destination option , and i don't know what to do next , my Linux skills are bad , can someone help me

Thanks in advance
 
Top