Mounting an external hard drive in the shares

Hello,
I am trying to mount an external hard drive on /home/samba1/.local/share/containers/storage/volumes/shares/_data/harddrive. The data on the hard drive is visible in the terminal. Unfortunately, no data is visible under Windows network environment \dc1\harddisk. How can I solve this problem?

Thank you very much

Greetings, which version of nethserver are you using?

Hello,
I am using Nethserver 8.

Did you try to restart the samba-dc service?

runagent -m samba1 systemctl --user restart samba-dc

It’s also possible to install the samba app on a new disk, see Disk usage — NS8 documentation

Hello Markus,

thanks for your help. When I restart Samba, I get the following error message:
Job for samba-dc.service failed because the control process exited with error code.
See “systemctl --user status samba-dc.service” and “journalctl --user -xeu samba-dc.service” for details.

Best regards

Let’s check the service status:

runagent -m samba1 systemctl --user status samba-dc.service

Please also check the logs for errors, see System logs — NS8 documentation

Did you try unmount the external hard drive and restart the service?

Hello,
as soon as the disc is mounted, Samba can no longer be restarted. When I unmount it, the reboot works again.
Greetings

1 Like

Maybe the owner/group on the external hard disk needs to be adapted?
You could create another samba share to compare.

1 Like

Hello Markus,

I have changed the permissions to ‘Owner Samba1’ group domainuser". The Samba restart works, but can no longer be clicked on the shares - open.
It is probably due to the authorisations. I enclose a picture.

Best regards


Do you get an error?

Did you try to (re)set the permissions of the share, see File server — NS8 documentation
Be careful as setting the permissions may cause wrong permissions when plugged into another machine.

Hello Markus,
I get the following error message:

