Introduction
This article describes how I set up a Samba backup server using a Raspberry Pi (3).
Just for fun.
This article describes how I set up a Samba backup server using a Raspberry Pi (3).
Just for fun.
The RPI Imager Tool was very helpful in getting this done:
username.password./etc/os-release command to confirm I had installed bullseye.Set up the RPI LAN like so:
sudo raspi-config.OK and exit the config menu.ifconfig to check that the wireless interface is now connected.wlan0 has an IP address.This would be a good time to complete some other configurations:
sudo raspi-config.Take the opportunity to update the RPI before continuing.
apt-get updateapt-get upgradeWhile static IPs can be useful, it's often more manageable to use DHCP with a reserved hostname on your router. This allows dynamic IP assignment while maintaining consistent access via hostname.
sudo fdisk -lDevice Boot Start End Sectors Size Id Type
/dev/sda1 2048 1953521663 1953521663 931.5G 7 HPFS/NTFS/exFAT
unmount /dev/sda1sudo parted /dev/sda1mklabel gptmkpart
MyExternalDrive
ext4
0%
100%
quit
sudo mkfs.ext4 /dev/sda1
Y and Enter when asked if you want to proceed. Then run:
sudo e2label /dev/sda1 rpiExternalDrive
sudo shutdown -r now
When the RPI powers back up, type the following:
sudo fdisk -lsudo mkdir /media/rpiExternalDrive sudo mount /dev/sda1 /media/rpiExternalDrivemount | grep sda1/dev/sda1 on /media/rpiExternalDrive type ext4 (rw,relatime)mount | grep sda1 command (as in the last step) to confirm the map path and disk format./etc/fstab file and add the following
/dev/sda1 /media/rpiExternalDrive ext4 defaults 0 0Type the following commands to set up permissions to the drive:
sudo chown -R username /media/rpiExternalDrive/sudo chown -R root:users /media/rpiExternalDrive/sudo chmod -R ug=rwx,o=rw /media/rpiExternalDrive/And your drive should be ready.
SMB stands for Server Message Block, a network protocol that allows users to share files, printers, and other resources on a network. It allows users to read, create, and update files on remote servers. It also allows applications to request services from server programs in a computer network
Type the following commands to get going with the installation:
sudo apt updatesudo apt upgradesudo apt install samba samba-commonEdit the configuration file /etc/samba/smb.conf
Then, in text editor scroll to the bottom of the document and look for something like this. If it doesn't exist, then just add the text:
[UsernameBackups]
path = /media/rpiExternalDrive/
browsable = yes
writeable = yes
create mask = 0777
directory mask = 0777
public = no
read only = no
Then save and exit.
sudo smbpasswd -a username
sudo systemctl restart smbd
\\raspberrypi\UsernameBackups in the address bar.