These are the steps I went through to set up a Samba share on my Raspberry Pi. I wanted it to have a central place I could store and retrieve large files between computers on my home network. The Raspberry Pi comes with limited read/writeable storage and needs external storage for unless you are running a huge SD card and aren’t worried about wearing it out. I’m not sure if “wearing out an SD card” is still a thing, however I had an external 1TB USB drive available so it seemed perfect for this purpose. The file system on it was already formatted as ext4 so that what’s you’ll see reflected below.

Mount External Storage and Make it Persistent

Make sure the external device exists
$ sudo fdisk -l

Create a mount point for the external device
$ sudo mkdir /mnt/usbdrive

Set ownership to avoid permissions issues
$ sudo chown -R pi:pi /mnt/usbdrive/

Add entry to fstab so that it gets mounted automatically by configure /etc/fstab using information from fdisk -l and the mount point created
/dev/sda1 /mnt/usbdrive ext4 user,rw 0 0

If everything is setup correctly the drive will mount
$ mount /dev/sda1

Check to see if the device mounted and if size of the device looks correct
$ df -h

Install and Configure Samba

Install the packages needed
$ sudo apt install samba -y

Configure Samba, but first make a copy of the default config file as a backup
$ sudo cp /etc/samba/smb.conf /etc/samba/smb.bak

Open /etc/samba/smb.conf and put the following lines at the end. Note: I’m pointing to a specific directory on the mounted external device.

[sambapi]
comment = Samba Storage on Pi
path = /mnt/usbdrive/sambashare/
directory mask = 0777
create mask = 0777
writeable = yes
browsable = yes
public = no

I don’t like that connecting to the samba share presents two directories. Since I don’t plan to access the home directory on the Raspberry Pi I removed those lines. You can comment them out too.
For more see: https://raspberrypi.stackexchange.com/a/124336

# [homes]
# comment = Home Directories
# browseable = no
# read only = yes
# create mask = 0700
# valid users = %S

Set a password for the pi user to access the samba share
$ sudo smbpasswd -a pi

Restart the samba service so that all the settings get reloaded

$ sudo systemctl restart smbd