[New Addon] Samba NAS. (Mount external disk and share it )

Drive are mounted in /media if you enable media library so /media/frigate and /frigate are alias of the same disk. No waste of space or double write.

L

i see. but enabling or disabling the media library, i noticed i can still access the media folder through PC.
And frigate would still count double the data, because it sees all the files double.

The options don’t enable or disable the media share but enable or disable the the disk location mount path inside or outside media folder.
I don’t understand your configuration very well, I need more details about your sambanas and frigate configuration.
Also I suggest to reboot your host ( not the addon but the whole system ) if you switch the medialibrary options because if the share is in use the change can’t be made and is ignored

Feel free to open an issue on GitHub because here I can’t give you more support.

L

1 Like

i had the same issue and rolled back to the prior version of samba nas, which resolved it. one of the changes in the latest update was “Internal HA Storage Mount is done with a generated superuser;” if the superuser is ‘ha_mount_user’, that appears to be what’s causing the issue given the log info under ‘create_connection_session_info’

should mention that I’m running supervised ha on a rpi fully updated as of this comment with media files on a usb-connected ssd formatted exfat / mbp

may be responsive to issues mentioned by @atxgu and @Sangoku given the log posted by the former

Great add-on! Just what I’ve been looking for. I have the sensors working via MQTT, I cannot see a “status” sensor though or a way of determining whether the NAS is mounted/functioning correctly or there’s some kind of problem? Am I overlooking something?

Do you enable the ‘mqtt integration’ option in config?

sorry, don’t think I explained myself well. I have all the MQTT sensors working ok. I just didn’t know which was the best one to use to verify that the drive has been mounted successfully?
I guess just check whether the entity sensor.sambanas_disk_xxxx_sambanas_mountpoints_xxxx exists?

I’m having this problem with the latest version. An external USB disk can’t be mounted since version 12.1.0. Here is my log:

[16:10:24] INFO: Hostname: homeassistant
[16:10:24] INFO: Interfaces: eno1 
[16:10:24] INFO: Enabling S.M.A.R.T for /dev/sda
smartctl 7.4 2023-08-01 r5530 [x86_64-linux-6.1.71-haos] (local build)
Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org

[16:10:24] INFO: Docker Interface: hassio 172.30.32.0/23
tdbsam_open: Converting version 0.0 database to version 4.0.
tdbsam_convert_backup: updated /var/lib/samba/private/passdb.tdb file.
=== START OF ENABLE/DISABLE COMMANDS SECTION ===
SMART Enabled.
SMART Attribute Autosave Enabled.
SMART Automatic Timers not supported

SMART Automatic Offline Testing Enabled every four hours.

[16:10:24] INFO: Enabling S.M.A.R.T for /dev/sdb
Added user ElMonty.
smartctl 7.4 2023-08-01 r5530 [x86_64-linux-6.1.71-haos] (local build)
Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org

