Monday, April 18, 2016

Network Attached Storage (NAS)

We all work with computers. So the files we working, worked on, Pictures took, movies, software and other, all are stored on our computer. most of us have more than 75% of our hard disk filled. and office files, files requested by others are stored on our pen drive. we continue to work like that until computer started to give out notifications and warnings. only then we realized we should make some space in our computer. only option we have is to copy to external hard drive or delete some we collect dearly. some times the computer operation system get crashed due to some hardware or software malfunction or virus infection, then we lost every thing.
In offices they use a separate computer to store files called file server. file servers usually have fast processor, large memory and large capacity hard drive. the computer connect and access by others through computer. These sort of files servers are expensive and required high maintenance cost.
It is not economical to use expensive file servers for small office or a house. However there is a solution for that. Those are called Network Attached Storage or NAS in short. Both have similarities and differences as well.
when we take similarities both do same task, storing Files and provide access to. With advance technology both provide similar access speed.
Difference is the way providing access to files. In file servers connection between hard disk and network is done using software. Computer is operated on Operating system and another software operate on top of operation system establish the connection. But NAS on the other hand, have comparatively smaller software stored on a memory and and the program is called firmware. Due to the use of operating system File servers essentially have fast processor and large memory and fast access hard disk. therefore File servers use considerable electric power. On the other hand NAS need less electricity.




A NAS manufactured by NETGEAR(from Wikipedia)
Shall we talk about the NAS device made by me. The NAS was done by me using a Raspberry Pi. What is this Raspberry Pi ? Raspberry Pi is a small computer. Basically it has a slot to plug in a monitor, USB ports to connect a Key Board and a Mouse. Raspberry Pi was design primarily to work with a Linux based operation system known as Raspberian. Raspberry Pi has several version newest ones could operate by reduced version of  Microsoft Windows 10 operation system.
The Raspberry Pi, I used for NAS is a bit older version called Raspberry Pi model B. This Raspberry Pi has, HDMI out put and a Composite video out put, where newer versions have on only a HDMI port. Also the device consist with two USB ports and 26 pins to be used as a General purpose Input Output (GPIO). A SD Memory card used to input operating system to operate on.



 Raspberry Pi 1 Model B

Following are the list of things to assemble NAS.

Raspberry Pi 1 Model B with 8GB SD card
500GB SATA Hard Disk
SATA to USB convertor
5V Power Regulator
Plastic Box

Aditionally a cable with a micro USB cable to supply 5V power to Raspberry Pi and small cable with RJ45 jack and a RJ45 outlet was used.

All the Components used.

First a slot was cut to hold RJ45 outlet on one side of plastic box. And the outlet was fixed to that slot.






Also a round hall to fix 5V regulator......







The SD card was insert to Memory card slot of Raspberry Pi after copying operation system . The operation system used is Raspbian Wheezy edition of LinuxAs I was expecting to configure the NAS remotely a remote desktop sharing software was installed using following command.

sudo apt-get install xrdp 

This 'xrdp' software allow to access desktop of Raspberry Pi remotely using Remote Desktop Software over the network

Box was closed after fixing the hard disk firmly on the bottom of box using nuts and bolt and metal frame and wiring.







After powering up the device, 'Remote Desktop' software in Microsoft windows was used to log in to Raspberry Pi, to do rest of configurations.



 
Installing SAMBA software

sudo apt-get install samba
sudo apt-get install samba-common-bin

SAMBA is the access pint to the files on drive through internet. another word SAMBA is the file server software. with above two comands we have finished installing SAMBA on to Raspberry Pi.
Now we had to format the hard drive. 
I was using the same drive as external hard drive to my computer using SATA-USB converter for quite some times. therefore the file system already on the drive is NTFS. 
But, as the Raspberry Pi operating system based on Linux, it is better to use ext4 file system for the drive. one disadvantage of convertion is, in case Raspberry Pi is not working, I will not be able to plug the drive as external hard drive to computer to get access to files. 
for making new partion the command 'fdisk' used.





sudo fdisk /dev/sda


