home NAS server 2013 part 2: Ubuntu

March 2nd, 2013

In my last installment, I discussed the hardware I was planning to buy for the build of my new home NAS server. Well, I got all the parts within a matter of days and threw the thing together, then spent my spare time over a couple of weekends setting the thing up. In this post, I’ll discuss the basic setup of the OS (Ubuntu server).

Installing Ubuntu Server 12.10

There are a lot of competent Linux distributions out there. I first got into Linux with Redhat in the late nineties, went through a Slackware phase, and finally found something I liked in Debian around 2001. Debian had an excellent package management system (apt), which made keeping all the software on your computer up-to-date. Fast forward a decade, and I’m still there, although with the Debian derivative Ubuntu. Ubuntu has the widest and deepest selection of pre-built software that I know of, and it is still a joy to work with.

Creating a bootable USB install disk

You may have noticed that my new server has no optical drive. So, I had to create a bootable USB stick with the Ubuntu installer. I did this by sticking a cheap 2GB flash drive I had lying around into my OS X 10.8 Mac Mini and then firing up Disk Utility. I formatted the disk FAT with an MBR boot record (GUID won’t allow boot), then added following incantation from the terminal:

# sudo fdisk -e /dev/disk2
f 1
write
exit

Which (I think) activates the first partition for boot.

Then, I used unetbootin to download and image the installer (ubuntu-12.10-server-amd64.iso) onto the disk. I popped it in the NAS and it booted right up!

Installing Ubuntu

I won’t hold your hand through the entire installation process. I did a no-frills install:

  • selected a hostname (“nasty,” heh),
  • whole-disk LVM on the SSD,
  • only installed OpenSSH server
  • installed grup on the root of the SSD
I rebooted and SSH’d into the fresh installation. I highly recommend using the terminal session management utility byobu, which is a pretty front-end for tmux. It lets you preserve your SSH session (actually, many sessions which you can switch between at will) and reconnect to them whenever you like from different clients. This is nice if you have to leave in the middle of a task, or want to launch a long-running task and detach from it and check back later. Byobu is installed by default in Ubuntu, you just type ‘byobu’ to launch it. I set it to run automatically when I log in with
byobu-enable
I then freshened up all the packages with
sudo aptitude safe-upgrade
That's it! Ubuntu installed.

Setting up the RAID volume

There are a lot more options out there for Linux RAID and filesystems than there were a few years ago. The last time I set up a NAS, I tried out ZFS with its whizzy volume management and snapshotting and whatnot, but discovered it was slow, unstable, and RAM-hungry. Before that I’d tried JFS, Reiser, and others. I was always bitten by their immaturity, and a lack of disaster recovery tools. Meanwhile, good old ext has always been reliable if not the most feature-rich. And, perhaps most importantly, ext is always supported by every recovery tool. So I decided to stay simple and just use Linux’s built-in software raid with an ext4 filesystem for my big media volume.

Before setting up a Linux software RAID volume, you should probably do some reading. It’s actually very simple once you figure out what you want, but figuring that out can be a lengthy process. I’ll direct you to the canonical guide that I’ve used several times in the past. For me, it boiled down to a 4-disk RAID5 array (one  disk worth of parity) with a 256KB chunk size (since I mostly have large media files):

mdadm --create --verbose /dev/md0 --level=5 --chunk=256 --raid-devices=4 /dev/sda /dev/sdb /dev/sdc /dev/sdd

And that’s it! Once the creation is started, you can start sticking stuff on the volume right away, so I went ahead and created a filesystem:

mkfs.ext4 -v -m .1 -b 4096 -E stride=64,stripe-width=192 /dev/md0

Here, the ‘-m .1′ reserves just 0.1% of the volume’s space for the root user (down from the default of 5%), and the block and stride arguments are tuned for the raid block size. See this section of the guide for info on how to compute them.

austin frontyard garden

February 26th, 2013

We’re greeting the spring with a raised-bed garden in our front yard. Leslie built the boxes then we worked together to mix the soil, plant, and install drip irrigation. Lots of tomatoes, peppers, and lettuce in the ground ready for the Texas heat. Bring it!

home NAS server 2013 part 1: shopping

January 21st, 2013

My 4-year-old home media server, made up of 4 1.5TB hard drives connected to a commodity motherboard in an old ATX case, is on its last legs. Drives will occasionally drop out of the RAID5 set, necessitating a rebuild, and I’m using 95% of the ~4.5TB of storage. Time for an upgrade!

