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

Thanks for your answer, I did some more research on this topic. I found out that this specific external HDD I’m using can be configured with a software tool from Seagate. Apparently the spin-down time on the HDD controller wasn’t set correctly. I set it to 5 minutes and now the drive will spin down correctly after a while. It will however, spin up again every 20 minutes or so, even when I’m not accessing anything. Will try to set the spin-down time a bit higher, because it’s probably not that great for the disc to constantly start and stop again. I still don’t know what keeps triggering the drive, it’s really strange. I’m running an Intel NUC with Home Assistant OS by the way.

Quick question;
I’m running an RPi4, with HA supervised. I have an SSD as boot drive and storage for this. Running super well.

If i connect another SSD, with the intent to share it, using this add-on, will that work?
And, should i uninstall the standard samba add-on before installing this one?

Peace

Hi
I want to mount the external SSD, and share it through Samba NAS.
Additionally I want to run Plex as Addon on my Home Assistant OS (running on a RPi4).

image

ID_FS_LABEL: SmallBlack
DEVNAME: /dev/sdb2

How should I do this? The instructions are not super clear on this point…

1 Like

Hi again!

I have tried another approach without using putty. I have generated the public and private key using SSH & Web Terminal addon with the command “ssh-keygen -t rsa”. This generates /root/.ssh/id_rsa and /root/.ssh/id_rsa.pub

I have copied the id_rsa.pub that looks like this:

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCj89P88Edk9XJi72Ux2Cmia6C3y/hxi8F6TwZeUTiLNrfcysan4iqFZgUp ... HIDDEN ... 26MiobxZQL/AxcMg3M= root@a0d7b954-ssh

and pasted in “HassOS SSH port 22222 Configurator” configuration so it generated an authorized_keys file.

After that I came back to “SSH & Web Terminal” and could ssh in port 22222:

➜  ~ ssh 127.0.0.1 -p22222
Welcome to Home Assistant OS.

Use `ha` to access the Home Assistant CLI.
#

So I guess the port 22222 is accesible.

Finally, I copied the private key from the id_rsa file that looks like this:

-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn
NhAAAAAwEAAQAAAYEAo/PT/PBHZPVyYu9lMdgpomugt8v4cYvBek8GXlE4iza33MrGp+Iq
hWYFKT8NKKiAjP ... HIDDEN ... rEzoyklmWoyX+jofMyGKIcY
b9scdE0FZKEI401o68YqYvbf2wELOw9QAcYtNlG/Wx0RLebB5mUmRsSEnnNJgzpqY0t5Cs
sXsUk1Vyeh4YkAAAARcm9vdEBhMGQ3Yjk1NC1zc2gBAg==
-----END OPENSSH PRIVATE KEY-----

Pasted it in Samba NAS configuration so it look like this:

workgroup: REDCASA
username: !secret SambaUser
password: !secret SambaPass
allow_hosts:
  - 10.0.0.0/8
  - 172.16.0.0/12
  - 192.168.0.0/16
  - fe80::/10
moredisks:
  - Biblioteca
available_disks_log: true
medialibrary:
  enable: true
  ssh_private_key: >-
    -----BEGIN OPENSSH PRIVATE KEY-----
    b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn
    NhAAAAAwEAAQAAAYEAo/PT/PBHZPVyYu9lMdgpomugt8v4cYvBek8GXlE4iza33MrGp+Iq
    hWYFKT8NKKiAjP ... HIDDEN ... rEzoyklmWoyX+jofMyGKIcY
    b9scdE0FZKEI401o68YqYvbf2wELOw9QAcYtNlG/Wx0RLebB5mUmRsSEnnNJgzpqY0t5Cs
    sXsUk1Vyeh4YkAAAARcm9vdEBhMGQ3Yjk1NC1zc2gBAg== -----END OPENSSH PRIVATE
    KEY-----
veto_files:
  - ._*
  - .DS_Store
  - Thumbs.db
  - icon?
  - .Trashes