fist of all had to remove NTFS file format partion already in the drive. for removal used key 'd' to delete all existing partions. after that use key 'w' to save changes. this will also exit the utility program. again use same command to open software to create new partion. 
use key 'n' to create new partion. then use key 'p' to make new primary partion. press 'Enter' key to select default value as staring and ending cluster for new partition, if to use full disk. use key 'w' to save and exit utility software. 
now it is time to format new partion. following command used to format newly creation.

sudo mkfs.ext4 -L DATA /dev/sda1

the command format the partion in ext4 format and same time set disk label as 'DATA'.
At same time we make a folder named '/data'. and mount the new partion 'DATA' on to the folder. in order to mount drive at startup, we are adding following command to 'fstab' file in 'etc' folder.

LABEL=DATA /data ext4 defaults 0 2

Now have to configure SAMBA server, to share mounted folder with outside world. 
For that we have to goto instillation folded of SAMBA. Following command achieve task.

cd /etc/samba

All the configurations of SAMBA is on the file called 'smb.conf' on that folder. To open file to edit, following command is used. 

sudo nano smb.conf

This command allow to edit 'smb.conf' file. First go down the code list and change '# wins suport=no' under [global] as following.

wins suport=yes


go further down and remove '#' at the front of 'name resolve order' to active configuration. This allow the network to identify our drive. now we are almost finished the configuration. now it is time to identify mounted folder to SAMBA server as shared folder.
Go further down and find section 'share definition'. Add following after [homes].
 
[pi_share]

  path=/data
  public=yes
  browseable=yes
  create mask=0777
  directory mask=0777
  only guest=yes
  read only=no

This conclude configuration, save the file and exit.Restart the Raspberry Pi.
Goto the computer and look under, network folder. it show some thing similar to this.





I thought every thing is finished, but it was not. Cover I smell something burning. Hard disk got heated up due to no ventilation. So cooling fan of old DELL power supply was fixed in. and small holes were made both sides to support air circulation.



 
Now everything all right. But the fan produce loud sound when operate. The DELL power supply has a resistive temperature sensor. I make a circuit to increase speed of fan depending on the temperature. The sensor was fixed on to body of hard disk.






Now every thing is ready. I copy all the movies on my computer to NAS....

What are the advantages and disadvantages of Raspberry Pi NAS  device ?
One advantages are low cost and low power requirement. If decide to buy every thing, it will be cost around Rs. 20,000 to Rs. 25,000. Power requirement varied between 10W to 15W. It will required around 7.2KWh to 10.8KWh to operate for month around the clock. It is very less compared to 360KWh required by File server with 500W power supply.

The disadvantage is the low data transfer speed. Normally the data transfer speed vary between 6Mbps to 1Mbps. But I think it is fair for use in a house.


මෙම ලිපියෙහි සිංහල පරිවර්තනය සඳහා පිවිසෙන ඉලෙක්ට්‍රොනික ලෝකය  
 

Sunday, April 10, 2016

Hello - Introduction

I was introduced to the world of Blog by my unseen Australian friend Rosheni. Since 2009, we chat about many things. we discussed, argued, teach each other about many things. One day she send me a link to visit. that was the day I visit a blog. It was a link to Katandara's blog. Since then she send me links to Mathalan's, Maraya's blog posts time to time.
One evening when we chat she told me ' I'm grieving  today. Today is a dark day to Sinhalese Blog world'. That is the day lovely 'Oba maama' (Obaa uncle) leave us all. I request the link to his blog and begin to read. I was very fond of his blog, and finish reading all the blog posts on the down of next day. I do not know him, but I could tell he was very dearest, sweet and joyful man by reading his blog and the comments put for him.
I'm reading blogs ever since.'Marayage Horawa', 'Maathalan', 'Nidahas Situwili', 'Sansare Api' are the blogs I visit most frequently. Recently I start reading 'Kenjige Kolama'. How ever I visit other blogs when I could.
After reading blogs for years and start commenting for around 6 months, I was thinking about start writings blog. But I was wondering what should I write. So I decide to write about my favorite subject Electronic Science. Since I was doing final year Electronic project for student in Universities. I'm going to present you these projects. And also hope to write about theories of Electronic.

(There is also a blog in Sinhalese language I'm writing about the same subject. This blog will be a translation in English of that blog. Since I'm not very good in English there might be mistakes. So I request you to point me out those mistakes.)

For the original post visit : ඉලෙක්ට්‍රොනික ලෝකය