External Drive for Pi2

I’ve read many articles about serious use of the Raspberry Pi and I’m now convinced that there is very little chance of mounting a Pi in a cupboard with MSQL and other write-intense programs – and expecting it seriously to last for a year or 3 because of the limited writes you can do to SD memory – that includes the ones that have wear-levelling.

With that in mind I’ve just strapped a hard drive to the Pi2. You cannot (it would seem) BOOT off the hard drive but you can put your entire file system onto there.

There are many, many ways to do this but as is often the case, Adafruit have a simple way.

Make sure you back up your SD before starting any of this in case it all goes to pot.

So in total:

I found a lead that has 2 usb and one mini-usb plugs – so that you can plug the drive into a power AND into the Pi  – I did this because the Pi will not power a hard drive – just not quite enough juice available. I plugged everything in and made sure the drive was whirring.

I followed the instructions on the above line from just under half way down below “If you’re using a stock  Raspbian install”.  I grabbed their helper. As I tried to follow the next instruction it went off to the internet for an update but proceeded automatically from that point on.

This helper program not only formats the external drive – but also uploads all your material from the Pi onto the external driver AND changes the file that determined on boot where to get materials from.

The instructions said “this will take a long time” – it took around 5 minutes as I wrote this blog. At the end of it I noted “your new root drive is accessible under /mnt. In order to restart with this drive at /, please type: sudo reboot”.

With a slightly elevated heart rate, after all this really WAS too simple….  I followed the instructions.

Well, much to my HORROR – tests showed that although there was indeed a new drive, I was not using it. I found 2 www. directories (one on the SD, one on the drive) and modified the one attached to the hard drive.  a quick run of the default web page (in the process of installing webmin you end up with a LAMP installation and hence a web server)  showed that I was NOT running on the hard drive.

So – I went looking into /boot/cmdline.txt – which is the file that tells Pi where to use for the root directory. It had INDEED been updated from:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p6 rootfstype=ext4 elevator=deadline rootwait


dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

All very nice but not what I wanted – it should be pointing to the external drive. Could it be a simple as changing that bold text to /sda1 ??

YES was the happy answer.. I updated the file and checked the web page and sure enough I was now looking at the updated version!!

And now, to back up that hard drive before I go any further!!

Or maybe a trip out with my good lady for a beer… (which is what actually happened…)