<7>podman exec samba-dc samba-reset-acls -g ‘Domain Admins’ -p erw festplatte1
find: ‘festplatte1’: Permission denied
set_nt_acl_conn: init_files_struct failed: NT_STATUS_INVALID_PARAMETER
ERROR: Could not set acl for festplatte1: (3221225485, ‘An invalid parameter was passed to a service or function.’)
Traceback (most recent call last):
File “/home/samba1/.config/actions/reset-share-acls/50reset_share_acls”, line 34, in
phelper.check_returncode()
File “/usr/lib64/python3.11/subprocess.py”, line 502, in check_returncode
raise CalledProcessError(self.returncode, self.args, self.stdout,
subprocess.CalledProcessError: Command ‘(‘podman’, ‘exec’, ‘samba-dc’, ‘samba-reset-acls’, ‘-g’, ‘Domain Admins’, ‘-p’, ‘erw’, ‘festplatte1’)’ returned non-zero exit status 255.

You could try to set the permissions recursively on CLI first and then reset the permissions in cluster-admin.

Set owner to samba1:

chown -R samba1:samba1 /home/samba1/.local/share/containers/storage/volumes/shares/_data/festplatte1

Set rights for dirs:

find /home/samba1/.local/share/containers/storage/volumes/shares/_data/festplatte1 -type d -exec chmod 775 {} \;

Set rights for files:

find /home/samba1/.local/share/containers/storage/volumes/shares/_data/festplatte1 -type f -exec chmod 664 {} \;

Hello Markus,
I still get the following error message:

<7>podman exec samba-dc samba-reset-acls -g ‘Domain Admins’ -p erw festplatte1
find: ‘festplatte1’: Permission denied
set_nt_acl_conn: init_files_struct failed: NT_STATUS_INVALID_PARAMETER
ERROR: Could not set acl for festplatte1: (3221225485, ‘An invalid parameter was passed to a service or function.’)
Traceback (most recent call last):
File “/home/samba1/.config/actions/reset-share-acls/50reset_share_acls”, line 34, in
phelper.check_returncode()
File “/usr/lib64/python3.11/subprocess.py”, line 502, in check_returncode
raise CalledProcessError(self.returncode, self.args, self.stdout,
subprocess.CalledProcessError: Command ‘(‘podman’, ‘exec’, ‘samba-dc’, ‘samba-reset-acls’, ‘-g’, ‘Domain Admins’, ‘-p’, ‘erw’, ‘festplatte1’)’ returned non-zero exit status 255.

Are you using Rocky Linux or another distro?

Check the mount:

root@debianns8test:~# findmnt /home/samba1/.local/share/containers/storage/volumes/shares/_data/testfolder
TARGET                                                                       SOURCE    FSTYPE OPTIONS
/home/samba1/.local/share/containers/storage/volumes/shares/_data/testfolder /dev/sdb1 xfs    rw,relatime,attr2,inode64,logbufs=

Check the permissions of dirs:

root@debianns8test:~# ls -lisa /home/samba1/.local/share/containers/storage/volumes/shares/_data/testfolder
total 0
      128 0 drwxrwxr-x 3 samba1 427779 32 Jun 10 09:55  .
137406402 0 drwxr-xr-x 4 samba1 samba1 43 Jun 10 09:54  ..
      131 0 drwxrwxr-x 2 samba1 427779  6 Jun 10 09:55 'Unbenannter Ordner'

Check permission of files:

root@debianns8test:~# ls -lisa /home/samba1/.local/share/containers/storage/volumes/shares/_data/testfolder/Unbenannter\ Ordner/
total 0
131 0 drwxrwxr-x 2 samba1 427779 26 Jun 10 11:01 .
128 0 drwxrwxr-x 3 samba1 427779 32 Jun 10 09:55 ..
132 0 -rwxrw-r-- 1 samba1 427779  0 Jun 10 11:01 Testdocument

Maybe a hardware error on the disk?

Hello Markus,

here is the result. Use Rocky Linux

[root@nethserver _data]# findmnt /home/samba1/.local/share/containers/storage/volumes/shares/_data/festplatte1
TARGET SOURCE FSTYPE OPTIONS
/home/samba1/.local/share/containers/storage/volumes/shares/_data/festplatte1 /dev/sdc1 ext4 rw,relatime,seclabel
[root@nethserver _data]# ls -lisa /home/samba1/.local/share/containers/storage/volumes/shares/data/festplatte1
total 56
2 8 drwxrwxr-x+ 4 samba1 samba1 4096 Apr 24 2024 .
537153702 0 drwxr-xr-x. 4 samba1 samba1 43 Jun 10 09:33 …
12 16 -rw-rw-r–+ 1 samba1 samba1 8196 Jan 21 2024 .DS_Store
13 8 -rw-rw-r–+ 1 samba1 samba1 4096 Jan 19 2024 .
.DS_Store
36175873 8 drwxrwxr-x+ 16 samba1 samba1 4096 Jan 27 2024 Programme
11 16 drwxrwxr-x. 2 samba1 samba1 16384 Oct 3 2021 lost+found
[root@nethserver _data]# ls -lisa /home/samba1/.local/share/containers/storage/volumes/shares/data/festplatte1
total 56
2 8 drwxrwxr-x+ 4 samba1 samba1 4096 Apr 24 2024 .
537153702 0 drwxr-xr-x. 4 samba1 samba1 43 Jun 10 09:33 …
12 16 -rw-rw-r–+ 1 samba1 samba1 8196 Jan 21 2024 .DS_Store
13 8 -rw-rw-r–+ 1 samba1 samba1 4096 Jan 19 2024 .
.DS_Store
36175873 8 drwxrwxr-x+ 16 samba1 samba1 4096 Jan 27 2024 Programme
11 16 drwxrwxr-x. 2 samba1 samba1 16384 Oct 3 2021 lost+found

I could reproduce the issue on Rocky, it seems selinux doesn’t allow it.

EDIT:

It works with disabled selinux but disabling security features isn’t recommended.

1 Like

Hello Markus,

thanks for your feedback. Would this be possible with Centos Stream, Almalinux or Debian? Which one could you recommend?

Debian uses apparmor instead of selinux so it should work but it’s not a perfect solution.

Hello Markus,

is there any other way to mount the hard drives so that you could access them from windows?