Added user _ha_mount_user_.
---------------------------------------------------
[16:10:24] INFO: Exposed Disks Summary:
[CONFIG]                path = /homeassistant # TM:false  FS:native  #
[ADDONS]                path = /addons # TM:false  FS:native  #
[SSL]                   path = /ssl # TM:false  FS:native  #
[SHARE]                 path = /share # TM:false  FS:native  #
[BACKUP]                path = /backup # TM:false  FS:native  #
[MEDIA]                 path = /media # TM:false  FS:native  #
[ADDON_CONFIGS]         path = /addon_configs # TM:false  FS:native  #
[BIBLIOTECA]            path = /mnt/Biblioteca # TM:true USAGE:media  FS:ext4  #
---------------------------------------------------
s6-rc: info: service init-samba successfully started
s6-rc: info: service init-mqtt: starting
s6-rc: info: service wsdd: starting
s6-rc: info: service smbd: starting
s6-rc: info: service nmbd: starting
s6-rc: info: service avahi: starting
s6-rc: info: service wsdd successfully started
s6-rc: info: service nmbd successfully started
s6-rc: info: service smbd successfully started
s6-rc: info: service cifs-supervisor-mount: starting
s6-rc: info: service avahi successfully started
=== START OF ENABLE/DISABLE COMMANDS SECTION ===
SMART Enabled.
SMART Attribute Autosave Enabled.
nmbd version 4.18.9 started.
Copyright Andrew Tridgell and the Samba Team 1992-2023
[16:10:24] INFO: Automount Shares...
[16:10:24] INFO: Starting the AVAHI for homeassistant...
[16:10:24] INFO: Starting the wsdd daemon for REDCASA/homeassistant...
Waiting for daemon ...
smbd version 4.18.9 started.
Copyright Andrew Tridgell and the Samba Team 1992-2023
INFO: Profiling support unavailable in this build.
[16:10:24] INFO: Interfaces: -i eno1 
[16:10:24] INFO: Wait Samba Server to going up..(max 30s)
SMART Automatic Offline Testing Enabled every four hours.
s6-rc: info: service init-mqtt successfully started
2024-01-31 16:10:25,129:wsdd INFO(pid 378): using pre-defined UUID cb6a33a0-b841-531d-a34e-09ecec492eb1
2024-01-31 16:10:25,130:wsdd INFO(pid 378): joined multicast group 239.255.255.250 on 192.168.1.4%eno1
2024-01-31 16:10:25,132:wsdd INFO(pid 378): scheduling Hello message via eno1 to 239.255.255.250%eno1
2024-01-31 16:10:25,178:wsdd INFO(pid 378): joined multicast group [ff02::c] on fe80::2b0f:60f5:5f10:439e%eno1
2024-01-31 16:10:25,179:wsdd INFO(pid 378): scheduling Hello message via eno1 to ff02::c%eno1

s6-rc: info: service init-smartd successfully started

Samba version 4.18.9
PID     Username     Group        Machine                                   Protocol Version  Encryption           Signing              
----------------------------------------------------------------------------------------------------------------------------------------
501     ElMonty      ElMonty      192.168.1.125 (ipv4:192.168.1.125:56352)  SMB3_11           -                    AES-128-GMAC         

Service      pid     Machine       Connected at                     Encryption   Signing     
---------------------------------------------------------------------------------------------
CONFIG       501     192.168.1.125 Wed Jan 31 16:10:25 2024 CET     -            AES-128-GMAC


Locked files:
Pid          User(ID)   DenyMode   Access      R/W        Oplock           SharePath   Name   Time
--------------------------------------------------------------------------------------------------
501          0          DENY_NONE  0x100081    RDONLY     NONE             /homeassistant   .   Wed Jan 31 16:10:25 2024
501          0          DENY_NONE  0x100081    RDONLY     NONE             /homeassistant   .   Wed Jan 31 16:10:25 2024

[16:10:26] ERROR: Got unexpected response from the API: Reloading BIBLIOTECA did not succeed. Check host logs for errors from mount or systemd unit mnt-data-supervisor-mounts-BIBLIOTECA.mount for details.
[16:10:26] WARNING: Retry 1/3 Error Automount BIBLIOTECA Msg: {"name":"BIBLIOTECA","usage":"media","type":"cifs","server":"172.30.32.1","share":"BIBLIOTECA","username":"_ha_mount_user_","password":"********"}
[16:10:27] ERROR: Got unexpected response from the API: Reloading BIBLIOTECA did not succeed. Check host logs for errors from mount or systemd unit mnt-data-supervisor-mounts-BIBLIOTECA.mount for details.
[16:10:27] WARNING: Retry 2/3 Error Automount BIBLIOTECA Msg: {"name":"BIBLIOTECA","usage":"media","type":"cifs","server":"172.30.32.1","share":"BIBLIOTECA","username":"_ha_mount_user_","password":"********"}
[16:10:28] ERROR: Got unexpected response from the API: Reloading BIBLIOTECA did not succeed. Check host logs for errors from mount or systemd unit mnt-data-supervisor-mounts-BIBLIOTECA.mount for details.
[16:10:28] WARNING: Retry 3/3 Error Automount BIBLIOTECA Msg: {"name":"BIBLIOTECA","usage":"media","type":"cifs","server":"172.30.32.1","share":"BIBLIOTECA","username":"_ha_mount_user_","password":"********"}
s6-rc: info: service cifs-supervisor-mount successfully started
s6-rc: info: service mqtt-disk-handler: starting
s6-rc: info: service mqtt-disk-handler successfully started
s6-rc: info: service mqtt-handler: starting
s6-rc: info: service mqtt-handler successfully started
s6-rc: info: service legacy-services: starting
[16:10:29] INFO: Starting the MQTT daemon for partitions info...
[16:10:29] INFO: Starting the MQTT daemon for disks info...
[16:10:29] INFO: MQTT integration
s6-rc: info: service legacy-services successfully started

