Pages

Showing posts with label Technology / Computing. Show all posts
Showing posts with label Technology / Computing. Show all posts

Friday, August 3, 2012

Why I Chose Unraid for my Home Storage Solution

Unraid

Description

Unraid is a Slackware Linux based operating system that provides an easy way to create network attached redundant storage. It's best suited for archival purposes. It allows for the loss of one disk without losing data.

Unraid has three different licenses you can use, Basic (free), Plus ($69), and Pro ($119). Look at the license page for a description on how they differ.

Advantages

  • Runs off of a USB flash drive. You don't lose a SATA port or disk for the operating system.
  • Mix and match hard drives and sizes. You can put drives of any size in the array. You only lose the largest disk in the array for parity. (Similar to a Drobo)
  • Web interface. A simple web interface lets you configure everything.
  • Supports various protocols including SMB, AFP, and NFS.
  • No vendor lock-in. Although you're using the proprietary Unraid system, all data is stored on the disks in the ReiserFS filesystem
  • Since it's using ReiserFS, if you lose more than one disk at a time you'll be able to get data off the rest of the disks in the broken array.
  • Use your own hardware. I built a little server with an Atom processor for less than the price of the cheapest Drobo.
  • Set it and forget it. I've had my system running for almost two years
  • Stable. I set mine up and have basically forgotten about it. It just works and has been since May 2011 when I configured it.
  • Spins down drives when not in use, unlike RAID-5.
  • Support and community. There's a very active forum and wiki to help you with any issues, add additional functionality, and much more.

Disadvantages

  • Price could be. I purchased the $70 license. If you only have 3 disks and don't require some of the extra features, there is a free version.
  • Write speeds. If you have the need to push stuff to the server at more than 30MB/sec, this may not be the best choice. If you're just archiving stuff, it really is not an issue. You can also speed the writes up with a cache drive.

Why I Chose Unraid

Throughout my history of having redundant storage at home I've had two previous setups that really failed me.

Linux Software RAID-5

Linux software RAID is great, but I had two drives fail at once. I lost everything. With Unraid I would've been able to recover some of the data on the drives that had not failed. You also cannot mix and match drive sizes and the disks never spin down.

Drobo

I had the second generation Firewire 800 Drobo. Transfer speeds were horrible. It still needed a computer running to serve data. I accidentally plugged the wrong power supply into it and it stopped working. I was now stuck buying another expensive Drobo to get my data or coming up with another solution. That is when I found Unraid.

The Drobo is actually a really nice device. The newer ones are supposed to be a lot faster and some even have sharing capabilities. It's just too expensive and they've got you with vendor lock-in.

Links

If I haven't sold it to you yet, here's a few links to learn more about Unraid.

Wednesday, August 24, 2011

Configure PhpStorm to Auto-complete CakePHP Models, Views, and Controllers

After playing around a bit today I finally figured out how to get PhpStorm to auto-complete methods for models and controllers. Here's what you need to do.

Removing Multiple Definitions


First, let's tackle the multiple definitions problem that we see below.

Multiple Definitions


There are multiple places defining AppController. We need to remove the ones that are included in the following locations from our 'Directories' in the project's settings.

The two locations are:
  • $CAKEHOME/cake/console
  • $CAKEHOME/cake/tests
Exclude Directories


Next we need to mark the following file as plain text.
  • $CAKEHOME/cake/libs/controllers/app_controller.php
Mark as Plain Text


You should now see that PhpStorm is no longer complaining about multiple definitions. If it is you may want to check your plugins/components to see if they're mucking it up. If they are, just mark the file with the definition as plain text.

Multiple Definitions Resolved


Auto-completion should now work for the controller. However, it's still not working correctly on our model.

Autocomplete works, but not on the model.


Adding the Model


To fix the model we need to add a magic property to the class.

 /**  
 *@property ModelName $ModelName  
 */  

Here's an example from the controller we've been working in.

@property ModelName $ModelName


 We can now auto-complete on our models in the controller.

Auto-complete on the model.


Defining Model Relationships


Lastly, we need to add magic properties to our models to define its relationships with other models. Basically, for each "belongs to" relationship defined in the model's file you need to add the magic property comment.

Define belongs to relationships


We can now auto-complete these relationships.

Auto-complete model relationships


Setting Up Helper Auto-completion in Views


To get auto-completion working in views we need to include a file created by junichi11 over at GitHub.

Download this file and save it in a directory somewhere outside of your current project. I did this so I could use the same file on multiple projects.
Now add that directory to your current project.