I thought about abandoning the DIY approach this time. Synology offers a very tempting array of turnkey NAS servers based on low-power ARM systems with web-based storage management. If I’d gone this way, the DS412+ would have been my choice.

But, I’m a tweaker at heart, and my current DIY Ubuntu server hosts all kinds of third party applications that I rely on to deliver media: Sickbeard, sabnzbd+, and newznab+ for automatic TV downloads, rtorrent and rutorrent for HD movies and music, a Plex media server to deliver content to my TV, a dirvish-based remote backup system. While I could get most of these programs as packages for a Synology box, it’s fun to have the whole Ubuntu multiverse at my disposal. And I’m always a bit nervous having proprietary volume management software between me and my data. With Ubuntu, it’s just plain-old ext4 with Linux software raid, so I can rescue my data easily in an emergency.

So, I decided to build my own again. I had several important design goals:

  • At least double storage capacity (from 4.5TB to 9TB).
  • Reduce enclosure size (from mid-size ATX).
  • Network-accessible BIOS/KVM (no need to plug in a monitor or keyboard).
  • Enough horsepower for Plex transcoding.
  • Low overall power consumption, since it’s on 24/7.

enclosure: Chenbro SR30169

In some ways, the first thing I have to settle on is the enclosure. It controls which motherboard sizes I can use, how many drives I can fit, etc. I needed to hold at least 4 standard 3.5″ hard drives. Given the popularity of DIY NAS boxes, I’ve been surprised by the relatively small selection of enclosures that  can accomodate 4 hard drives and yet are not full-size ATX towers, which I wanted to avoid. I had my eye on this Chenbro for years, but it was relatively expensive and I just figured it was a matter of time before there was more competition in the space.

I also considered the Fractal Design Array R2, which can accomodate 6 3.5″ drives, but decided against it because the drive bays weren’t hot-swap, and the case is actually not very small for a Mini-ITX form factor.

So, I settled on the Chenbro despite mixed reviews of the included PSU; I planned to toss that out anyway. It has nice, hot-swap drive bays that plug into an included SATA III backplane, room for a low-profile PCI Express add-on card, and it’s pretty dern small.

price: $125 at Provantage

motherboard: Intel DQ77KB

Choosing a motherboard gave me the most angst. On the one hand, there are a million Chinese/Taiwanese manufacturers with commodity Mini ITX boards that have SATA ports and gigabit NICs sprouting from their ears, all relatively cheap (<$100) and widely available. I used a similar ATX board in my old NAS,  and it’s so generic I have no memory of its provenance.

But, one of the biggest hassles with my current NAS is that if something goes wrong and it won’t boot, I have to drag a monitor and an extra keyboard over to the closet where it sits and plug it in to debug. God help me if it croaks when I’m away from the house–I’m just SOL in that case. So, I made a design requirement of the new box remote KVM/BIOS access, so that I could do anything from a BIOS upgrade to debugging a bad kernel from anywhere on the Internet.

Finding good remote management software on an ITX board is tough. One of the best-regarded remote management platform’s is Intel’s AMT, which allows total control of the computer via a sideband interface on the NIC. Deciding to go with AMT eliminates basically every Mini ITX motherboard in existence, since you must select a board with vPro support to get remote managment functionality. This leaves the slightly aging DQ67EPB3, and the shiny new DQ77KB, with a Q77 chipset and Ivy Bridge support. I went for the latter.

This board has a couple of quirks worth mentioning: first, it has just 4 inbuilt SATA ports, only two of which sport 6Gbps SATA III throughput. This wasn’t a big deal for me, since magnetic drives can’t get close to SATA II’s 3Gbps peak throughput anyway. But it did raise the question: how was I going to connect the boot drive? Luckily, the board also sports a full-size mini-PCIe slot which can accomodata an mSATA II SSD. I knew I wanted a solid-state drive to run the OS, and this neatly solves the problem without any cables at all.

Second quirk: this board does not use standard, zillion-pinned Molex power connectors. Instead, it has what’s essentially a laptop power port that accepts regulated 19.5V DC input. This means I can’t use the Chenbro’s built-in power supply, but I was planning to replace it anyway. I ended up just ordering a 90W Dell Inspiron laptop power supply for $20, which is a good match for the board.

