My Home NAS, Part 3
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 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:
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). 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:
- First, take the card out of the machine.
tail -f /var/log/messagesso 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
#!/bin/bash # The $1 argument should be the full path of the SD card's device special file. USBDEV=$1 # Download the Debian Lenny boot image file cd ~ wget http://http.us.debian.org/debian/dists/lenny/main/installer-i386/current/images/hd-media/boot.img.gz # 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 wget http://cdimage.debian.org/debian-cd/4.0_r5/i386/iso-cd/debian-40r4a-etchnhalf-i386-netinst.iso wget http://cdimage.debian.org/cdimage/lenny_di_rc1/i386/iso-cd/debian-testing-i386-netinst.iso # 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:
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:
- Choose "Manual".
- Select the disk from the list; it should have "hda" in its name, since it's the /dev/hda device.
- When asked about creating an empty partition table on this device, choose "Yes".
- 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.
- Choose "Create a new partition."
- The default partition size should be fine, since we just want a single partition using up the entire device.
- Choose "Primary" when asked what type the new partition should be.
- 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."
- Choose "Finish partitioning and write changes to disk."
- 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.
- 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;" 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:
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.