Installing Raspbian onto the PiDrive (HDD)

In the previous blog, I explained how I got to this point. Briefly, I have a new B+ RaspberryPi and a WD Labs PiDrive HDD.  The aim is to end up with Jessie Lite booting off the PiDrive.

There are 2 key sources of information that I used.  First is one from AdaFruit and the second a script from the EmonCMS scripts repository with some documentation here.  They are largely the same.

I found the USB_HDD script in the EmonCMS repository worked well except that it fails first time. One solution suggested is to put a ‘wait’ in, but I found that simply running it a second time seems to solve the problem.  No real idea why!  I think it may be that the second time it is run, the folder is already created so it keeps going.

If I was doing it again, I would change the size of the partition so that it did not create one big partition, but rather a smaller one for the system and a larger one for data.

Failed SD and Recovering Booting off the HDD

I have just has a failure of an admittedly, recycled, SD card.  The problem was I did not have a backup of the cmdline.txt file.  If you have looked at the script, you will see it gathers some information about the HDD partition and then creates the cmdline.txt entry to boot off the SD Card.

After much fiddling I discovered the solution was quite simple (would have been simpler if I had backed up the file).

First thing is to get a new SD Card, and put the image of your choice on it. Personally a Jessie Lite fits on a 2Gb card so I go with that.  Plug the HDD in and boot the Pi.  It will of course boot into a bare system running off the SD Card.  All you need to do, is change the cmdline.txt (simple eh?).

First you need to know what the drive is called.  It is most likely to be sda1, so the command:

will produce something like:

What we are trying to do is get that value of PARTUUID into the cmdline.txt so it looks something like this;

I had some fun getting it into the file.  the only way I could find was to  sudo -s  to permanently be the super user, backup the existing file

then pipe the value of PARTUUID into the file so;

if you then edit the file  nano /boot/cmdline.txt  (or use your favourite editor) to get the line looking as above.

Once you have done that simply reboot check it all works then save the cmdline.txt file somewhere on the HDD. Once you have done that you will, of course, never need it.

On the off chance that this does not work, you can put the SD Card in another machine and copy the cmdline.txt back (so it boots off the SD Card) and then look into it further.

Facebooktwitterby feather
This entry was posted in RaspberryPi, Technical - General and tagged , , , , . Bookmark the permalink.

Leave a Reply