Cheap and cheerful Windows file server
This is my cheap and cheerful Windows file server on my home wifi network. It has a 1TByte hard drive accessible to my windows PC and any other device on my home network. It also has a Subversion server running that I can use Tortoise SVN on my PC.
The picture shows a Raspberry Pi Zero W strapped to a USB removable hard drive. The drive is connected by USB to the Pi Zero and the whole thing is powered by a USB cable plugged into the Wifi router. It is permanently available. It is very easy to set up.
I initially set up the raspberry pi to run headless so I can use VNC on my windows PC to control it using the pi graphical user interface. I have stored this basic image as a .img file on my PC so that I can burn the image to a micro SD card when needed.
On the raspberry pi command window :
sudo apt-get install samba samba-common-bin sudo leafpad /etc/samba/smb.conf (or use sudo nano)
Edit the smb.conf :-
workgroup = wins support = yes
Add the following entries for each file source folder required:
[pi-hard-disk] comment= path = /media/hdisk browseable = Yes writeable = Yes onlyguest = no create mask = 0777 directory mask = 0777 public = no
I setup three entries :-
One for the local pi folder /home/pi (pi)
One folder for the entire external drive /media/hdisk (pi-hard-disk)
One readonly folder for my CD library /media/hdisk/MUSIC (pi-music)
Set the samba pass word for user pi (user “pi” password “pi”)
I am keeping it simple with no special access/authentication considerations.
sudo smbpasswd -a pi >> enter pi as password
Next automatically mount the external usb drive on boot up. My external drive is formatted as windows NTFS older models are FAT32. Ensure the pi can handle ntfs.
sudo apt-get install ntfs-3g
Add an entry to the fstab table to mount the drive on boot up. The mount point is the folder:
/media/hdisk. You can use any folder, but it must agree with the path specified previously.
mkdir /media/hdisk sudo leafpad /etc/fstab
Add this entry to the fstab config file :
/dev/sda1 /media/hdisk ntfs-3g vmask=000 0 0
To avoid using IP network addresses (eg 192.168.1.123), ensure the pi has a suitable network name. The wifi router should be able to resolve the name to the actual IP address used. I am using the name FILESERVER for my pi computer. This can be set using raspbian config program. There is an option to change the name under the network menu.
Reboot the pi and everything should work !!
On the windows PC go to file explorer and type the following into the top URL bar:
Windows will ask for a user and password to connect. Enter user pi and password pi as setup previously.
You will then see the file shares to the file server:
On other raspberry Pi s on the network :-
You need to set up a samba client to connect to the samba server on the file server….
at the command window:
sudo apt-get install samba-common smbclient samba-common-bin cifs-utils
Ensure a mount point is created. This can be anywhere:
Update the fstab table to auto connect to the fileserver on boot.
sudo leafpad /etc/fstab
Add the entry
//FILESERVER/pi-hard-disk /media/fileserver cifs user pi,password pi,uid=pi,gid=pi,x-systemd.automount 0 0
Reboot the pi and access to the file server can be made from /media/fileserver.
On other android tablets or phones on the network :-
Find a samba client app on the play store. e.g. AndSMB.
Enter the server name e.g. FILESERVER and the user and password e.g. pi/pi