Monday, November 14, 2011

Creative Orphans

I happen to have a Sound Blaster Audigy 2 ZS Platinum Pro that my wife had gotten me for Christmas of 2003.  At the time, it was the best you could get.  And it was (and still is) a great piece of hardware.

But anyone who has owned anything from Creative knows how quickly they orphan their products.  And as a guy who can't throw anything working away, I couldn't do it with this sound card.  (Especially knowing how much my wife paid for it back in the day...)

Now, I'll admit it's not flawless, but the latest OEM drivers from Creative gets this card working well in Windows 7.

But I found this really great blog about Creative Sound cards.  If anyone is having problems with theirs, I direct you to No More Goat Soup.

When it rains in Thailand...

As part of my NAS project, I was intending to get it working before investing in filling it full of hard-drives (since they would be the single most expensive part of making it a reality.)

Two months ago when I was pricing out hard drives, I had found a Western Digital Caviar Green 2TB drive for about $70 bucks. I was thinking of buying two of them. But I thought with Christmas on the horizon, it would be a good thing to ask for as a gift.

I recently went to see how the prices were going into Black Friday. Much to my surprise, the same drive is currently running $250 on Newegg! More than 3 times what it was two months ago. I couldn't believe it.

At first, I thought it was an artificial price increase to give an appearance of a sale during the holiday season. However, a friend of mine pointed me to this article:


Awesome. Now I have to wait 6-12 months. Maybe Christmas next year.

By the way, the graph was produced at camelcamelcamel.com.  It's pretty sweet.  All you have to do is paste a link from any product on Amazon.com and it will give you the price history.  Happy shopping.


Tuesday, October 25, 2011

FreeNAS Breakthrough

Essentially, I had two options: copy a file called if_re.ko to the right place and edit the kernel boot configuration file, or recompile my kernel.

I really didn't want to have to perform that second option. And even if I wanted to, I couldn't even find the kernel source code in my system files.

But I didn't have the 'if_re.ko' file either. I just had the source code.

But I bet the internet does! Sure enough searching for if_re.ko yielded this site.

Yippie! I downloaded it and followed the instructions, looked up some vi commands for editing the boot configuration file and BAM! Had the module loaded, and on the next reboot my NAS was recognized on the network!

One slight comment, is that my FreeNAS file system was built on / not /cf. So when she says to copy the file to /cf/boot/kernel, mine was just /boot/kernel. But other than that, it was spot on.

Now, I still haven't gotten the speeds I was anticipating, so I'm still troubleshooting that. But they did improve. I think in actuality I'm being limited by my old hard drives that I kept in there to troubleshoot the system. I still need to get some decent sata drives in there and make sure my PCI-SATA card is working properly. I think I'll see some decent speeds once I get there, but I don't have any extra sata drives around to try it out. I figure that would make a great Christmas present: a couple of 2 TB sata drives for my NAS.

So, as much as a challenge this project ended up being, it was fulfilling to get back to some command line stuff and editing the kernel. It certainly made me feel pretty confident in my computer hacking skills. And I found a great use for some old hardware so I didn't have to throw it out.

I also found some advantages to building a NAS this way. Granted, I have to power another computer (a fact my dad was quick to point out.) However, I quickly found out, that there are some great hard drive diagnostic tools built into FreeNAS. Case in point, I have some friends that had some issues with a hard drive and needed some help getting some family photos off it. They couldn't do it with Windows. However, I was easily able to slap this drive in my NAS, run some diagnostics, mount it, and copy their files over to another usb drive for them. It's nice to have that kind of capability around. Just sayin'.

Now on to the next project.

DHCPDISCOVER, DHCPOFFER, DHCPREQUEST, REPEAT

Upon installation of the new network card, I figured it would be pretty easy going given the reviews online specifically for FreeNAS. But for some reason, I was having trouble getting an IP address. And whenever it did, it would loose it when rebooted for what seemed like 24 hours before I could get another one. Even configuring a static IP did the same thing. Weird.

I checked everything on my router and it seemed fine.
Again, this is where consulting the FreeBSD documentation came in handy. I learned two important command-line commands for trouble shooting this problem:
dhclient
ifconfig

Using these, I was able to log into the shell and configure the network adapter manually and monitor the responses.

