Monday, February 7, 2022

How to Set Up a Samba Network Storage Drive on Raspberry Pi for Hikvision IP Cameras

Hikvision value IP cameras (such as the IPC-B120, IPC-B121H, and IPC-B120-D-W) feature onboard motion detection, infrared night vision, and H.265+ compression, but lack internal hard drives. Rather than purchasing an expensive commercial NVR, you can attach an external USB hard disk to a Raspberry Pi configured as an SMB/CIFS Network Attached Storage (NAS) target for continuous or motion-triggered video archiving.

Stack: Raspberry Pi 4 • External USB HDD (ext4) • Samba Server (SMBv2/v3) • Hikvision Storage Management

1. Installing and Configuring Samba on the Raspberry Pi

sudo apt-get update
sudo apt-get install samba samba-common-bin -y

# Create recording directory on mounted external drive
sudo mkdir -p /media/cctv_storage/hikvision
sudo chown -R nobody:nogroup /media/cctv_storage/hikvision
sudo chmod -R 0777 /media/cctv_storage/hikvision

2. Samba Share Definition (/etc/samba/smb.conf)

Hikvision firmware requires specific Samba dialect and locking settings to format network drives successfully:

[hikvision]
   comment = Hikvision CCTV Storage
   path = /media/cctv_storage/hikvision
   browseable = yes
   writeable = yes
   guest ok = yes
   read only = no
   create mask = 0777
   directory mask = 0777
   force user = nobody

Restart Samba:

sudo systemctl restart smbd

3. Mounting the Drive in Hikvision Web GUI

  1. Log into your camera's web interface → Configuration → Storage → Storage Management → Net HDD.
  2. Set Type to NAS / SMB/CIFS, enter the Raspberry Pi's IP address, set File Path to /hikvision, and save.
  3. Under HDD Management, select the newly added network disk and click Format / Init. Once status changes to Normal, motion recordings will save directly to your Pi.

No comments:

Post a Comment

How Google Antigravity Solved the Mysterious NVIDIA Sleep Reboot on My Dell Inspiron 7567 (Ubuntu Linux)

If you run modern Ubuntu or Linux on a Dell Inspiron 15 Gaming (7567) or a similar 7th-gen Intel laptop paired with an NVIDIA GeForce GTX ...