price paid: $126 at Amazon.

processor: Intel Core i5-3470S

Compared to when I was in high school, and processors were simply identified by their brand name and clock speed (who else remembers overclocking Celeron Slot 1 procs? Malaysia stock, baby!), there seem to be a dizzying array of models to choose from, even just from Intel. What’s worse, I can discern no rational mapping between the marketing names of the chips and their functionality.

Luckily, Intel provides a search engine which identified all current processors compatible with my motherboard of choice. Since I bothered to get the Ivy Bridge motherboard, I wanted a gen 3 Core chip. I also had to have vPro to enable AMT. That left me with exactly one i5, one i7, and one Xeon chip to choose from. I went with the i5, which was the cheapest.

Brief rant: it’s clear that Intel vastly oversegments their processor lineup to squeeze out margins. I suspect that there are only a handful of actual wafers, and that Intel just blows resistors on the package to determine what features and frequency a particular chip will run. This explains why I have to pay $200 to get a CPU with vPro support which probably has the same guts as an i3 at 2/3rds the price. Shame on you Intel!

price paid: $198 at Amazon.

memory: Corsair 16GB Dual Channel DDR3 SODIMM

When I was a wee babe I used to give a shit about RAM. What’s the CAS latency on those DIMMs, bro? I probably overpaid by 50% or more for exotic enthusiast memory. Now, I just don’t care. I know I want it to be dual channel, and I want there to be lots of it. So I got the cheapest 16GB DDR3 SODIMM kit I could find, which happened to be this Corsair.

price paid: $70 at Amazon.

boot drive: Crucial CT032M4SSD3 32GB mSATA SSD

 

As I mentioned in my discussion of the motherboard, I decided to go with an mSATA SSD for the boot drive. I don’t need much space at all, just that sweet, sweet SSD speed and the mSATA form-factor. So, I went for an mSATA version of Crucial’s well-regarded m4 SSD, at 32GB.

price paid: $55 at Provantage.

storage drives: Western Digital Caviar Green 3TB

The heavy lifting heart of any NAS: a whole mess of spinning platters. There has been a lot of consolidation in the hard drive industry over the years, with the exit of IBM and Fujitsu, two of my favorites. It used to be that I wouldn’t touch a Western Digital drive with a 10-foot pole, but their Caviar Green drives make a compelling contender for the NAS server: low power, quiet, and cheap. I know what you’re going to say, though: what about the recently launched Red drives, which are explicitly designed for the NAS market? Well, they are probably a bit of a better fit, but at an extra $30/drive, I just smelled more needless market segmentation. Plus, I already owned one 3TB Caviar Green from a near-death experience with my current NAS, so there was a nice uniformity to this choice. 4TB drives are now becoming available, but they’re quite a bit more expensive per GB.

price paid: $125 x 3 = $375 at Amazon.

Total cost: $950

All the parts are winging their way to me now. Once they arrive I’ll do another post describing the build, and then one more describing the software setup.

civic hits 100,000 miles

November 11th, 2012

My ’98 Honda Civic DX hatchback, purchased used with 36k miles in 2001, just hit 100,000 miles today at the ripe old age of 14. It has been basically problem-free the entire time I’ve owned it… can we make it to 200k together?

 

yard work!

September 3rd, 2012

20120903-104929.jpg

After two mornings of hard labor, we’ve unearthed and repaired our drip irrigation system and remulched half of the front yard. Domestic bliss!

moving day (8/3): we’re austinites!

August 20th, 2012

Despite what you might think from my lapse in posting, we did make it alive to Austin and are now in the process of converting cardboard boxes full of our things to a house full of our things. You can in fact review much of the whole moving process now thanks to this great gallery album that Leslie made. Have a look!

moving day (2/3)

August 14th, 2012

Much driving. Now in Texas. Just 576 miles to go tomorrow. Sleep now.

moving day (1/3)

August 14th, 2012

So, we left Oakland for Austin today. Some interesting facts I learned:

  1. Despite being advised for “1 bedroom apartments,” a 16-foot Penske rental truck can (very nearly) contain everything we own in the world. This is only possible due to (a) sedulous cubic inch measurements made by Leslie and (b) magical loading skills employed by our industrious helpers from Movers Anonymous. See above picture for the truck just after ingestion of three (3) charcoal grills and a bicycle but still awaiting insertion of two nearly worthless sets of pine Ikea shelves.
  2. When you put everything you own in a truck and then attach your car to the back of it, you should not expect to get excellent mileage. However, we were thrilled to see that we are solidly in the double digits so far!
  3. It’s muhfuckin hot up in the Central Valley, but oh good god, still not as hot as in Austin. And, y’know, like they say… here it’s a dry heat. Yep. In Austin? Not dry. Bring the pain.
