In this article we can see how to attach multiple hard disks to Raspberry Pi and convert those disks into a consolidated file share with Samba File Server. Configuring Pi with ntfs drivers and mounting the disks under specific path with uuid are pre-requisites for setting up the file server. Let us see those steps one by one.
Install ntfs support tools
The first step is to install ntfs-3g which provide support for ntfs file system in Raspberry Pi. This can be installed by typing “sudo apt-get install ntfs-3g”
Attaching the disks
Although without installing ntfs-3g and performing any specific configurations, the external hard disks would be recognized by the Pi. But sharing with Samba doesn’t work unless its been mounted. The below screenshot shows two external hard disks mounted to my Raspberry Pi ( and the mnt folder is still empty)
To mount the hard disk you had to add entries to “fstab” file located under “etc” folder. These requires the UUID of the disks that are attached to the pi. UUID of the disks can be identified by executing the command “sudo blkid” in the terminal . This would list out all the details of all the disks as shown below.
Add these UUID to fstab file by opening it in the leafpad editor by typing “sudo leafpad /etc/fstab“. The final output would be like the one shown below.
Reboot your Pi and now you can notice the disks mounted and accessible at the new path. Although i haven’t created the folders “ext” , “disk1” and “disk2”, this would be automatically created on the re-boot.
The below is the file explorer view of the mounted disks. ( The disks are moved from /media/pi as shown in first picture to /mnt/ext/)
Install samba by executing “sudo apt-get install samba samba-common-bin” command in terminal window. This would take couple of minutes to install
Edit the samba configuration file by opening the smb.conf file by executing “sudo leafpad /etc/samba/smb.conf” in the terminal.
Change the value of “wins support” at line number 28 to true and the value of “workgroup” at line number 41 to “WORKGROUP” or any other name.
The next step is to provide the file share details. Add the below lines to the bottom of the file as shown in the below image. Be sure to change the location and name highlighted.
Since , we have set “public=no’, we have to create a samba user account else the below step is not required. The below command executed in terminal would create a samba user account with name “pi” which would sync with the default “pi” account
“sudo smbpasswd -a pi“
Re-boot the Pi. That’s it. Now you would be in a position to view the files in your home network by accessing to \\name of the pi\the share name . In my case its \\pi2\homeNAS