10 thoughts on “External Drive for Pi2

  1. The Banana-Pi and the PCduino3-nano are a couple of boards which come to mind.  They're the same general price range (as the RPi) but with extras.  On the face of it they'd make a better server platform than the RPi, but unfortunately, although they have Linux support, it seems as though they still have issues with the BSDs.  The Banana-Pi "router" board is interesting too (with all of those interfaces), though a bit more expensive.  Still waiting for a rock-solid BSD implmentation, though.


    1. Hi

      Thanks for that – well the more options we have the better in my view. I looked at the Banana Pi and others and up to now I still like the Raspberry Pi. When I first looked at the Pi – when it first came out – it was  big deal and I was in line for one of the first ones. I installed the visual desktop (I’m not a great fan of command line interfaces though I know they have their place) and it was just WAY, WAY too slow.  Today, even over VNC, the visual interface is fine and with other wonderful tools like WEBMIN and WinSCP I’m more than happy using the new Pi as a central hub-  in fact the ONLY minus I would give it has nothing to do with the Pi itself but more to do with pesky FLASH and the limited lifetime issues – it really is time we moved on from this.

      In your separate reply you’ve referred to the Digistump project. Hey, that looks good, I tend to buy little boards from China rather than the USA because there is usually no post on small items from China whereas the USA always seems to charge an arm and a leg and no exception here, adding 50% to the price – BUT I can see a use for this new board, it will happen as they are already WAY past the money they need and with CE approval assuming they get it along with security, this has great potential.

      Meanwhile I think there is a great future for the ESP8266 and now that we appear to have a reliable serial interface between Arduino and the ESP-01 I get to use up all my ESP-01 boards which were acting as doorstops. The march of technology will hopefully continue to be relentless and we all hope that things will get better and cheaper.. but right now, Monday morning – I can start  coding up a pretty impressive board with display thanks to MQTT and Tuan’s SLIP code.

      Keep em coming…

    1. Ok, Bill DOES have something here. The price IS too high compared to the Pi – and I don’t think 4G of flash is worth having in – for me it would not be enough – BUT the A20-OLinuXIno-LIME2 in that lot is not to shabby and has 1GB Ram like the Pi2.

      But then all of those would still have the same problem with SD so I’m not sure it is clear to me the advantage of any of them. On the ONE hand you have a SATA connector – nice – but then to take away, you only have 2 USB sockets and the Pi2 has 4.

      Hmm… thoughts?

      1. There are many options out there, and many more coming!

        Your comment about the price being too high, and then comparing a couple of specs makes me question the applications needs. Deciding to use something because it is cheap versus being well suited for the job will undoubtedly lead to unforeseen challenges down the road.

        Here is an example of what I am referring to. I contemplated building a tiny NAS using an RPi by connecting an external USB HDD. In theory; I would have a tiny cheap low-power capable Linux-based NAS for somewhere around 65€ (power+case+USB->SATA) running at around 14W. The problem is that the Pi NIC uses the USB bus, so file serving where the NIC and HDD would be solicited at the same time would be quite slow (not even limited by the 10/100 NIC). Plus, you need to configure and manage the various services your self. The UDOO board would be a much better option for this, and they even have tutorials to setup a small NAS… however for upwards of 100€ without a case. I eventually bought a Synology low-cost NAS for 85€ which is FAR more capable out of the box than any of these options, runs at about 17W, and includes support, the software, updates, and a very nice dedicated hardware encryption chip to offload encryption from the low-power CPU. In the end, I am VERY happy as this is one less thing for me to fuss with and it just works.

  2. As mentioned above by andy – if the Pi is running as a stripped-down, dedicated hub, and every effort is made to minimise writes, then the SD card lifetime would be much greater.

    Demanding more from it – full logging, db, Node-Red server… Pete might be bumping up against the limitations of what is still, after all, a small, single-board educational computer.  Nonetheless, it seems up to the task, except for this potential Achilles heel of SD card limitations. 

    Are there any similar single-board computers out there that have onboard SATA or other HD interface?



    1. Ken

      Well, so firstly I think the Pi2 IS up to the job. It's certainly as fast as you could wish for. I don't think there are other boards anywhere NEAR that price range…. what's needed is an SSD that LOOKS like an SD card but with the increased levels of wear levelling…  right now my second Pi is running happily on the hard drive – but really, what I need is to have everything on the SD, but all the logs and SQL database and general files stored on the hard drive and I don't know enough to know where all of those things are. 

      1. The ODroid line is also very interesting as far as I am concerned… coming out of South Korea. There are different models with varying specs, prices, and modularity.


        They have a broad selection of addons and modules to fullfill all sorts of needs and applications… a couple I like are the eMMC module, the UPS module… plus it comes standard with an RTC.

        This being said, I don’t think that they are cost-effective once you’ve added a module or two.

  3. I've been following your posts for a while on this.  

    If like to offer you my opinion.  I've been running a bog standard pi (slow gen), with rasbian, and fhem a german home automation package.  (read here, there are no.. wear leveling thoughts that go with this.)  It is a perl program running on linux basically.  

    This liitle box, has been running in a corner of my home for 3 years or so.  It has been solid as a rock, rebooted bascially never.. maybe once a year…  I too wondered about this wear levelling stuff, but maybe its worth just trying it.   I've kind of found the opposite, usb hdd, caused a whole load of headaches, as the USB stuff is so rubbish on the pi (at least the old one) that is was fairly unreliable. 

    That is my two cents… 



    1. Depends on how much writing is going on I think. I had emoncms using a mysql db and it killed it in about 4 months.

Comments are closed.