D-Link 320L NAS repair

I have had a cheap-ish D-Link NAS running at my home for years. Last week, it broke. The drives were audibly still spinning up, and the activity light was blinking, indicating that it booted, but then went dark. Nothing on the network, no way to tell what was up.

There are two 4 TB drives in the enclosure, configured as RAID1. My immediate suspicion was that the mirroring might be out of sync. A bit of Google research told me that the box is a tiny Linux machine using Linux RAID partitions.

The first thing I did was to remove one of the drives. That made the other one the only drive in the array, and with no discrepancies, the NAS showed up on the network again, and allowed me to take a backup of my data. Which only confirmed my earlier suspicions.

Next, I put both drives in an old Linux desktop that had the required SATA slots, and Linux’s mdadm recognized them as being formatted for a RAID, but out of sync. dmesg said something about kicking sdb2 out of the array, so I used mdadm -a to put the array back together, and the array began rebuilding, which took a few hours, but eventually gave ma a working RAID1 array again. I was able to insert the drives back into the D-Link enclosure, and now it boots up and works just as before.

Lessons learned:

  1. My D-Link NAS cannot recover on its own.
  2. Linux skills pay unexpected dividends.
  3. I should have configured remote syslog logging before this happened. Fixed that first thing.
  4. It is probably time to buy a new device. This one is out of service, has never been 100% reliable, is pretty loud, and has no fancy extras.

Now that I know the disks are still in good shape, I’ve ordered a 2-bay Synology. I’m looking forward to the built-in Plex server, support for more than SMB 1.0, and hopefully a better management interface, too.

Scheme on Ubuntu (with Chickens!)

My plan is to use Scheme for a game. Why? It’s an awesome language. And someone has to do it. This is my log/HOWTO that explains how to install it. I’m using Ubuntu 10.4 Lucid Lynx

Step one: Install chicken, a scheme interpreter/compiler, and gcc.

$ sudo apt-get install chicken-bin gcc

Step two: You are done.

$ csi

CHICKEN
©2008-2009 The Chicken Team
©2000-2007 Felix L. Winkelmann
Version 4.2.0
linux-unix-gnu-x86 [ manyargs dload ptables applyhook ]
compiled 2009-11-30 on vernadsky (Linux)

#;1> (print (cons “Hello” “World”))
(Hello . World)

This is the interpreter, but we want to build executable files. The compiler, csc, does this for us.

$ cat > hello.scm
(print (cons “Hello” “World”))

$ ls -l hello
-rwxr-xr-x 1 erehling erehling 18845 2010-04-21 18:11 hello

$ file hello
hello: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped

$ ./hello
(Hello . World)

Notice that we’ve got a real executable now – nothing’s interpreted. This is promising!

Next time we’ll draw some graphics.

Eressea Server Down

The Eressea server (and with it, this blog) has been down for about a week due to a burnt motherboard. The hard drives could be saved, but the new machine doesn’t have SCSI, so some work had to be done. Thanks go to Andreas and Nils for fixing this.

The new machine is no longer Debian but Ubuntu. This gives me a chance to set things up The Right Way – after 8 years, the old machines had a lot of quirky stuff installed, and was running with a number of unexplained anachronisms. So excuse the mess, we’re under construction.

Here’s my preliminary TODO-List:
Continue reading

I need a good linux IDE

I admit it: In the choice between emacs and vi, I choose “none of the above”. I want a C++ IDE. I’ve grown up with Borland Pascal, then used the Visual Studio IDE, and I’ve never used anything without a good integrated debugger.

Switching from Visual Studio to emacs + gdb is something I’m no longer able to do. So this weekend, I had a look at some of the IDE offerings that Linux had. It’s not a happy tale.

First there’s eclipse. Many people (Java people) swear by this, and as they point out repeatedly, it isn’t a Java IDE, it’s an IDE for anything you want. Sort of like Visual Studio is (if what you want is a MS language). I downloaded the CDT, and I like the way that’s all done from inside the IDE. But then… I tried to create a managed makefile from the Eressea sources, because if I’m going away from commandline make, I’d like to also go away from makefiles, thank you. very much. Not possible, though. It seems Eclipse has a weird conception of projects being everything that is in one folder, no more, no less. If I have the sources for my library and two executables all in the same folder, for example, I can’t make eclipse build a library and two executables. Instead it tries to mush all of it together. But really, that is academic, because I couldn’t even get it to do that – Eclipse + CDT crashed every 5 minutes. All I get is some java exception, no option to save my work, and then it’s gone and I’m back to square one.

Code::Blocks was my next candidate, because many people on the Ogre3D forums are raving about that. I installed it on Windows from the binaries, and while not pretty, it looked close enough to what I want. So.. debian packages? No dice. No packages for any distribution, actually. Build it from the sources, they say. But even that isn’t easy. It comes without a configure script, and requires me to install automake, but not the automake I had, no, that other version of automake please, and then it would bitch about something or other and completely refuse to do anything at all. No dice. I didn’t even get a configure script. Screw this.

There’s still kdevelop left to test. Like Obi Wan, it is my only hope to run linux on the desktop. Yes, my web browser and office suite run on linux, too, but without an IDE, I have to stick with Windows as my OS, because programming is what I do 90% of the time I’m at the computer.