compatibility_mode: false
autodiscovery: {}
mqtt_enable: true

And it fails :sob: :sob::

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 0.banner.sh: executing... 
---------------------------------------------------
 ____                  _           _   _           
/ ___|  __ _ _ __ ___ | |__   __ _| \ | | __ _ ___ 
\___ \ / _` | '_ ` _ \| '_ \ / _` |  \| |/ _` / __|
 ___) | (_| | | | | | | |_) | (_| | |\  | (_| \__ \
|____/ \__,_|_| |_| |_|_.__/ \__,_|_| \_|\__,_|___/
                                                   
                              Version 9.5.1-nas4
---------------------------------------------------
[cont-init.d] 0.banner.sh: exited 0.
[cont-init.d] automount.sh: executing... 
[12:21:19] INFO: Protection Mode is false
[12:21:20] INFO: MoreDisk option found!
[12:21:20] INFO: MediaLibrary option found!
Warning: Permanently added '[192.168.1.4]:22222' (ECDSA) to the list of known hosts.
Load key "/root/.ssh/id_rsa": invalid format
[email protected]: Permission denied (publickey).
[cont-init.d] automount.sh: exited 255.
[cont-finish.d] executing container finish scripts...
[cont-finish.d] mqtt.sh: executing... 
[12:21:21] INFO: MQTT cleanup.
s6-maximumtime: warning: unable to wait for child process: Operation timed out
[cont-finish.d] mqtt.sh: exited 99.
[cont-finish.d] umount.sh: executing... 
[12:21:26] INFO: Done.
[cont-finish.d] umount.sh: exited 0.
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.
[s6-finish] sending all processes the KILL signal and exiting.

The error says that tie id_rsa file has an invalid format… how can I generate the appropiate format with the ssh-keygen command??

Please help, I think I have almost got it!

Thank you in advance

You need to maintain the same format of private key. Maintain also the cr/lf , begin and end headers need to be in a line alone.
No empty lines. Just copy and paste the private key content as is.

I paste it like this:

  ssh_private_key: >-
    -----BEGIN OPENSSH PRIVATE KEY-----
    b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn
    NhAAAAAwEAAQAAAYEAo/PT/PBHZPVyYu9lMdgpomugt8v4cYvBek8GXlE4iza33MrGp+Iq
    hWYFKT8NKK... HIDDEN... mWoyX+jofMyGKIcY
    b9scdE0FZKEI401o68YqYvbf2wELOw9QAcYtNlG/Wx0RLebB5mUmRsSEnnNJgzpqY0t5Cs
    sXsUk1Vyeh4YkAAAARcm9vdEBhMGQ3Yjk1NC1zc2gBAg==
    -----END OPENSSH PRIVATE KEY-----
veto_files:
...

But when I save the configuration it changes to this:

  ssh_private_key: >-
    -----BEGIN OPENSSH PRIVATE KEY-----
    b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn
    NhAAAAAwEAAQAAAYEAo/PT/PBHZPVyYu9lMdgpomugt8v4cYvBek8GXlE4iza33MrGp+Iq
    hWYFKT8N... HIDDEN... SLaCyko9KmgKFxbwvCgESJru
    7ROIL/3wVIBCtBqMH5zRTR4wQmNmRoDhf2fh7AaCUnacm0/rEzoyklmWoyX+jofMyGKIcY
    b9scdE0FZKEI401o68YqYvbf2wELOw9QAcYtNlG/Wx0RLebB5mUmRsSEnnNJgzpqY0t5Cs
    sXsUk1Vyeh4YkAAAARcm9vdEBhMGQ3Yjk1NC1zc2gBAg== -----END OPENSSH PRIVATE
    KEY-----
veto_files:
...

Should I put some quotes or something?? Only if I leave a blank line between the end of the key and the -----END OPENSSH PRIVATE KEY----- it stays in a line alone but, of course, it doesn’t work this way

Don’t use > for yaml blob use |.

ssh_private_key: |
    -----BEGIN RSA PRIVATE KEY-----
1 Like

YES!!!

It worked finally!!! Thank you so much!

[cont-init.d] 0.banner.sh: exited 0.
[cont-init.d] automount.sh: executing…
[14:19:19] INFO: Protection Mode is false
[14:19:19] INFO: MoreDisk option found!
[14:19:19] INFO: MediaLibrary disabled in config. Disk are mounted only for this addon!
[14:19:19] INFO: Available Disk Labels:
pen2gb
[14:19:19] INFO: More Disks mounting… pen2gb
[14:19:19] INFO: Mount pen2gb
[14:19:20] INFO: Success!
[cont-init.d] automount.sh: exited 0.
[cont-init.d] mqtt.sh: executing…
[cont-init.d] mqtt.sh: exited 0.
[cont-init.d] samba.sh: executing…

above is the log…
also got a new folder in media section as “pen2gb”
my pen drive is formatted in ntfs

pls help

The addon only mount and share via smb. Media library is disabled in the config.
Also ntfs is not a good choice for this addons. Usa ext4 or other Linux native fs.

1 Like

Thx for the addon;
I want to use it for Time machine backups of my mac’s. However, I was able to mount the USB Harddisk but it read only. Is there a way to make it read and write. Don’t know where to look

thx

Try to check the fs used.
NFTS and ExFAT are limited supported in write. Use ext4 or other Linuz native fs.

Hey, i would realy like to use this integration with my second sata disc mounted in laptop but something is not going well. Can someone help me?

LOGS:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 0.banner.sh: executing... 
---------------------------------------------------
 ____                  _           _   _           
/ ___|  __ _ _ __ ___ | |__   __ _| \ | | __ _ ___ 
\___ \ / _` | '_ ` _ \| '_ \ / _` |  \| |/ _` / __|
 ___) | (_| | | | | | | |_) | (_| | |\  | (_| \__ \
|____/ \__,_|_| |_| |_|_.__/ \__,_|_| \_|\__,_|___/
                                                   
                              Version 9.5.1-nas4
---------------------------------------------------
[cont-init.d] 0.banner.sh: exited 0.
[cont-init.d] automount.sh: executing... 
[14:17:24] INFO: Protection Mode is false
[14:17:24] INFO: MoreDisk option found!
[14:17:24] INFO: MediaLibrary disabled in config. Disk are mounted only for this addon!
[14:17:25] INFO: More Disks mounting.. devices/pci0000:00/0000:00:17./ata3/host2/target2:0:0/2:0:0:0/block/sda
[14:17:25] INFO: Mount devices/pci0000:00/0000:00:17./ata3/host2/target2:0:0/2:0:0:0/block/sda
mount: /media/devices/pci0000:00/0000:00:17./ata3/host2/target2:0:0/2:0:0:0/block/sda: bad option; for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program.
[14:17:25] WARNING: Unable to mount external drivers!
[cont-init.d] automount.sh: exited 0.
[cont-init.d] mqtt.sh: executing... 
[cont-init.d] mqtt.sh: exited 0.
[cont-init.d] samba.sh: executing... 
[14:17:25] INFO: Using hostname=homeassistant interface=enp3s0
tdbsam_open: Converting version 0.0 database to version 4.0.
tdbsam_convert_backup: updated /var/lib/samba/private/passdb.tdb file.
Added user NAS.
[cont-init.d] samba.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[14:17:26] INFO: Starting the AVAHI daemon for homeassistant...
Waiting for daemon ...
[services.d] done.
[14:17:26] INFO: Starting the MQTT daemon for disks info...
nmbd version 4.13.8 started.
Copyright Andrew Tridgell and the Samba Team 1992-2020
daemon_ready: daemon 'nmbd' finished starting up and ready to serve connections
smbd version 4.13.8 started.
Copyright Andrew Tridgell and the Samba Team 1992-2020
INFO: Profiling support unavailable in this build.
daemon_ready: daemon 'smbd' finished starting up and ready to serve connections
[14:17:26] INFO: Sending MQTT autodiscovery...
cat: can't open '/tmp/local_mount': No such file or directory

Please post your config. It seem you don’t pass the label but the full block path that is not supported.

I am getting this warning. WARNING: Unable to mount external drivers! Did I set it up wrong or something? Can anyone help me with the setup?

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 0.banner.sh: executing... 
---------------------------------------------------
 ____                  _           _   _           
/ ___|  __ _ _ __ ___ | |__   __ _| \ | | __ _ ___ 
\___ \ / _` | '_ ` _ \| '_ \ / _` |  \| |/ _` / __|
 ___) | (_| | | | | | | |_) | (_| | |\  | (_| \__ \
|____/ \__,_|_| |_| |_|_.__/ \__,_|_| \_|\__,_|___/
                                                   
                              Version 9.5.1-nas4
---------------------------------------------------
[cont-init.d] 0.banner.sh: exited 0.
[cont-init.d] automount.sh: executing... 
[13:36:14] INFO: Protection Mode is false
[13:36:14] INFO: MoreDisk option found!
[13:36:14] INFO: MediaLibrary disabled in config. Disk are mounted only for this addon!
[13:36:15] INFO: Available Disk Labels:
 FLASH DRIVE
[13:36:15] INFO: More Disks mounting.. <PARTITION LABEL>
[13:36:15] INFO: Mount <PARTITION
mount: /media/<PARTITION: special device /dev/disk/by-label/<PARTITION does not exist.
[13:36:15] INFO: Mount LABEL>
mount: /media/LABEL>: special device /dev/disk/by-label/LABEL> does not exist.
[13:36:15] WARNING: Unable to mount external drivers!
[cont-init.d] automount.sh: exited 0.
[cont-init.d] mqtt.sh: executing... 
[cont-init.d] mqtt.sh: exited 0.
[cont-init.d] samba.sh: executing... 
[13:36:19] INFO: Using hostname=homeassistant interface=eth0
tdbsam_open: Converting version 0.0 database to version 4.0.
tdbsam_convert_backup: updated /var/lib/samba/private/passdb.tdb file.
Added user homeassistant.
[cont-init.d] samba.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[13:36:20] INFO: Starting the AVAHI daemon for homeassistant...
[13:36:20] INFO: Starting the MQTT daemon for disks info...
Waiting for daemon ...
nmbd version 4.13.8 started.
Copyright Andrew Tridgell and the Samba Team 1992-2020
smbd version 4.13.8 started.
Copyright Andrew Tridgell and the Samba Team 1992-2020
daemon_ready: daemon 'nmbd' finished starting up and ready to serve connections
INFO: Profiling support unavailable in this build.
daemon_ready: daemon 'smbd' finished starting up and ready to serve connections
[13:36:21] INFO: Sending MQTT autodiscovery...
cat: can't open '/tmp/local_mount': No such file or directory

<PARTITION LABEL> is bogus value used as position tag. You need to insert the real label name of your selected partition on the external disk.

Would you mind helping me with the instructions on how to do that? To try this addon I have temporarily connected a 16GB USB drive to my RPI4 and if by some miracle, I get this work properly I will connect a bigger drive later.
Thanks

@Lucio_Tarantino
Hi
I have the following problem. I’m using the Zerotier network, the official Samba add-on (yours too;) uses the default NIC, doesn’t detect the Zerotier card.
Could you please add the option to use other network cards as in addition:

This option is:

interfaces:

image

Thanks in advance for your work.
Slaw

I don’t know if is possible. The options was removed because samba is exposed on all interfaces by default.
Go on my repository GitHub and open a issue I need to ask you some check to verify the visibility of the interface.

1 Like

Jokerigno Did you get this to work on Unraid?