In HA Logs, Host section:

Jan 31 15:10:28 homeassistant mount[3372354]: error 2 (No such file or directory) opening credential file /mnt/data/supervisor/.mounts_credentials/BIBLIOTECA
Jan 31 15:10:28 homeassistant systemd[1]: mnt-data-supervisor-mounts-BIBLIOTECA.mount: Mount process exited, code=exited, status=2/INVALIDARGUMENT
Jan 31 15:10:28 homeassistant systemd[1]: mnt-data-supervisor-mounts-BIBLIOTECA.mount: Failed with result 'exit-code'.
Jan 31 15:10:28 homeassistant systemd[1]: Failed to mount Supervisor cifs mount: BIBLIOTECA.

Any ideas? Should I open an issue with this?

Thanks

1 Like

Cheers. Firstly, I love your addon! I use it to mount my NAS as well as a second drive for Frigate. This however proves to be challenging ATM as the addon, while using Homeassistant’s new mounting system, capitalizes the names of the Folders instead of leaving them the way the drives are named. Frigate meanwhile expects it’s folder to be all small letters so ultimately I had to turn off mounting in the addon and instead do it manually. Obviously this is only a minor inconvenience but maybe a fix can be implemented some time!

Best regards

Hello, I am rather new to HA and this great Samba NAS Addon.

My problem is that I can not discover the USB driver I connected to my HA/Laptop Server.
It seems that it is because

[19:04:06] INFO: Protection Mode is true
[19:04:06] WARNING: MoreDisk and Automount ignored because of ADDON in Protected Mode!

I saw in this topic that some of the users were able just to turn this protection mode off. But I just do not have such an option at all.

I read HA documentation that suggests enabling Advanced Mode which is done by me too.

Any advice or hint would be really much appreciated.

Seem that I have found a solution myself. It was a crazy bug and reinstallation fixed the issue.

Thanks for this amazing add-on, very useful. Does you know how I can edit the the samba.conf template, to enable me to have my mounted drive name not show in capital letters please? I presume if I go into the docker container and edit it there it will just revert next time the add-on is loaded and actually needs to be done within the configuration section?

Thanks

On another note, any idea why I can’t use manually configured MQTT (yaml) without it crashing? I would like to be able to limit the number of entities it produces via auto discovery, and also to be able to tweak their units/precision settings, so have set the following in the autodiscovery section of the configuration:

disable_discovery: true
disable_persistent: true

Initially this seemed to work for a while. However now I can’t run the add-on without a load of MQTT related errors, usually culminating in an add-on crash. If I set disable_persistent to true then the add-on works again, but I get all the entities back again that I don’t want via auto discovery.

Traceback (most recent call last):
  File "/usr/local/bin/mqtt_daemon.py", line 18, in <module>
    from ha_mqtt_discoverable import Settings, DeviceInfo
  File "/usr/lib/python3.11/site-packages/ha_mqtt_discoverable/__init__.py", line 470, in <module>
    class DeviceInfo(BaseModel):
  File "pydantic/main.py", line 186, in pydantic.main.ModelMetaclass.__new__
