Whitepaper: Building a shoebox media server on the cheap

I wanted a media server for my place because my laptop hard drive is pretty small, and I have a bunch of movies and music scattered about on a bunch of external hard drives. I had a few requirements:

  • Completely silent. No fans.
  • Large storage (~ 3 Tb or more)
  • Support backing up to cloud backup service (eg. Crashplan, Backblaze)
  • Small
  • Cheap
  • Headless

I looked at home NAS units but found that they wouldn’t support cloud storage. (Cloud backup guys refuse to back-up network storage, so the system has to contact the cloud server autonomously). This also ruled out the Apple Time Capsule.

The Mac Mini was ruled out for not having sufficient space, and being too expensive for this purpose, given that most of its shiny features would be wasted on a headless system.

Most off-the-shelf PCs featured large power supplies with fans, which was not what I wanted.

So I decided to build a cheap PC from parts.

The Hardware

Mainboard: ASUS AT4NM10T-I

I don’t know what all the gibberish characters mean, but it’s a pretty cheap mainboard with an Intel Atom D425 CPU. It draws very little power and it’s 64 bit and stuff. It has four SATA connectors for hard drives and USB2 or whatever. Curiously it also has a PS/2 mouse/keyboard port, a parallel port, and a COM port. Why? You’d think they’d save some money on components by ditching these features. Whatever.

I guess it also has sound outputs. Oh, and gigabit Ethernet. That’s important.

Hard disk: Seagate 2 Tb “Green” or something

It’s got 2 Tb of storage which is plenty big. It’s 5400 RPM, which is slower than average, but consumes less power and is quieter. That’s important.

I also have a Western Digital 1.5 Tb “Green” hard disk, which I think is a bit louder and power-hungry. That will be the second disk at some point.

Power supply: PicoPSU 160 XT

This is cool: the PicoPSU 160 XT is a tiny, fanless power supply that delivers 160 watts (peak 200 W). That’s quite a bit for a low-power system. I suspect I can get the mainboard and three 3.5” hard disks running from this thing.

The bulk of the power supply is external, like a laptop. I bought it as a kit with the power supply and an external power transformer (110-220 V AC to 12 V DC). The transformer is about the size of the one from the original XBox 360. If you’re not a nerd, that means too big. But it’s fine.

The Software

I got Linux from the Internet.

I used Ubuntu Server 10.04 LTS. Basically, Ubuntu is great and so easy to use some people claim it’s “not Linux”. I’d stay away from 11.04, though. From previous experience it’s pretty buggy, and you don’t need bleeding edge for a media server.

The Installation

As I said, I wanted this to be a headless server, and beside my laptop, I don’t own a keyboard or screen. The challenge was to get a working OS onto the hard disk and then install it in the machine.

To begin, I installed VirtualBox on my mac and set up Ubuntu Server in a virtual machine. (Note: do not use LVM) I bound the virtual hard disk to 8 Gb even though I had a 2 Tb target disk. This is important.

Then, I converted the VirtualBox VDI (virtual disk image) to RAW format. The command is basically this:

VBoxManage internalcommands converthd hard_disk.vdi hard_disk.raw

That gives you an 8 Gb file.

Next, I connected my 2 Tb hard disk to a USB drive enclosure and plugged it in. OS X complained about the unformatted drive, but I told it to shut up. The disk appeared at /dev/disk1 (note: sometimes it was /dev/disk2. If you are doing the same thing as me, this right here is the first step that could hose your laptop if you do it wrong. Make sure you pick the right disk.)

Using the magical dd command, I dumped the raw disk file onto the physical hard disk.

dd if=hard_disk.raw of=/dev/disk1

This took a while.

(Astute readers might wonder why I didn’t direct VBoxManage directly onto the disk. That’s because VBoxManage is a jerk and refuses to write to an existing file.)

Problem: now we have a 2 Tb hard disk with an 8 Gb partition table. Oh, and Apple’s partition table is different from Linux so it’s dicey to go and change it there.

Solution: we need to mount the disk in Linux. It’s possible, albeit slightly insane, to mount a physical disk in a VirtualBox image. Here’s the magic command to do it:

VBoxManage internalcommands createrawvmdk -filename disk.vmdk -rawdisk /dev/disk1

Then I booted disk.vmdk into VirtualBox and got my Linux. Easy.

From there I was able to use fdisk and fiddle with the partition table. The most important tip here is to ensure the starting cylinder/byte of your root partition is unchanged. Swap and stuff can be fixed later.

# In your virtual terminal:
sudo fdisk /dev/sda

After a reboot your partition is bigger but the filesystem is still at 8 Gb. Now you must tell the filesystem to fill the extra space. Linux has an insane feature that lets you resize a filesystem while it is running. No really. Crazy shit.

sudo resize2fs /dev/sda1

This took, like, four hours. Remember, we’re on a slow-ass USB disk here. You could do this after the disk is installed in the media server, actually. Probably would have been smarter.

Finally, I connected the hard disk to the mainboard. I needed an enclosure.

As previously mentioned, all the small enclosures on the market are too small for 3.5” disks, and those that are big enough come with noisy fan-filled PSU’s. I grabbed a shoebox and some duct tape (fact: most duct tape is non-conductive because it’s actually duck tape). I shoved all the pieces in there.

The last step was convincing the mainboard to boot. See, I didn’t have a power button. I looked in the manual and found the power button pins on the mainboard. Then I shorted those pins with a copper coin. The system started up.

