Sunday, October 14, 2012

My DIY NAS (1)

I'm building my own NAS. A off-the-shelf NAS that has more than 4bays is pretty expensive, so I would rather build my own. To keep things cheap and flexible, I'll be installing Linux, and using software RAID.

The loot.
Case: Lian Li PC-Q25
PSU: Silverstone 400W
Processor: Intel Core i3 3220
Motherboard: Asus P8H77-I (it's mini-ITX)
RAM: 2x 4GB DDR3
HDD: 7x3TB 2.5" Toshiba (7200rpm)
HDD: 750GB 2.5" WD Black (7200rpm)
PCIe card: MSI Star SATA6 Expansion card (Marvell SE9128)

I didn't want to build one that is too big, so I opted for the PC-Q25 which is a ITX case. It can take in 7 3.5" drives and 1 2.5" drive, and has 2 case fans. The power draw required would probably be low. I'm wary of cheap PSU, while the Silverstone 400W might be a wee bit overkill. It has 3 4-pin molex and 4 SATA power pinout. I had to use the 4-pin molex splitter for the case fan -- the motherboard only has a single connection for  the case fan, while the casing takes in 3 4-pin molex for the 4 drives. 
The PSU has 3 4-pin molex. Needed to use a splitter.

The processor doesn't need to be that powerful, core i3 ought to be enough. The motherboard I chose has 6 SATA ports. Most ITX boards have only 4 or 5 ports. I wanted to max out the case, so I have added a PCIe SATA expansion card. I didn't need an expensive card that supported other features since I'll be running software RAID. After I installed Ubuntu 12.04, I did receive DRDY messages. Probably due to the NCQ errors for drives that were connected through the card. Didn't get the messages after I added GRUB_CMDLINE_LINUX_DEFAULT="libata.force=1:noncq libata.force=2:noncq"  to /etc/defaults/grub. I will elaborate more on this in my next post.

As for RAM, 8GB is probably overkill. But well, RAM is cheap...
Tight tight tight...
Initially I wanted to use a USB thumbdrive as the boot/root drive (for the OS), but it turned out to be unstable (sometimes I couldn't boot into it, sometimes it just loads and stops there). In the end I've gotten a 2.5" WD Black instead.

Ok, the hardware is set up, my next post(s) will be on setting up the software (Ubuntu 12.04LTS and other stuff).

Thursday, March 1, 2012

Some notes about getting started with Amazon AWS

I'm a noob in regards to AWS. Some of my notes here for a friend who will be using the AWS for his website. Please correct me if I'm wrong...

For a start, creating an instance is getting a machine for use. Going through the creation of a new instance (with the classic instance):
  • you need to choose a AMI (Amazon Machine Image). Basically it's a choice of operating system you need. In my case, I choose Amazon's Linux AMI (it's based off CentOS anyways).
  • choose the instance type. I'm a cheapo trying out the free tier - so it's a Micro instance for me. I have no preference for the availability zone.
  • I'll just have the default Kernel ID and RAM Disk ID. Tags (Key and Value) for the instance I'll just leave it blank for now.
  • Creating key pair if you don't have any that you want to use. It's important to (download and) keep the private key, as you will need it later on.
  • Configure security group. It's about the firewall policy for the machine. As I want just the Apache server service to be facing the internet, I'll just create a new security group and then add the Rule for SSH and HTTP. I'll just leave the source as it is for now (
  • Launch!

Other notes:

By default the public DNS for your instance is something like: If you prefer a nice public IP, you can get the Elastic IP:  
  • Allocate a new address
  • then associate the address with your instance
Note that you will need to pay if the address you obtained is not associated with any instance.
The Route 53 service is for more complicated use case. :)

Connecting to the instance when you got a Windows computer:
  • Grab the PuTTY and PuTTYgen software
  • PuTTYgen is needed cos you need to convert your private key (myprivatekey.pem) to a format which PuTTY can use
  • PuTTY to connect to your instance thru SSH
  • You can use Filezilla to connect (and upload files) to your instance. Need to add keyfile thru Edit > Settings > Connection > FTP > SFTP

To update the system and install the Apache and php:
sudo yum update
sudo yum install httpd php
The root folder for the website is in /var/www/html . You should be able to see a sample landing page at your instance's public DNS address.
Check out CentOS documentation/guides if you wanna do anything else which you are unsure of.

Persistent Storage:
Creating the instance (with Amazon's Linux AMI) would also create a 8GiB volume in the Elastic Block Store (EBS). This volume would be GONE if you terminate the instance. If you want something a more permanent store (other than S3), you can:
  • Create new volume
  • Attach the new volume to your running instance, which it will appear as /dev/sdX in the instance
  • which then i would use fdisk to create partition, mkfs for the filesystem, then mount it.
  • Edit /etc/fstab if you want the partition to be auto-mounted on start.
For the free tier, you have 30GiB of EBS to play around.

ElasticFox is pretty cool extension for Firefox. You need the credentials in order to access your aws panel. Citation:

That's it for now I guess.