how to setup storage to NFS instead of internal SD card?

cam235

Pulling my weight
Oct 5, 2016
322
164
I've got a Hikvision DS-2CD2132F-IS running 5.3.0, and I got it recording video to the internal SD card. It worked OK until the card filled up the first time. After that, more video is recorded but almost every clip has a gap of a second or more, I assume due to timeouts with the SD card erasing old files and/or having memory fragmentation issues(?) Anyway I want to try using NFS instead. I removed the internal SD card to force the device to use the NFS share, because there didn't seem to be a way to select one or the other in the iVMS-4200 storage screen.

I have a NFS share on a Linux box on my network. Using iVMS-4200 iin Device management/Remote Config/Storage/NAS I see my Server IP and File Path shown, and clicking the "test" icon results in "Testing succeeded". Under Storage/General I see the disk shown with total capacity (about 1 TB), Free Space: 0 MB and Status: Unformatted. Selecting the disk and doing "Format" takes about 20 minutes and then shows "HDD formatting succeeded". If I login to the Linux box hosting the NFS share I see it has created folders 'datadir0', 'datadir1',... each holding a lot of files hiv00000.mp4, hiv00001.mp4 etc. It appears to be good to go.

BUT, if I click onto another screen like "Main View", and then go back to "Device Management" and Storage/General, the disk is back to Unformatted and 0 free space. No video ever gets saved. I have rebooted the device, and so far have reformatted the disk 4 separate times. I also tried doing this through the MSIE web interface instead of the iVMS-4200 app, but still no joy. How do I get NFS set up correctly?

NFS-Formatting.jpg formatDone.jpg
 

Attachments

  • formatOk.jpg
    formatOk.jpg
    483.2 KB · Views: 17
Last edited by a moderator:
Just realized I have probably encountered this bug, described back in 2014. Now its 2016 and they still haven't fixed it, are you kidding me?
https://www.ipcamtalk.com/showthread.php/54-Solving-some-NFS-issues-on-Hikvision-cameras

That post suggests a fix using 'telnet' and copying and modifying a file, but unfortunately my device running 5.3.0 build 151016 does not allow telnet. I can get in with 'ssh' but it's a "BusyBox v1.2.1 Protect Shell", not a normal Linux shell and I don't see how I can even list a directory much less copy a file.

Code:
BusyBox v1.19.3 (2015-03-20 17:37:48 CST) built-in shell (ash)Enter 'help' for a list of built-in commands.

BusyBox v1.2.1 Protect Shell (psh)
Enter 'help' for a list of davinci system commands.

# help
Support Commands:
taskShow                        printPart                       prtHardInfo
getPreviewStatus                setIp                           setV6ip
setGateway                      dspStatus                       outputClose
outputOpen                      getDebug                        setDebug
debugLog                        getIrstate                      getMtu
camCmd                          getCamVer                       getIrstate
getLux                          getMcuInfo                      getMotion
getRawdata                      setIrcmd                        setRectFrame
updateCamera                    setLaserMode                    getLaserMode
setIrMode                       getIrMode                       setBaiguangMode
getBaiguangMode                 setYTLock                       InquireFanSwitch
StartLaser                      CloseLaser                      LaserMotReset
EnlargeCur                      ReduceCur                       SetCur
LaserMotDirect                  LaserTeleOffset                 LaserWideOffset
InqSwitch                       InqCurrent                      InqCurMotDirect
getMcuStateInfo                 setFastFocus                    getTrackStatus
getSelfcheckResult              setLdcMode                      getLdcMode
getPreviewStatus                appCmd                          camCmd
ezoomlens_start_t2_test         prtLensCurve                    getLensCurve
getIp                           gdbcfg                          {Test1}
{Test2}                         {Test3}                         {Test4}
{TestN}                         {TestY}                         getIsp
getISP                          setIsp                          setISP
setAgingMode                    getAgingMode                    setAgingTime
getAgingTime                    setLensZoomPos                  getLensZoomPos
dm365                           ss                              showKey
showServer                      showUpnp                        showStatus
showDefence                     setLBS                          setAlarm
cloudService                    t1                              ifconfig
netstat                         ping                            ping6
top                             iostat                          mpstat
ps                              reset                           dmesg
getDateInfo                     diagnose                        help

Reading further in the Solving some NFS Issues thread, seems there may still be a way using a TFTP tool and loading a different and maybe Chinese-language-only firmware and then enabling ftp and telnet and some more hacking after that which may or may not brick your camera (?). My opinion of Hikvision has now dropped significantly.

EDIT: the bug is due to a difference between total space on the disk partition, and available space in the selected directory. The solution may be to have a dedicated partition which contains just 1 directory. So if you have 3 cameras you need 3 partitions, each with having just one directory (folder).

EDIT2: The answer is yes. I got it to work, by making a new partition on the server's disk, with a single folder just for that camera.
 
Last edited by a moderator:
the problem with all these NFS implementations is they are using NFSv3 w/no rpc running.. so its a really hobbled NFS client that barely has any kind of space usage tracking.