Now, for sleep! Bonus fact: Palm Springs is not a wonderland of palms and springs, but in fact just another part of the huge ass desert down here. Motel 6 still as classy as ever, though. ‘Night.

Tomorrow: to Austin

August 12th, 2012

20120812-171423.jpg

Here’s Leslie driving the truck w/trailer away from the pickup. Mad tetris skills will likely be required to fit everything we own…

506 e monroe st

June 8th, 2012

We were waiting for the inspection to go through with no disasters before really getting our hopes up, and now that’s passed, so here you go: meet 506 East Monroe St., our future Austin home!

If all goes well, we close in mid July and arrive August 15th!

first austin dinner

May 4th, 2012

20120504-204052.jpg

nuff said.

a prettier than expected sunday

March 25th, 2012

20120325-153858.jpg

and now i broke the cv joint

March 24th, 2012

20120324-173526.jpg

And I’m not even really clear what it is.

doug prepared for the first stint.

March 24th, 2012

20120324-101125.jpg

lemons prep well underway

March 23rd, 2012

20120323-140425.jpg

Cleared tech and BS inspection, and one practice session complete!

ten years together

March 17th, 2012

Today marks 10 years of togetherness for Leslie and me. Wow! We put together a retrospective of a few pics on gallery. What a ride! Here’s to the next 10.

sous and sf

March 8th, 2012

20120308-095243.jpg

As viewed from Pt. Isabel.

the córdoba castle gardens

November 16th, 2011

20111116-125248.jpg

A last bit of independent touristing before we head to Seville.

the middle of spain

November 13th, 2011

Well, we’re a week into our Spanish tour and achieving new levels of awesomeness every day. I won’t try to give a blow-by-blow; for a pictorial description that’s more than you wanted to know, even before we’ve had time to add comments, check out the gallery.

Yesterday, we picked up our car, an adorable A-class Mercedes hatchback, and began our first foray into international road tripping. For the record, I had a beer and a coffee with lunch, and so started this experience with a double buzz. Leslie pointed out that this was probably for the best: a beer to relax me and a coffee to hone my attention.

I was mentally prepared for all kinds of hassles renting the car, but in fact it was considerably easier than in the states. Our credit card covered insurance, and they didn’t even try to upsell us on gas. The car is a diesel with a 6-speed manual transmission, but the clutch is very forgiving and it’s easy to drive. With only mild terror, we pulled into traffic and out of San Sebastian.

We were meant to stay in San Sebastian two nights. Our first night, we had a bit of a frustrating time trying to find good pintxos (pronounced something like “peenchos”), little snacks set out on plates at bars all over Basque country. There was no shortage of places serving this, but we learned quickly that if you could walk in and help yourself, they were bound to be old and probably not that impressive. Here’s an example of vast but not so good pintxos:

Leslie had researched several excellent pintxos bars, and you could spot them from down the street by the crowds boiling out onto the streets in front of their doors. Also by the fact that inside, there were no pintxos to be found, just hungry people waiting to pounce on the next plate to be brought out. Un pocito como asi:

If you know anything about Leslie and I, you can guess that this wasn’t exactly our scene. We retreated somewhat sheepishly to a nearby bar bar, like with drinks and stuff but no pintxos.

Another aside here, about drinking in Spain. Beer is expensive. Wine is cheap. It’s like bizarro land. A 0.4L glass of beer, which is considerably shy of a pint, will set you back 3-5 euros. And this beer is pretty crappy–some generic local pilsner, usually. The best mass-market one we’ve found so far is Keler, which was only served in Basque country. One night out of sheer luck we stumbled into the “Cat Bar” in the old town of Barcelona, which it turned out was run by a British ex-pat beer nerd (the tables were all covered in Brew Dog labels carefully removed from empties). Even he couldn’t provide good draft beer, but he pointed us to the one and only real beer bar in Barcelona, also in old town, which served a selection of German and American craft beers on tap! Haha! Also lots of bottles from Rogue, belgians, etc. So, I’m declaring that there’s no beer culture in spain. Fine, whatever. Our first day in San Sebastian, we got 3/4 bottle of totally drinkable Tempranillo for $6 and I officially gave up on beer :)

