Use second hard disk in samba network for storage

Dietpi is running on raspberrypi 3B+ with ssd data storage in smb network. This works fine.
Now I have connected a second usb hard drive to the pi.
What is the process that this disk also works as storage and is recognized on the network.
The hard drive is visible in Dietpi-config and is recognized, but it does not appear in my network.
Despite mount, unmount I can not get it to work.
Could someone help me? Thanks


pls can you share your smb.conf file as well as lsblk -o name,fstype,label,size,ro,type,mountpoint

sda 8:0 0 298,1G 0 disk
└─sda1 8:1 0 298,1G 0 part /
sdb 8:16 0 111,8G 0 disk
└─sdb1 8:17 0 111,8G 0 part /mnt/d7afc196-c7ba-4af5-bb7d-56045bb9642a
mmcblk0 179:0 0 14,4G 0 disk
├─mmcblk0p1 179:1 0 256M 0 part /boot
└─mmcblk0p2 179:2 0 14,2G 0 part

●─ sda ───────────────────────────────────────────── │
│ / : /dev/sda1 | ext4 | Capacity: 292.4G | Used: 72.1G │
│ ●─ mmcblk0 ───────────────────────────────────────── │
│ /boot : /dev/mmcblk0p1 | vfat | Capacity: 252M | Used: 30. │
│ /mnt/c6dd3b94-a789-4d57-9080-1472f721804b : /dev/mmcblk0p2 | ext4 | Not mounted │
│ ●─ sdb ───────────────────────────────────────────── │
│ /mnt/d7afc196-c7ba-4af5-bb7d-56045bb9642a : /dev/sdb1 | ext4 | Capacity: 109.5G | Used: 60M (0 │
│ ●─ Global Options ────────────────────────────────── │
│ Idle Spindown : Set a global idle duration, before drives power do │
│ ●─ Add / Refresh Drives ──────────────────────────── │
│ Add network drive : Select to mount networked drives │
│ Refresh : Scan for recently added/removed drives │
│ │
│ │

pls can you share smb.conf as requested above.

I do not know where and how to find this? Sorry

cat /etc/samba/smb.conf

GNU nano 3.2 smb.conf


workgroup = WORKGROUP
server string = %h server
dns proxy = no
log file = /var/log/samba/log.%m
max log size = 1000
syslog only = no
syslog = 0

panic action = /usr/share/samba/panic-action %d

security = user
encrypt passwords = true
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes

passwd program = /usr/bin/passwd %u
passwd chat = Enter\snew\s\spassword:* %n\n Retype\snew\s\spassword:* %n\n *password\su$
pam password change = yes
map to guest = bad user
load printers = no
printcap name = /dev/null
disable spoolss = yes

comment = DietPi Share
path = /mnt/dietpi_userdata
browseable = yes
create mask = 0664
directory mask = 0775
valid users = dietpi
writeable = yes

^G Get Help ^O Write Out ^W Where Is ^K Cut Text ^J Justify ^C Cur Pos M-U Undo
^X Exit ^R Read File ^\ Replace ^U Uncut Text ^T To Spell ^_ Go To Line M-E Redo

that the new drive is not shared via SAMBA is working as expected because it is not configured to be shared :wink:

At the moment you are sharing everything below directory /mnt/dietpi_userdata. But your new drive is mounted to a different place /mnt/d7afc196-c7ba-4af5-bb7d-56045bb9642a. Therefore it is not visible on SAMBA. Basically you would have 3 options

  1. mount your new HDD on a mountpoint below /mnt/dietpi_userdata like /mnt/dietpi_userdata/HDD2
  2. change the SAMAB export to /mnt. This will share everything below /mnt, including your new drive
  3. create a 2nd SAMBA export for /mnt/d7afc196-c7ba-4af5-bb7d-56045bb9642a. This would need to be mapped as an additional drive on the client side

first of all thank you!!
I have now chosen the first option. Now I see the hard disk. There are two folders “Documents and Lost+found”.
But I can not access them. No permission!
You write “change the samba export to mnt”. I don’t know how to do that??


ok let’s check permission ls -la /mnt/dietpi_userdata/HDD2

insgesamt 28
drwxr-xr-x 4 root root 4096 Feb 9 10:43 .
drwxrwxr-x 8 dietpi dietpi 4096 Feb 9 13:12 …
drwxr-xr-x 3 root root 4096 Feb 9 10:43 dietpi_userdata
drwx------ 2 root root 16384 Feb 8 15:11 lost+found

ok the folder is owned by user root. But access on SAMBA is done by user dietpi. Therefore is fine to have permission issues :wink:

drwxr-xr-x 3 root root 4096 Feb 9 10:43 dietpi_userdata

you could try changing whole content of your HDD to belong to user dietpi

chmod -R dietpi:dietpi /mnt/dietpi_userdata/HDD2

chmod: Invalid mode: “dietpi:dietpi”
“chmod --help” provides more information.
root@yellowsnow:~# chmod -R dietpi:dietpi /mnt/dietpi_userdata/HDD2
chmod: Invalid mode: “dietpi:dietpi”
“chmod --help” provides further information.

ah sorry my fault

chown -R dietpi:dietpi /mnt/dietpi_userdata/HDD2

Wonderful works perfectly. :smiley: :smiley: Hopefully I still know that next time or a possible reinstallation. I guess it can not be simpler?
Thank you very much for the help. I would never have managed alone. :thinking: :face_with_raised_eyebrow:

well it’s already quite simple

  1. add drive to correct place
  2. use correct permissions


:smiley: :smiley:
Thanks again!
Do I need to mark the post as done where?
And where should I send the box of wine / beer? :slight_smile:

I marked it as solved already.

If you like to support the entire project, simple follow this link

Sorry I have to ask again
I wanted to create a backup on the second hard drive.
This apparently does not work because of “mnt/userdata”.

pls can you be a little bit more specific what you have tried and what was the error you faced.