In Defiance of Titles

Just another weblog

My Home NAS, Part 3

with 2 comments

Now that the hardware’s put together, the next step is installing the operating system.  As I mentioned earlier, my goal here is to install Debian Etch (actually, for reasons related to my backup policy, I ended up going with Debian Lenny; the install process is almost exactly the same, but you get slightly newer software) onto the onboard CompactFlash card without having to install an optical drive to do it.  I considered doing a PXE network install, but it looked pretty complicated given that I don’t have any other servers in my network setup…so instead, I set up a bootable SD card installer and worked from there.

I thought setting up the installer would be a bit easier than it actually was, given the simplicity of these instructions in the Debian installer guide.  However, despite my typically well-performing network setup at home, the process landed me right here:

DHCP fail: "Your network is probably not using the DHCP protocol. Alternatively, the DHCP server may be slow or some network hardware is not working properly."

Long story short, the network interface on the Wind PC is a Realtek RTL8111/8168B, and its drivers are either unsupported or unavailable in the Linux kernel version used in Debian Etch.  However, there is a slightly later version of Debian Etch (quaintly referred to as etchnhalf) that combines the stability of Etch with the later Linux kernel used in Lenny (the next Debian release). I initially tried to fix this by using the Debian “etchnhalf” distribution instead, but unfortunately I ended up needing a newer version of the backup utility duplicity than is available in any Etch distro. So, the following instructions will actually get you the appropriate install media for Debian Lenny. Christmas comes but once a year.  To get the SD installer working in this configuration, you can use the following script on any currently-functional Debian machine (I did it on a VM).  First, however, a couple of warnings:

  • This procedure will totally erase anything you’ve already got on your SD card.  Make sure you back it up first.
  • For safety’s sake, I’ve left it up to you to determine the device special file for your SD card (or, for that matter, any other USB device you’d like to use).  You can figure it out pretty easily:
    1. First, take the card out of the machine.
    2. Then, run tail -f /var/log/messages so you can see what new device shows up when you plug the card back in.

    In my case it turned out to be /dev/sdd …but don’t take my word for it, run the test yourself. You don’t want to overwrite the wrong device!

Once you know which device you’ll be writing to, you can copy and paste the following code into a file, make it executable (chmod +x filename), and run it with the device filename as its sole argument (e.g., if you save it as “createbootsd”, you’d run ./createbootsd /dev/sdd).


# The $1 argument should be the full path of the SD card's device special file.

# Download the Debian Lenny boot image file
cd ~

# Write the boot image file directly to the USB/SD device
zcat boot.img.gz > $USBDEV

# Mount the device onto the filesystem
mount $USBDEV /mnt

# Download the installer CD image to the device
cd /mnt

# Unmount the device so it's safe to remove it
cd ~
umount /mnt

When that’s finished running, you’ll have yourself a nice, working Debian Etchnhalf Lenny installer from which you can boot the Wind PC and start the process.  As you can see, DHCP configuration now works just fine:

DHCP success!

DHCP success!

The rest of the installation process was really quite uneventful.  On nearly every screen, you can just choose the defaults, especially when it comes to selecting a network mirror for the package manager. There are, however, a couple of settings worth noting:

  • You’ll need to give your machine a host name early on in the installation. You’ll probably end up using this host name a lot when you connect to the machine over the network, so pick something you’ll enjoy remembering.
  • It’ll also ask you for a domain name. In my case, I used a domain name I pulled from my router’s configuration page. In practice, I don’t know that this will matter too terribly much for a home network, and the installer says as much.
  • Since I didn’t yet have a working hard drive at the time of this installation, partitioning was very simple.  I just created a single partition taking up the full CompactFlash card and mounted it as the root filesystem.  No swap space is necessary here; the machine’s got plenty of memory, and swapping to the CF card could seriously reduce its lifespan. The steps for this, once you get to the “Partition disks” screen, are as follows:
    1. Choose “Manual”.
    2. Select the disk from the list; it should have “hda” in its name, since it’s the /dev/hda device.
    3. When asked about creating an empty partition table on this device, choose “Yes”.
    4. It’ll take you back to the first screen, but there should now be an entry right underneath the original “hda” entry, whose label ends with “FREE SPACE”. Select that entry.
    5. Choose “Create a new partition.”
    6. The default partition size should be fine, since we just want a single partition using up the entire device.
    7. Choose “Primary” when asked what type the new partition should be.
    8. The next screen gives you a variety of options for setting up the filesystem on your new partition. Here are the settings you’ll want to use:
      • Use as: Ext2 file system
      • Mount point: /
      • Mount options: check “noatime”
      • Label: none
      • Reserved blocks: 5%
      • Typical usage: standard
      • Bootable flag: on

      When you’ve got it configured, choose “Done setting up the partition.”

    9. Choose “Finish partitioning and write changes to disk.”
    10. It’ll warn you about how you haven’t set up a partition for swap space; don’t worry about this, as we definitely do not want a swap partition on the CF card. That’d wear it out pretty badly. Choose “No” to get past this message.
    11. One more warning screen; when you’re asked to write the changes to disks, choose “Yes”.
  • The Debian installer at one point asks if you want to install any of their various predefined collections of software; since I’d much prefer to install everything myself later, I just chose the “Standard system” option:
    Choose "Standard system"

    Choose "Standard system;" we'll install everything else manually later on.

  • And, of course, make sure to install the grub boot loader when asked.

And that’s the basic installation!  You can toss the SD card installer now if you like, since the NAS is ready to boot itself from CompactFlash, like so:

Ready to boot

Ready to boot

Next time I’ll show you what steps I took post-installation to secure the machine and make it run more efficiently; then, eventually, we’ll pop in a hard drive and get our RAID-1 array going.


Written by jazzslider

November 9, 2008 at 10:12 am

2 Responses

Subscribe to comments with RSS.

  1. Thank you! I’ve been having the exact same problem with my Wind PC and I’m downloading etchnhalf now.


    December 27, 2008 at 1:34 am

  2. Awesome; glad I could help. Actually (as I’m planning to write in my next post on this project), I ended up having to upgrade it all the way to lenny when I started setting up my Amazon backups; but that was only so I could use duplicity, which isn’t quite up-to-date in the etch repository. Anyway, glad to hear you found my comments useful.


    January 10, 2009 at 6:10 pm

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: