Tuesday, May 12, 2020

NASPi - NAS Server with Raspberry Pi

After more than 8 years, I decided to retire my old Edimax NAS with something better, faster, quieter, colder and energy-efficienter solution. Possible candidate were Synology 218+, currently perhaps the best NAS device for home usage, but price without hard disks is a little too high (ca 320€), and than you need to buy two NAS hdds, for example WD Red or something like that. And price comes on to 500+ €. This was too much for my budget. There are, of course, cheaper devices like Synology 218 or 218j, but I wanted the best model.
 
= >
 

These days, a new version of Raspberry Pi with 4 GB RAM, Gigabit Ethernet and USB 3.0 come to me, and I wanted to try it for NAS purpose with SSD discs. Tried OpenMediaVault with discs connected direct over USB ports, but from some reason thing hasn't work. Then I found external USB case with 2 bays for 2.5" discs and RAID support - ICY BOX IB-RD2253-U31. This thing is made for Windows and doesn't support EXT3/EXT4 file system but just NTFS, and while OpenMediaVault doesn't support NTFS, a had to renounce OMV and to find some other possibility. ICY BOX case has its own power adapter, but I changed it with USB adapter, so I could power both devices - Raspberry Pi and IcyBox with one double USB charger of 2,5A.

So, finally I made it with Samba. For the first, of course, it is important to update the system and mount the disc unit:

sudo apt-get updatecd 
sudo apt-get upgrade

sudo fdisk -l

sudo mkdir /media/pi/IcyBox
sudo mount -t ntfs /dev/sda1 /media/pi/IcyBox

Now, second step is to install Samba software:

sudo apt-get install samba samba-common-bin


Third step is to configure Samba editing "smb.conf" file and under Share Definitions make our section icyboxpi (you can give some other name):

sudo nano /etc/samba/smb.conf

#======================= Share Definitions =======================
[icyboxpi]
path = /media/pi/IcyBox
writeable=Yes
create mask=0777
directory mask=0777
public=no

This options are pretty clear - writeable = Yes if you want to write in this folder, otherwise should be No; public is no if you want to access to the folder with username and password. After change you need to save changes and close the editor. Next you need to add your pi user with password to Samba:

sudo smbpasswd -a pi

Then, restart Samba share:

sudo system ctl restart smbd

Our Samba share is ready to serve the files through the network. If you don't know machine name or IP Address of your Raspberry Pi, you get it with hostname (machine name) or hostname -I (IP Address). Now, you need just to map your network share and assign drive letter:

1. Right click on MyComputer => Map network drive...

2. Choose wanted drive letter and assign path to the folder:
3. Enter your credentials (username and password given with smbpasswd command).

That's it. Now you can use your RaspberryPi Nas.

Enjoy!!!










No comments:

Post a Comment