dhclient did this:
DHCPDISCOVER some junk
DHCPDISCOVER some junk
DHCPDISCOVER some junk
DHCPOFFER from host junk
DHCPREQUEST some junk

Then it would repeat until I unplugged the cable to get it to stop.

According to this, my FreeNAS was finding the DHCP server, getting an offer, requesting it, but not being acknowledged and went back to looking for a DHCP server. Strange.

And being I already troubleshot the router, it became apparent that it was my new gigabit network card that was suspect.

Checking the hardware documentation (remember that from a previous post?) it said that the re(4) driver would cover the RTL811xS chipset. Mine was coming up as re(0). I didn't know what that meant, if my network adapter was being recognized differently. But I was starting to think this might be the problem: FreeBSD drivers for my hardware.

I went to the Realtek website and found they had drivers for FreeBSD. That being said, I thought, I'll try it and see if it works.

I downloaded the tarball, saved it to a usb drive, then stuck it in my FreeNAS box and booted it up. This is when I discovered that mounting a usb drive in FreeBSD is different than other Linux flavors. For FreeBSD you have to use mount_msdosfs. Then you'd mount it just as you would in any other Linux distribution.

Once mounted, I checked the tarball to see what was in it:
rtl_bsd_drv/if_re.c
rtl_bsd_drv/if_re.h
rtl_bsd_drv/Makefile
rtl_bsd_drv/Readme.txt

I then extracted the source code (the .c file), the header file (the .h file), the Makefile, and the readme to the FreeNAS file system. To read the Readme, I copied it back to the usb drive and opened it on my Windows 7 machine. Blank.

Darn it all.

Explaining this all to a co-worker the next day, he told me about VI. Just search it in Google.

Using the command: vi readme.txt I was able to open it and read it. The text that follows is from the Readme.txt for the driver:

This driver is modified by Realtek Semiconductor corp. and it has been tested OK on FreeBSD v5.4, FreeBSD v6.4, FreeBSD v7.3, and FreeBSD v8.0. To update the driver, you may use method 1. If method 1 failed, you must use method 2 which is more complex.

Method 1:
1.Copy if_re.ko in "modules" directory to "/modules" directory and overwrite the existing file.

2.Modify the file"/boot/defaults/loader.conf" and set "if_re_load" in "Network driver" section to "Yes"

3.Reboot.

Method 2:
Because the FreeBSD kernel has default drivers to support RTL8139C and RTL8169S. To use the RTL8139C+, RTL8169SB, RTL8169SC, RTL8168B, and RTL8101E, you need to update your NIC driver by recompiling your FreeBSD kernel.

The main steps you have to do:(FreeBSDSrcDir means the directory of FreeBSD source code and it may be "/usr/src/sys")

1. keep the original driver source code:

# cd /usr/src/sys/dev/re
# cp if_re.c if _re.c.org
# cd /usr/src/sys/modules
# cp Makefile Makefile.org
# cd /usr/src/sys/modules/re
# cp Makefile Makefile.org
# cd /usr/src/sys/i386/conf/
# cp GENERIC GENERIC.org

2. Recompile your kernel (you must install your FreeBSD souce code first!!)

# vim /usr/src/sys/i386/conf/GENERIC/ and delete re
# vim /usr/src/sys/modules/Makefile and delete re
# cd /usr/src/sys/i386/conf
# /usr/sbin/config GENERIC

(for FreeBSD 5.x/6.x/7.x/8.x)
# cd ../compile/GENERIC
(for FreeBSD 4.x)
# cd ../../compile/GENERIC

# make depend
# make
# make install
# reboot

3.update the driver source code:

Copy the driver source code ( if_re.c and if_rereg.h) into /usr/src/sys/dev/re

Copy the Makefile into /usr/src/sys/modules/re

4. build the driver:

# cd /usr/src/sys/modules/re
# make clean
# make
# cdif

5. install the driver

# cd /usr/src/sys/modules/re
# kldload ./if_re.ko

6. configurate the static IP address

# ifconfig re0 xxx.xxx.xxx.xxx

7. configurate the IP address by DHCP

# /sbin/dhclient re0

The user can use the following command to change link speed and duplexmode.