So anyway, we’ve retreated from the good pintxo bars on Friday night in San Sebastian, and stumbled on a bar serving two Keler beers for 3€. Holy shit, now we’re talking. We drank four while working on an increasingly difficult Sunday NYTimes crossword, then stumbled to what was the best  fine-dining experience so far in Spain at Bodegón Alejandro, another one of Leslie’s finds.

The restaurants in San Sebastian work thusly: they open at 8:30 and close promptly at 10:30. So luckily we arrived by 8:45, and ended up as one of the last couples seated, and left well after 11. So it’s like there’s just one seating for every restaurant… weird and a seemingly lost opportunity since the streets of San Sebastian were thronging with people at 6:30pm, and I bet a lot were hungry. Spaniards just lack that capatalist killer instinct, I guess.

Unfortunately, after our excellent meal, we had to return to our pension with shared bath. We slept fine, woke up a bit hung over (and in Leslie’s case, with the beginning of a cold), and remembered that we didn’t have any towels, and they weren’t supplied in the bathroom, and so we had this sort of hilarious shower where we dried off using Leslie’s scarf, which worked even less well than it sounds. All our clothes were dirty. Our tasks for the day included finding and using a laundromat, renting our car, and then finding a place to park it overnight in bustling San Sebastian, which task you can understand the hilarious impossibility of by browsing our pictures of the town.

Fortified by a dose of cafe con leche, we floated the concept of getting the hell out of San Sebastian that day and sleeping somewhere else (there were a total of zero real hotel rooms available in San Sebastian). When we breezed through the car pick up and they said we were welcome leave it in the rental lot for a few hours, our spirits rose. While our laundry tumbled, we researched and booked a somewhat random hotel in the rural hills south of the coast, all on our fully internet connected US iPhones.

Ah, the phones! Time for another aside. Quite optimistically, we each brought our shiny new iPhone 4S with us, hoping that we’d be able to buy a local SIM card with data service and just pop them in. While stocking up on supplies for our stay in Barcelona, I hit up every major local carrier: Vodafone, Orange, Movistar, asking if I could buy a pre-paid SIM for the iPhone: these were some of my earliest substantive conversations in Spanish, and while halting the message was clear: no SIM for you! The iPhone 4(s) uses a microSIM, which is actually just a normal SIM with less plastic, and no one could provide one. I retreated to the hotel, and Googled a bit, and found a thread about a more pragmatic, multicarrier phone vendor called PhoneHouse. I went there, and for 20 euros a piece got prepaid SIMs that included high-speed internet access. But they weren’t micro! No problem, because they had a little device that just chopped them down to the right size. Amazingly, Sprint did not lock the SIM slot, and so we just popped them in and it worked. In fact, it’s much cheaper and better service than we have through Sprint in the US. And that is the story of how we were able to carry around our little internet-connected computers through our whole trip to spain.

So we’re in the laundry, and we book this hotel, and we tell the pension that thanks but no thanks we’re blowing town, and we pull out onto our first Spanish highway. And we’re in the mountains, and it’s beautiful. The drive proceeds like the beginning of a video game: You Can Drive In Spain. Level 1 is huge, wide highways. Level 2 is smaller local highways, Level 3 is Roundabouts: No Traffic Version. Level 4 is Now You’re Driving on Windy Mountain Roads and Level 6 is Now You’re On A Full Blown Dirt Road In The Mountains How the Fuck Can This Really Be The Way To The Hotel. But our Garmin GPS (a.k.a. the Marriage Saver) is not wrong, and after a quick inquiry with the friendly locals (who luckily speak Spanish in addition to Basque), we find the hotel. The hotel which is, in fact, a beautifully renovated 14th century blacksmithing building next door to a 14th century mansion. And we’re basically the only guests (in fact, we think we’re the only guests until halfway through dinner when one other couple comes out to eat). Highlights of the blacksmith include real, old-ass walls, amazingly friendly husband-and-wife staff, and a tiny puppy skittering around who quickly became Leslie’s best friend and confidant.

here we are in rioja

November 13th, 2011

20111113-202034.jpg

…heart of the Spanish wine country, drinking German beer. Prost.