Open a view file and add the following variable definition.

 /**  
 *@var $this View  
 */  


You should now be able to auto-complete helpers in your view!

Auto-completion of helpers


Core Component Auto-Completion


Add the following to your app_controller.php file and this will add component auto-completion.

 /**  
  * CakePHP Component & Model Code Completion  
  * @author junichi11  
  *  
  * ==============================================  
  * CakePHP Core Components  
  * ==============================================  
  * @property AuthComponent $Auth  
  * @property AclComponent $Acl  
  * @property CookieComponent $Cookie  
  * @property EmailComponent $Email  
  * @property RequestHandlerComponent $RequestHandler  
  * @property SecurityComponent $Security  
  * @property SessionComponent $Session  
  */  

Wednesday, April 21, 2010

SABnzbd URL Bookmarklet (NZBMatrix)

Here's a simple bookmarklet that will take the URL of the current page you're on and tell SABnzbd to download it. It works great if you're using NZBMatrix and on the page for the post you're wanting to download. Perfect for your mobile browser.

javascript:location.href='http://yourhost:8080/api?mode=addurl&name='+encodeURIComponent(location.href)+'&apikey=yourapikey';  

Be sure to insert your SABnzbd API key and hostname (or IP address) into the bookmarklet's code.

Wednesday, June 24, 2009

HOWTO: Set the SSHD Idle Timeout

Here's something that I usually forget to change from the default and then get annoyed when my terminal hangs.
  1. As root open your sshd_config file in an editor.
    su -  
    vim /etc/ssh/sshd_config  
    

  2. Add the following lines.
     ClientAliveInterval 600  
     ClientAliveCountMax 3

  3. Restart the sshd process.
     service sshd restart
That's it. That will keep you logged in for 30 minutes at a time without activity. (600 seconds x 3)

Saturday, April 4, 2009

M3U Playlist Copy Script