TypeError: Argument 'bases' has incorrect type (expected list, got tuple)
[14:25:08] WARNING: mqtt-handler crashed, halting add-on

I’ve tried deleting the sambanas auto discovery topics in MQTT explorer. Any suggestions please? Thanks.

Just adding a note of thanks for this Addon. Just stumbled on it today as I started to update my home LAN. Using a Pi4, I initially thought it would be a dedicated NAS project but seems like this addon with an external drive is able to meet all my needs streaming to various home media players and TV’s.

Thank you for this !

Hi, I tried using the veto file option but face an issue where all files disapear, just like in official addon Custom Samba Share? - #18 by diamant-x
Any idea if your addon could have a fix for it? Or how to hide files from specific points? Thanks.

Hi,

I have the latest Home Assistant OS running on my RPi 4B with Samba NAS add on installed. I have an external SSD connected (not mounted) to my Pi 4B on a USB 3.0 port with two ext4 partition, sdb1 (filesystem) and sdb2 (main storage). I want to be able to use the sdb2 partition connected to the Pi as a Network Time Machine Backup through Samba. I was earlier able to do this when I was running Raspberry Pi OS by mounting the drive (at /home/ex and made a folder named pibackup inside which served as target folder for backup) and edited the file smb.conf file at /etc/samba/ as follows.

Added:

**[global]**:

vfs objects = catia fruit streams_xattr

fruit:metadata = stream

fruit:model = MacSamba

fruit:posix_rename = yes

fruit:veto_appledouble = no

fruit:nfs_aces = no

fruit:wipe_intentionally_left_blank_rfork = yes

fruit:delete_empty_adfiles = yes

Edited:

[homes]
   comment = Home Directories
   browseable = no

# By default, the home directories are exported read-only. Change the
# next parameter to 'no' if you want to be able to write to them.
   read only = no (previously yes)

# File creation mask is set to 0700 for security reasons. If you want to
# create files with group=rw permissions, set next parameter to 0775.
   create mask = 0777 (previously 0700)

# Directory creation mask is set to 0700 for security reasons. If you want to
# create dirs. with group=rw permissions, set next parameter to 0775.
   directory mask = 0777 (previously 0700)

Ran the following commands to add password:

sudo smbpasswd -a pi
sudo systemctl enable smbd
sudo nano /etc/nsmb.conf

Added at the end to make it accessible directly in the file browser:


path = /home/ex/pibackup

writeable=Yes

create mask=0777

directory mask=0777

public=no

Since, I am new to Home Assistant OS, I am unable to replicate this. I have setup root SSH access using ‘HassOS SSH port 22222 Configurator’ add-on and also installed Samba NAS add-on. How do I accomplish this? Is there some smb.conf file installed by this addon that I can edit in a similar way?

Also, some instructions to create an MQTT sensor to track the sdb2 disk usage would be really appreciated!

-Sayam

Any chance someone can explain how I can set an idle time for a connected HDD that is not being used all the time?

Thank you.

Where do I place this code for Time Machine to work??

If my external SSD for the NAS is connected to USB during RPi5 boot (HA OS on SSD) HA will not boot up. So, it seems that the Pi doesn’t know which of the two SSD it should boot from. Is there a way I can change a configuration so I can leave the NAS SSD plugged in while HA boots from the main SSD?

And, I have the NAS SSD assigned as a network drive in HA > System > Storage. When HA boots, there is an error and I have to reload the network drive. I would like to resolve this as well. Any help would be very much appreciated.

I was able to configure it and it found the drive - everything looks good, except I’m not able to copy 20GB over to the empty 75GB drive because “not enough space”. Mount point is at /media/mydrivename

I have the original Samba Addon installed - is that a problem?