1. For auto negotiation,

# ifconfig re media autoselect

2. For 1000Mbps full-duplex,

# ifconfig re media 1000baseTX mediaopt full-duplex

3. For 100Mbps full-duplex,

# ifconfig re media 100baseTX mediaopt full-duplex

4. For 100Mbps half-duplex,

# ifconfig re media 100baseTX -mediaopt full-duplex

5. For 10Mbps full-duplex,

# ifconfig re media 10baseT/UTP mediaopt full-duplex

6. For 10Mbps half-duplex,

# ifconfig re media 10baseT/UTP -mediaopt full-duplex

1 Byte = 8 bits

Upon seeing the 12MB/sec transfer rate I was able to do a quick calculation

12MB/sec x 8bits/Byte = 96Mbits/sec

At this point I realized that I was being limited by my network. (100Mb). Notice the small b for bits. Not bytes (big B). I checked out my specs on my motherboard just to be sure:

According to the User's Manual, the PCI bus is cabable of 133MB/sec, and the IDE channels support 100MB/sec. My Intel Pro 10/100 is only capable of 100Mb/sec (or 12.5MB/sec.)

That being said, I decided to upgrade to gigabit ethernet (or 1000Mb/sec, or 125MB/sec) and purchased these items:

http://www.newegg.com/Product/Product.aspx?Item=N82E16833166017
http://www.newegg.com/Product/Product.aspx?Item=N82E16816132013

Later I realized that I needed to upgrade my switch, another network adapter on another computer, as well as add some cables and purchased these:

Two switches
Gigabit Network Interface Card (PCI)
Cables

