Monday, November 26, 2012

DIY simple NAS on budget

Please note, that this is not intended as detailed plan how to do NAS.  But you might find useful idea or two when reading my rant.

    


OK, I admit - it happened to me also. WD Passport which was used as external drive, started to die. Seems it was slow and painful death, since at first it became terribily slow and it took ages for it to be available in operating system. For all, that are not familiar with WD Passport, it is external HDD that connects to computer trough USB. Thing was just out of warranty. After I opened it, there was WD green 1TB HDD in there. I hoped that controller could be used with another hard drive, but it seems that is not so simple for my specific model. I am not completely certain why, since I did not have much time to investigate this further. But I suspect, that there is "special" partition on HDD that make possible to use controller with HDD. So new HDD without this partition won't work with USB controller.
Anyway, as soon as problems were evident, I connected this drive to computer running Fedora operating system and right away OS informed me that S.M.A.R.T. status of device looks bad. Microsoft: why don't you add this functionality in a Windows operating system? I think it would save user or two a lot of time.
Anyway, what is done is done. Next step was copying everything from faulty HDD to another one in order to save data. It took about 3 weeks of day to day copying to save few 100 GB of data, but in the end, everything important is saved! YES!

OK, since this was sort of lesson to me, I decided to get myself NAS to use it as backup for important data. After further price checking and check of computer parts "inventory" at home I decided to built NAS by myself. And that is also good opportunity to defend my collecting of old computer parts at home! ;-)
Also, since data safety is most important I went for mirroring of 2 drives in my NAS.


So, what I had at home?

  • 2GBs of RAM
  • Athlon 64 X2 5000+
  • mini ITX motherboard IEI Kino-690AM2
What I needed?
  • Hard drives
  • system drive
  • power supply
  • chassis
After little investigation I decided to go with WD RED HDDs, which were developed especially for NAS and RAID.
For system I have chosen 4GB USB thumb drive.
Power supply I have chosen FLEX ATX from Seasonic - model SS-250SU.
So, once I had all hardware, I started to think about chassis. Since this was budget project I wanted to spend as little as possible. So in the end I decided to built extremely simple chassis by myself.


Top view - you can see part of HDD cage here
I  used 3mm sandwich panel, known also as  aluminium composite plate. This was lying around and material is very easy to work with and it is strong enough for what I used it for. I simpy cut two panels and screwed motherboard and power supply on one panel. For HDDs I took HDD cage from old computer chassis I had lying around. I had to cut it little bit, but in the end it does its job very good. Both panels are joined together with long screws and I made spacers from alu tube.





Connections view - you can see tiny USB drive

I admit that my computer parts are not most power saving and definitely I would chose passively cooled motherboard if I would buy components. But since this is primarily meant as backup storage it does not run all the time. I just turn it on when I need it. Because it is capable of WOL, I can put it in remote location in apartment and as long as there is network connection and power, it will work. So it is not silent and it its power consumption is not greatest. On the other hand it was cheapest solution for me, since I had few components at hand already and I was able to built chassis for peanuts. Good news is also, that motherboard has dual Gb LAN ports, so if I upgrade home network, everything will work faster.
Regarding NAS software, I used FreeNAS. It is quiet easy to set up, even for first time user, as myself. Interesting thing was, that altough I set RAID in BIOS, FreeNAS found 2 hard drives and I had to set both drives as Mirror in FreeNAS settings. I also had some minor problems with user rights, but managed to solve them quickly.
So far I am happy with my solution and hope it will work longer and more reliably as WD passport HDD.



Spacer can be also used as handle to carry NAS.

Wednesday, July 18, 2012

CPU hunger or how I met Mr. Wordpress

One of my hobbies is also web page design and developement. I also like idea of open source, so I tend to use joomla as my main web page platform. But sure, there are instances, when some other solutions are more suited to users.
So, lately,  customer had need for more "blogging" approach to a web page. So, I decided to give a try to a Wordpress. Installation was super easy. Administrator section is straight forward and really "click'n play". So, I created nice theme, choose needed plugins and we were up and running in no time! Users found adding articles very easy, translation in our language was available from a start. I created nice simple tutorial for users and tought this is done deal!
Man, was I wrong.
After a few months, I got mail from hosting company that CPU usage is too high for this page and they limited CPU usage. So, we had a lot of "page non available" problems etc.
So, research started.
First thing I noticed is, that customer added a lot of galleries on a front page and it seems that plugin I chose made a mess of CPU. So, firstly I removed plugin. Actually I could not do it trough administrator console, since page was not acessible. I simply removed folder with plugin trough FTP. Wordpress is "smart" enough that it notice plugin folder missing and does not make any fuss of it. So, at least this is good. And that is also one hint for all you avid readers.
Anyway, after deletion of plugin, page was at least acessible again and CPU usage went down little bit. Next thing I learned is, that wordpress comes with absolutely no caching or any web page optimization. So I installed additional plugin which take care of optimization. And I replaced galllery plugin with another one, which seems to do fine.

So, what to write in conclusion?
On one hand it seems Wordpress could use some code optimization and they should built some sort of caching in it. But on the other hand it is extremly user friendly. Which is big +.
Use with caution.