{"id":267,"date":"2008-05-21T20:45:25","date_gmt":"2008-05-21T20:45:25","guid":{"rendered":"http:\/\/dalelane.co.uk\/blog\/?p=267"},"modified":"2008-05-21T21:16:30","modified_gmt":"2008-05-21T21:16:30","slug":"my-new-home-server-a-nslu-2","status":"publish","type":"post","link":"https:\/\/dalelane.co.uk\/blog\/?p=267","title":{"rendered":"My new home server &#8211; a NSLU-2"},"content":{"rendered":"<p>I finished putting together my latest gadget this afternoon &#8211; a mini home server made from a Linksys NSLU-2 NAS device and a portable USB harddrive. <\/p>\n<p><strong>Why did I want it?<\/strong><\/p>\n<p>Do I really need an excuse? \ud83d\ude42  <\/p>\n<p>Now I have a full, albeit small, Linux server at home, I&#8217;m sure I can think of some fun things to do with it. But as I <a href=\"http:\/\/dalelane.co.uk\/blog\/?p=265\">wrote last week<\/a>, the catalyst that pushed me to doing this now was wanting something to collect data from my new CurrentCost electricity meter. <\/p>\n<p>It needed to be cheap, small, and low-powered &#8211; no point having a server running all the time to monitor my home&#8217;s electricity usage if it makes a significant dent in my electricity usage all by itself!<\/p>\n<p><strong>What did I buy?<\/strong><\/p>\n<p>A NSLU-2 &#8211; a network storage link for USB 2.0 disk drives, by Linksys. This is a small <a target=\"_blank\" href=\"http:\/\/en.wikipedia.org\/wiki\/Network_Attached_Storage\" title=\"network attached storage\">NAS device<\/a> that lets you make a USB harddrive available on a network. The firmware in it comes with enough software to create a network share for any portable USB harddrives or USB flash memory key that you plug in. <\/p>\n<p>It&#8217;s a neat little gadget, but what makes it special is that it is very easy to flash the firmware and replace it with a full Linux distro. Plug in your USB harddrive, and you have a Linux server with as much space as you might want. <\/p>\n<p>Oh &#8211; and for some reason, people call them &#8220;slugs&#8221;. <\/p>\n<p><!--more--><strong>What did it cost?<\/strong><\/p>\n<p><a href=\"http:\/\/www.flickr.com\/photos\/dalelane\/2508222553\/\" title=\"the slug has arrived by dalelane, on Flickr\"><img loading=\"lazy\" decoding=\"async\" align=\"left\" style=\"thin black solid\" hspace=\"10\" vspace=\"10\" src=\"http:\/\/farm3.static.flickr.com\/2399\/2508222553_9efeafb09f_m.jpg\" width=\"240\" height=\"180\" alt=\"the slug has arrived\" \/><\/a>A <a href=\"http:\/\/www.google.co.uk\/products\" target=\"_blank\">Google Shopping<\/a> search turned up <a href=\"http:\/\/www.pyramid.com\/\" target=\"_blank\">pyramid.com<\/a>. I bought the NSLU-2 from pyramid.com for <a href=\"http:\/\/www.pyramid.com\/Product.aspx?StockCode=761024&amp;ref_Source=froogle&amp;ref_StockCode=761024\" target=\"_blank\">&#163;42.89<\/a>, which included VAT and next-day delivery. I&#8217;d never heard of them before, but as first impressions go, their service seems pretty good.<\/p>\n<p>For the hard-drive, I spent <a href=\"http:\/\/www.ebuyer.com\/product\/126612\/\" target=\"_blank\">&#163;11.57<\/a> (again, including VAT and delivery) on a cheap-and-cheerful 4GB USB microdrive from ebuyer.com. <\/p>\n<p>In total, my new home server cost me <b>&#163;54.46<\/b>. <\/p>\n<p><strong>Turning it into a Linux server<\/strong><\/p>\n<p>There is a fantastic community site around the NSLU-2 at <a href=\"http:\/\/www.nslu2-linux.org\/\" target=\"_blank\">nslu2-linux.org<\/a> which contained all the info that I needed to get going. In fact, the whole thing took no time at all.<\/p>\n<p>Here&#8217;s a quick overview of the steps involved.<\/p>\n<p><a href=\"http:\/\/www.flickr.com\/photos\/dalelane\/2509050200\/\" title=\"unpacking the new toy by dalelane, on Flickr\"><img loading=\"lazy\" decoding=\"async\" align=\"right\" style=\"thin black solid\" hspace=\"10\" vspace=\"10\" src=\"http:\/\/farm4.static.flickr.com\/3278\/2509050200_c2335d28fe_m.jpg\" width=\"240\" height=\"180\" alt=\"unpacking the new toy\" \/><\/a>Unpack the NSLU-2 and plug in power and an ethernet connection. <\/p>\n<p>The box comes with a CD with a setup wizard and manuals &#8211; didn&#8217;t need any of that. The device comes with a web admin interface &#8211; didn&#8217;t need that either. \ud83d\ude42<\/p>\n<p>First step &#8211; choosing a Linux distribution. The NSLU2 site contains a ton of information on the different options available, but you can find a <a href=\"http:\/\/www.nslu2-linux.org\/wiki\/FAQ\/FirmwareMatrix\" target=\"_blank\">table with a good summary here<\/a>. I decided to go with <a href=\"http:\/\/www.nslu2-linux.org\/wiki\/SlugOS\/SlugOSLE\" target=\"_blank\">SlugOS\/LE<\/a> &#8211; it&#8217;s small &#8211; based on <a href=\"http:\/\/oe.linuxtogo.org\/project-overview\" target=\"_blank\">OpenEmbedded<\/a> so there are a ton of packages already available for it, all optimised for embedded devices. Plus it comes with a recent kernel and recent version of glibc. It&#8217;s a Debian-like install &#8211; so installing new software is all straightforward &#8211; you can just use <code>ipkg<\/code>. <\/p>\n<p>Once chosen, I downloaded the firmware binary image for SlugOS\/LE on the NSLU-2 from <a href=\"http:\/\/www.slug-firmware.net\/\" target=\"_blank\">slug-firmware.net<\/a>.<\/p>\n<p>Next you need something that will flash the firmware with the image &#8211; I downloaded the <a href=\"http:\/\/www.nslu2-linux.org\/wiki\/Main\/SercommFirmwareUpdater\" target=\"_blank\">Sercomm Update Utility<\/a> from one of the <a href=\"http:\/\/www.everbesthk.com\/8-download\/sercomm\/firmware\/NU54\/Upgrade_207_XP.zip\" target=\"_blank\">mirrors<\/a> listed on the NSLU2 site, and installed it on my Windows laptop. <\/p>\n<p>Before you can flash the NSLU-2, you need to put it in &#8220;Upgrade Mode&#8221;. This takes some fiddly mucking about with the reset button, but it&#8217;s <a href=\"http:\/\/www.nslu2-linux.org\/wiki\/HowTo\/UseTheResetButtonToEnterUpgradeMode\" target=\"_blank\">well documented<\/a>. Once in Upgrade mode, you run the Upgrade Utility. You point it at the Windows machine&#8217;s network card, and it finds the NSLU-2 itself. It showed the current version of the firmware &#8211; which was the same as the version that the Linksys web admin specified &#8211; so that was enough reassurance to get me to specify the firmware image I&#8217;d downloaded and click &#8220;Upgrade&#8221;. <\/p>\n<p>A few minutes later, the NSLU-2 boots up. By default, it has an IP address of 192.168.1.77 &#8211; you can SSH to it using the <a href=\"http:\/\/www.nslu2-linux.org\/wiki\/FAQ\/OpenSlugDefaultPassword\" target=\"_blank\">default root password<\/a>. <\/p>\n<p>There is a utility called <code>turnup<\/code> to do the basic startup configuration. This is <a href=\"http:\/\/www.nslu2-linux.org\/wiki\/OpenSlug\/InitialisingOpenSlug\" target=\"_blank\">well-documented<\/a>, but even without that, there is a default <a href=\"http:\/\/linux.die.net\/man\/5\/motd\" target=\"_blank\">motd<\/a> message displayed on login that walks you through the steps. <\/p>\n<p>You use <code>turnup init<\/code> to set the basic network config parameters. Then you plug in your harddrive, and set up the partitions for your Linux installation. <\/p>\n<p>I used fdisk to divide my 4GB drive into three partitions:<\/p>\n<pre>Disk \/dev\/sda: 4095 MB, 4095737856 bytes\r\n128 heads, 63 sectors\/track, 992 cylinders\r\nUnits = cylinders of 8064 * 512 = 4128768 bytes\r\n\r\n   Device Boot    Start       End    Blocks   Id  System\r\n\/dev\/sda1               1         600     2419168+  83  Linux\r\n\/dev\/sda2             601         787      753984   82  Linux swap\r\n\/dev\/sda3             788         992      826560   83  Linux<\/pre>\n<p>Most of the space went to partition 1 for my root filesystem, partition 2 for swap space, with the remainder for my home filesystem. <\/p>\n<p>There are <a href=\"http:\/\/www.nslu2-linux.org\/wiki\/OpenSlug\/InitialisingDisks\" target=\"_blank\">clear instructions online<\/a>, but basically you create the filesystem, move the root filesystem from the NSLU-2&#8217;s flash memory to the USB harddrive, then set up the mounts. <\/p>\n<p>And that&#8217;s it &#8211; a mini Linux server that&#8217;s ready to go. <\/p>\n<p><a href=\"http:\/\/www.flickr.com\/photos\/dalelane\/2508222195\/\" title=\"wow, it's small by dalelane, on Flickr\"><img loading=\"lazy\" decoding=\"async\" align=\"left\" style=\"thin black solid\" hspace=\"10\" vspace=\"10\" src=\"http:\/\/farm3.static.flickr.com\/2377\/2508222195_da2572edae_m.jpg\" width=\"240\" height=\"180\" alt=\"wow, it's small\" \/><\/a>In fact, I&#8217;m still amazed at just how tiny it is. <\/p>\n<p>Look at the pic of it next to a pen of mine &#8211; it&#8217;s not even as tall as my pen! <\/p>\n<p>So far, I&#8217;ve only installed perl and python on top of the default distro, and I&#8217;ve still got a decent amount of space left:<\/p>\n<pre>root@minipooter:\/$ df -h\r\nFilesystem                Size      Used Available Use% Mounted on\r\n\/dev\/sda1                 2.3G     80.5M      2.1G   4% \/\r\n\/dev\/mtdblock4            6.4M      4.8M      1.6M  75% \/initrd\r\n\/dev\/sda1                 2.3G     80.5M      2.1G   4% \/dev\/.static\/dev\r\ntmpfs                     2.0M     28.0k      2.0M   1% \/dev\r\n\/dev\/sda3               794.5M     16.0M    738.1M   2% \/home\r\ntmpfs                    14.8M         0     14.8M   0% \/var\/volatile\r\ntmpfs                    14.8M         0     14.8M   0% \/dev\/shm<\/pre>\n<p>I&#8217;ve not done anything interesting with it yet &#8211; I need to buy <a href=\"http:\/\/www.maplin.co.uk\/Module.aspx?ModuleNo=29968&amp;doy=21m5\" target=\"_blank\">a cable to connect it to the CurrentCost<\/a> meter before I can start collecting data. <\/p>\n<p><a href=\"http:\/\/www.flickr.com\/photos\/dalelane\/2509049808\/\" title=\"setup and linux'd by dalelane, on Flickr\"><img loading=\"lazy\" decoding=\"async\" align=\"right\" style=\"thin black solid\" hspace=\"10\" vspace=\"10\" src=\"http:\/\/farm4.static.flickr.com\/3213\/2509049808_f9cb012d86_m.jpg\" width=\"240\" height=\"180\" alt=\"setup and linux'd\" \/><\/a>But in the meantime, the server has already taken it&#8217;s place next to the CurrentCost meter. <\/p>\n<p>Awww&#8230; ain&#8217;t it cute? \ud83d\ude42<br \/>\n<br clear=\"all\"\/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I finished putting together my latest gadget this afternoon &#8211; a mini home server made from a Linksys NSLU-2 NAS device and a portable USB harddrive. Why did I want it? Do I really need an excuse? \ud83d\ude42 Now I have a full, albeit small, Linux server at home, I&#8217;m sure I can think of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[194,175,201,17,198,197,199,200],"class_list":["post-267","post","type-post","status-publish","format-standard","hentry","category-tech","tag-currentcost","tag-gadgets","tag-home-server","tag-linux","tag-nslu-2","tag-nslu2","tag-slug","tag-slugos"],"_links":{"self":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/267","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=267"}],"version-history":[{"count":0,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/267\/revisions"}],"wp:attachment":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=267"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=267"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=267"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}