(Fact: booting a PC by shorting pins on the mainboard is basically the most bad-ass nerdy thing you can do).

The system booted and didn’t appear on the network. Crap.

I disconnected the disk, reattached it via USB and booted in a virtual box again. By examining logs I found that Ubuntu got confused by the new network adapter and gave it a port of eth1, which was not configured. I modified /etc/network/interfaces and added these lines:

auto eth1
iface eth1 inet dhcp

This finally convinced the PC to connect to the network and I could ssh to it and finish the install.

Results

It works! The thing lives!

I still need to configure Crashplan for offsite storage, and install the second hard disk, but basically the experiment was a wonderful success.

F’ yeah web safe colors dot tumblr dot com

I really like dead technology. Obsolete ideas are really interesting
because there’s always a story behind them: why were they made, why
were they maintained, and where were they killed?

I’m on record as an ironic fan of Swatch Internet
Time
, a bizarre
invention of the early nineties that consisted of timezone-free time
format that counted from zero to 999 every day. It looked like this:

@846

It was basically a marketing concept from Swatch based on the idea
that we’d spend so much time online chatting with people from other
timezones that synchronizing time would be a huge problem. It is a
problem now, but not one to warrant the invention of an alternate,
metric time format. Most online interactions have become asynchronous.

Every time I think about Swatch Internet Time I think about all the
people who came up with and promoted that idea, their reasons for
doing so, and the spectacular hubris of its failure and obsolescence.

A discussion at work about theoretically most pointless “fuck yeah”
tumblr blogs inspired me to create one:
fuckyeahwebsafecolors.tumblr.com.
If you’re not an old school Internet nerd you probably won’t get it.
Basically, back in the day computers were embarrassingly limited in
that they could only display 256 colours on the screen at a time. When
you tried to display more than that, you would get ugly hatch-mark
patterns on the screen. (You can see this yet in animated GIFs which
are also limited to 256 colours and are making some sort of
ironic-retro-art comeback).

After some intense thinking the brains of the World Wide Web decided
on a palette of 216 “web-safe colors.” The theory was that all
websites in the world would agree to use only these 216 colours in
order to prevent the horrors of dithering. The remaining 40 colours of
the palette were left to the operating system to do as was its wont.

The plan never really worked, though, because any non-web application
on the screen would also attempt to allocate some of the computer’s
256 colors, and stomp all over the web-safe palette, thus bringing on
the unsightly hash marks. Not only that, the web-safe palette was made
up of a lot of really ugly, bright, clashing colours.

The era of web-safe colours was over quickly. New display systems came
on the market within a couple of years that were capable of displaying
16.7 million colours simultaneously. Websites using web-safe palettes
suddenly looked hilariously out-of-date. The whole concept, now
irrelevant, vanished.

At
fuckeyeahwebsafecolors.tumblr.com
we’ll be going through the web-safe colors, one at a time, with no
commentary. I urge you to meditate on the colors. What do they say to
you?

Textural Backgrounds for You

While procrastinating from vacuuming my apartment (which is tiny and can be vacuumed in ten minutes but yes I am that lazy) I made these backgrounds. I am quite pleased with them. Click to embiggen to 1680×1050 res.

 

 

I got the textures from a few places, like from Dioma on DeviantArt. (Another pack by Dioma). And Playingwithbrushes on flickr.

Unexpected Features of OS X Lion

Actually, most of the stuff in Lion is really, really awesome and I’m glad I upgraded. However, here are some of the WTF’s that nobody is talking about:

  • Built-in Emoji characters! If you had OS X Lion you would see that this glyph is a little smiling pile of poop:

I went to the Berlin Beer Festival

Last weekend we pretended to be über-tourists and went to the Berlin Beer Festival. Here are pictures to prove it.

Here is our drinking team. The way this works is when you enter the Bier Meile (which is a mile-long stretch of beer tents and bars) you buy a glass. It costs you 3.50 EUR. Then you get that glass filled as many times as you are able as you walk down the Bier Meile. If you get out the other end, you win.

They also had a lot of good, greasy foodstuffs. I took a lot of pictures of that.

Here is a gigantic barbeque. Two kinds of sausage, boulette (meatballs), and steaks are all frying up. You buy whatever you want and they give it to you in a bun.

Here a woman is serving beer out of a giant novelty barrel. This beer was great. It was a Kellerbier, meaning a beer that was left in the cellar for too long as has started to get a bit crazy tasting. It’s from an unpronounceable place in Poland.

This poor monk got lost in the giant crowds of drinkers. He just wanted to hock his strawberry beer. (It was too sweet, but alright.)

This is lard on bread. It’s some kind of Polish thing. Nobody tried to eat it.

This sausage was made with horse meat. It did not look or taste noticeably different from regular pig-based sausage.

Best hat award.

Deep fried battered cauliflower in mustard sauce. I recall my grandmother making this, which is odd because she was Italian, not German. This tasted as good as anything battered and deep fried tastes, which is pretty damn good.

So much meat. I’ve never seen steaks cooked on a rotisserie. This is apparently a Thüringer thing. Those crazy Thüringers!

Here’s me with a pickle I bought because you can just do that. The women behind me were selling pickles from barrels. The pickle was amazing and was a great match with all the beer.

Overall: the Berlin Beer Festival is a lot of fun. Plan to go in the early afternoon and get your drinking done early, before the Schlager DJs really get in gear, and the crowd of Bavarian tourists gets out-of-hand drunk. At that point things are just too weird.