I needed two switches so that I have a direct gigabit route from one PC to the next. In other words, previously I had just used the built in switch on my router (which is provided by my internet provider, and I can't change it because I get TV over IP through it too...) But since the router is only capable of 100Mb/sec in order to not bottle-neck my network through the router, I needed a gigabit switch right next to it. Then when say my pc talks to my FreeNAS, it doesn't need to go through the router just my PC to a switch at my desk, to the switch near the router, to the FreeNAS. As opposed to my PC to a switch, to the slow router/switch, to my FreeNAS. Then the internet/router plugs into the switch near it. Super easy.

Another note, the Roswill RC400-EX and the Startech ST1000BT32, were exactly the same (other than the quality control sticker on them.) They're both based on the Realtek RTL8110SC chipset. So get the cheaper one. They're the same.

As I purchased these, I was careful: I searched the reviews of these items to ensure they worked with FreeNAS. And it seemed there were plenty of people doing what I was doing and left reviews verifying that these network cards work with FreeNAS without much effort. Awesome.

But for some reason, I wasn't so lucky.

Thursday, October 20, 2011

Old hardwares die hard

This past September I came across this great little article. Which took me to this one.

A NAS (Network Attached Storage) sounded like a great idea for my wife's old computer.

I researched it a little more at the following websites:
How I Set Up a Home File Server For Free - A Review of FreeNAS
FreeNAS project website

One of the more important things to realize is that FreeNAS is built on FreeBSD. I found that visiting their documentation site proved quite valuable in taking on this project, particularly the hardware compatibility list for the version of FreeBSD my particular version of FreeNAS is derived from. I decided to use FreeNAS 0.7.2.7903 (the latest stable build at the time) which when I was finally able to boot from the CD I discovered it was built on FreeBSD 7.3. (Note there's really no correlation between FreeBSD release numbers and FreeNAS release numbers.)

That being said, I went to FreeBSD releases page and clicked on the hardware notes for FreeBSD 7.3 to ensure the hardware I was running was compatible (i.e. built in drivers.) (FYI - The little devil caricature for FreeBSD was designed by John Lasseter from Pixar...)

Now, I had experimented with Linux in the past and knew that finding and installing drivers can be a nightmare. But as far as I could tell, everything looked compatible with what I had.

Right....

The first problem I had, was that I couldn't boot from the CD. And the boot process would sometimes get further along than other times. And it didn't matter what I booted from, whether it was a Windows, Linux or FreeNAS boot CD. It was strangely intermittent. It would try to boot from the CD, but eventually it hang up the machine on install.

Describing this problem to a coworker the next day, he suggested maybe my optical drive is done for.

Sure enough, swapping my Mitsumi CR-4802TE with an optical drive from my XP machine fixed that problem. And I was finally able to boot from the CD. Any CD. Now I've got a pretty much useless optical drive. That has a nice stepper motor in it....and a laser.... hmm...future project maybe? We'll see...anyways...on with my FreeNAS project.

Once I had FreeNAS up and running off the live CD, I wanted to install it on an old USB drive and boot from it. Normally, that means selecting to boot from it in the BIOS. But of course my hardware was so old, it was before USB drives were really popular. My options:
USB-FDD (Floppy-not enough space for FreeNAS)
USB-ZIP (Remember zip disks?)

After struggling with this for a few days I found the following helpful sites:
http://www.freenaskb.info/kb/?View=entry&EntryID=157
http://www.pendrivelinux.com/booting-linux-from-usb-zip-on-older-systems/
http://www.pendrivelinux.com/testing-your-system-for-usb-boot-compatibility/

After trying all of these things, I gave up on trying to boot from a USB drive with my hardware. Mostly because the compatibility test didn't work. And just to be sure, I loaded Ubuntu 11.4 on a live CD (now that the CD drive was replaced....) and followed the directions to make my USB drive like a USB-ZIP disk. Which also didn't work. (And looking at my USB drives later, showed that the test does set up a 4th partition on a USB drive so it's like a ZIP disk. So really, if the test doesn't work, and you can't boot from USB, do what I did.)

I bought these:
http://www.newegg.com/Product/Product.aspx?Item=N82E16812186002
http://www.newegg.com/Product/Product.aspx?Item=N82E16820208338

It's nice because I get a removable media, and my hardware thinks it's a hard drive. Which worked great. It also doesn't take up a drive bay (so more storage) and also doesn't take up any room on networked drives.

Consulting these instructions, as well as Parts 1 and 2 of these instructions, I finally had my FreeNAS operating system installed and had configured my drives through a web browser on my Windows 7 computer.

Now to test it. I started to copy a 6GB file over to the NAS. Transfer rate: 12MB/sec.

Lame.

I then set out to figure out where the bottle neck would be.

Wednesday, October 19, 2011

The beginnings of my FreeNAS

My wife had been giving me grief about all the computer parts I had laying around in our basement. Honestly, I just can't bring myself to throw away something that still works.

Even if it is this:
Asus A7V133 Motherboard (Socket A)
AMD Athalon 1200
640MB of PC-100 RAM
1x Quantum Fireball ATA66 15GB Hard Drive
1x Maxtor ATA100 15GB Hard Drive
Mitsumi CD-ROM
250W Power Supply
10/100 Intel Pro Network Interface Card (NIC)
Palit MX440 64MB PCI Video Card
And I'm pretty sure there's a Banshee in there cooling the cpu.

Weak-sauce, I know. But it still worked. And I'd feel bad just tossing it.

This was my wife's computer when we were in college and it's fallen by the wayside as I've built two computers since the time this computer was important to us. When I built my Windows 7 machine two years ago I needed a case for it. So I put my XP machine in my wife's computer case and put this hardware in a drawer (and then put my Windows 7 machine in my old-but-nice XP case.) Eventually I ended up getting a new case for my Windows 7 machine and put everything back. So yeah, I've had 3 computers laying around. I might as well find a use for them, or face throwing away something potentially useful.

First I needed an operating system for it. Originally, I was just going to install something on it and give it away to someone that needed it. However, the original operating system I had for this was Windows 2000. I have install disks for 98, 2000, XP Home, and XP Pro, but no extra CD-Keys. At one point I found one on the internet that worked for 2000, but I didn't feel right about doing that, much less giving a computer to someone that was so outdated and now illegitimate

I thought I'd install Linux and give it away. However, I never got Ubuntu 11.4 to install (more on why that didn't work later) and furthermore, the kind of person that would perceive a need for this old computer, probably wouldn't be able to use Linux:

Person - "How come I can't install this program I downloaded?"
Me - "Because that's a windows install package you're double clicking on. You're running Linux."
Person - "What's Linux?"

.....at least that's how I saw it in my mind anyway.

So there it sat with my wife urging me to do something with it or get rid of it.