A couple of months ago I picked up a Garmin Nuvi 760 on the cheap. As it turns out this great GPS unit can also play music quite well, especially for riding on the motorcycle. The only problem was there was no good way to get playlists on the device that I could find. Enter the following bash script. This script will read an m3u file, copy all associated mp3 files, and generate a new m3u file. Now all I have to do is specifiy m3u files that I exported from Mozilla Songbird and the path to the Garmin's SD card.

 #!/bin/bash  
 # April 4, 2009  
 # m3u_cp.sh  
 #  
 # Take an m3u file and copy all associated mp3 files  
 # to a destination directory and generate a new m3u.  
 #  
 # Used to copy m3u playlists from computer to Garmin.  
 if [ $# -lt 2 ]; then  
 echo "Usage: m3u_cp.sh some.m3u /dst"  
 exit 0  
 fi  
 # Read the m3u file into an array  
 declare -a M3U  
 exec 10<"$1"  
 let count=0  
 while read LINE <&10; do  
 M3U[$count]=$LINE  
 ((count++))  
 done  
 exec 10>&-  
 # Determine the m3u's filename  
 if [[ $1 =~ [^/]*m3u ]]; then  
 m3u_path="$2/$BASH_REMATCH"  
 fi  
 # If playlist arleady exists, delete it  
 if [ -f "$m3u_path" ]; then  
 rm -f "$m3u_path"  
 fi  
 # Loop through the m3u lines  
 i=0  
 while [ $i -lt ${#M3U[@]} ]; do  
 # The current line is a comment, do nothing with it  
 if [ ${M3U[$i]:0:1} = "#" ]; then  
 echo ${M3U[$i]} >> "$m3u_path"  
 #Current line is a path to an mp3 file  
 else  
 # Get the current songs filename  
 if [[ ${M3U[$i]} =~ [^/]*mp3 ]]; then  
 song=$BASH_REMATCH  
 mpath=$( echo ${M3U[$i]} | tr -d '\r' )  
 # if the song doesn't exist, copy it to the desitnation folder  
 if [ -f "$2/$song" ]; then  
 echo File Exists -- $song  
 else  
 echo Copying -- $song  
 cp "$mpath" "$2/$song"  
 fi  
 # Write the song in the m3u file  
 echo $song >> "$m3u_path"  
 else  
 echo "The regex for finding the song's filename is fraked up."  
 fi  
 fi  
 let i=i+1  
 done  
 exit 0  

In the middle of writing this I really started wondering why I used bash. Perl would've been a lot easier.

Friday, June 27, 2008

HTTP to HTTPS Forwards Please

Why do some sites that require a secure connection not automatically forward you to the secure site? How hard is it to do? Not very! (with Apache at least)

 #How about a simple .htaccess file in the webroot?  
 #Force SSL for example.hwarf.com  
 RewriteEngine On  
 RewriteBase /  
 RewriteCond %{HTTPS} !=on  
 RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

Hopefully some sites will pay attention to this. I'm not mentioning any URLs.

Friday, May 30, 2008

Time Warner Cable / Road Runner - The Rip Off

After 6 months with Time Warner Cable's Road Runner Internet service at home I was hit with a nice surprise. Month 7th would cost me $70.95, instead of the $44.95 that was/is advertised on their site. For some reason my location does not get their standard pricing. While my initial service was great, below I've identified some issues I have with Time Warner that has led me to cancel my account.
  • Their 800 Number - Whenever I try to call their customer support number I have to call at least five to ten times to get through. For some reason I keep getting a busy signal. Annoying!

  • Hold Times - It takes about 10-15 minutes to get someone on the phone. I really wish I would've bought a speakerphone.

  • Getting Bounced Around - During my first of three calls I was bounced around to three different operators that could not help me. However, before I reached the third person I was conveniently lost in phone-space and had to call back.

  • Lack of Logic - There was no good explanation as to why the Road Runner service costs so much more in my area than someone who lives a couple miles from me.

  • Customer Support Staff - While the staff was very nice, they were unable to help me. It was quite frustrating having someone tell me, "I agree that $70.95 is ridiculous and I have no idea why it is priced that way. I can understand why you would want to cancel."
As of next week I will no longer be a Road Runner customer and have since signed up with the Windstream Greenstreak service. The biggest disappointment about their DSL service is that they claim I only qualify for 3Mbps service. After living with 7Mbps and 15Mbps for the last year and a half, 3Mbps is going to feel pretty slow. I guess no more streaming HD movies from the iTunes store to the AppleTV.

Wednesday, February 27, 2008

Googlebot and FreeDNS from afraid.org

Back on January 8th I canceled my Dreamhost account and began hosting my site off of my cable modem. Only receiving ~15 hits a day I figured I might as well save myself $120 a year. So I chose freedns.afraid.org to host my DNS. They were free and had all the options that I wanted, including working with Tomato.

After the switch I noticed that my traffic had declined dramatically, down to ~1 hit per day. So I starting doing a bit of investigating and found that Google was no longer crawling my site and had deleted my previous results. Logging into the Google Webmaster Tools I found that Google was having DNS issues connecting to my site. Well, after pulling my hair out for an evening I found that FreeDNS was blocking the googlebot from crawling my site.

Solution: I have switched my DNS provider to ZoneEdit. ZoneEdit offers similar features to that of FreeDNS. Now Google can access my site again, but I'm no longer in the results for some searches. I guess it will take some time. Yahoo and Live search were totally unaffected by FreeDNS.

So this is a warning to all people using FreeDNS and want Google to crawl their site.

Thursday, February 21, 2008

Installing Netbackup Enterprise Server 6.5 on CentOS 5 / RHEL 5 withSELinux

It took me almost a whole day to come up with this solution. This should get Veritas Netbackup Enterprise Server 6.5 up and running on a CentOS 5 / RHEL 5 box with SELinux enabled.


HOWTO: Server

  1. Install a couple of dependencies:
    yum install compat-libstdc++-296 xinetd libXp 

  2. Make sure that the hostname is set correctly. This is very important.

  3. Temporarily disable SELinux:
    setenforce 0

  4. Untar the installation files:
    tar xvf NetBackup_6.5_LinuxRedhat2.6.tar.gz
    tar xvf NetBackup_6.5_ICS_LinuxX86.tar.gz

  5. Start the installation:
     ./NB_65_LinuxR_x86_20070723/install
    .....
    #ICS Directory: ./NB_65_ICS_1.4.37.0_LinuxX86/


  6. Fix SELinux:
    chcon -t textrel_shlib_t /usr/openv/lib/*
    setenforce 1


  7. Start Netbackup:
    /etc/init.d/netbackup start

HOWTO: Client

  1. Untar the installation file:
    tar xvf NetBackup_6.5_CLIENTS2.tar.gz

  2. Start the installation:
    NB_65_CLIENTS2_20070723/install

  3. Fix SELinux issues:
    chcon -t textrel_shlib_t /usr/openv/lib/*

  4. Start the client:
    /etc/init.d/nbclient start