Booting from the SD card, but using a USB stick to run the OS & store the file system


36 posts   Page 2 of 2   1, 2
by rogerdean » Sun May 13, 2012 6:36 am
Thanks Hexxeh, that looks a great tool.
I think it wouldn't work for this use case as, in order to access / on the hard drive on first run, the USB-fixed kernel must already be there, right?
In my ignorance I just updated kernel.img, not the other files - it worked but I'm sure it'd be best to complete the job with your updater as soon as possible after boot
Cheers
Roger
Posts: 21
Joined: Tue Apr 17, 2012 7:40 pm
by Hexxeh » Sun May 13, 2012 11:15 am
Yeah, that's probably the easiest way of working around it. It's not ideal, but it shouldn't be an issue once the next versions of the SD card images ship with newer firmware on them to begin with.
Posts: 90
Joined: Thu Apr 05, 2012 3:07 pm
by Jancis » Sun May 13, 2012 6:05 pm
solution works for me too. this means I can get SD card as small as 128M and it doesn't matter how fast it is - the rest goes on external (usb) drive with 6x faster read/write times.
Posts: 25
Joined: Thu Jan 26, 2012 3:54 pm
by Joe Schmoe » Sun May 13, 2012 6:15 pm
Incidentally, does all this work just as well with an external USB flash drive (i.e., as well as it does with a regular USB hard drive) ?
Oh, how I wish that the signature facility on this board weren't so broken.

It is broken in that every time you change your signature, all of your posts reflect the change, not just those going forward.
Posts: 2942
Joined: Sun Jan 15, 2012 1:11 pm
by rogerdean » Sun May 13, 2012 6:22 pm
It didn't for me - fine for the first couple of boots then perpetual freezing in the GUI, constant disk accessing. May have been swap-related
Posts: 21
Joined: Tue Apr 17, 2012 7:40 pm
by Jancis » Sun May 13, 2012 10:17 pm
i am not sure about flash read/write comparison to sd card, i am using 2.5" external hdd. and this hasn't failed for me all those reboots so far. just remember, if you use external drive, feed it with proper mAmps. I use externally powered (active) usb hub for that.

you should mount flash drive somewhere on system (i.e. /mnt) and test r/w speed like this
Code: Select all
dd if=/dev/zero of=/mnt/output.img bs=8k count=8k; rm /mnt/output.img

then do the same for sd card and find out which is faster. if flash drive is slower, it's not worth it.
Code: Select all
dd if=/dev/zero of=/tmp/output.img bs=8k count=8k; rm /tmp/output.img
Posts: 25
Joined: Thu Jan 26, 2012 3:54 pm
by Feakster » Sat May 19, 2012 12:08 pm
Hexxeh wrote:Yeah, that's probably the easiest way of working around it. It's not ideal, but it shouldn't be an issue once the next versions of the SD card images ship with newer firmware on them to begin with.

Thanks. I'll try your update tool & give it another go in a day or 2. I've been a bit quiet on this thread of late through other commitments diminishing my pi-play time.
User avatar
Posts: 35
Joined: Sun Jan 22, 2012 10:41 pm
Location: Gloucester, Gloucestershire, United Kingdom
by Feakster » Sat May 19, 2012 7:22 pm
rogerdean wrote:It didn't for me - fine for the first couple of boots then perpetual freezing in the GUI, constant disk accessing. May have been swap-related

So it worked for a USB HDD but not for a flash drive? I would've thought that a USB flash would be better. :shock:
User avatar
Posts: 35
Joined: Sun Jan 22, 2012 10:41 pm
Location: Gloucester, Gloucestershire, United Kingdom
by Feakster » Mon Jun 04, 2012 3:12 pm
Hexxeh wrote:Be careful when updating the kernel, you also need to copy across the matching modules. rpi-update (http://hexxeh.net/?p=328117855) will do this for you, but if you're doing it by hand, you'll need to remember to do it yourself when updating kernel.img


I tried the kernel updater, but my Pi wouldn't boot after.
User avatar
Posts: 35
Joined: Sun Jan 22, 2012 10:41 pm
Location: Gloucester, Gloucestershire, United Kingdom
by dgags » Fri Jun 08, 2012 3:11 pm
I'd like to get the steps down because I am unsure of what folks in this thread have done exactly to get their OS running on an external USB hard drive. I stress hard drive because it also looks like folks have had troubles with usb sticks.

    1. Install debian squeeze onto an SD card.
    2. Boot into debian and install Hexxeh's firmware updater.
    3. Update firmware.
    4. Attach external USB hard drive.
    5. Partition the drive / format the partition as ext4 / mount someplace.
    6. Copy the contents of the / (also known as root) filesystem to the place you've mounted your drive.
    7. Edit /boot/cmdline.txt and makee sure 'root=/dev/sda1'.
    8. Reboot.

I know steps 5 and 6 can likely be replaced with taking the original debian squeeze image and dd'ing it onto the external USB drive, but I am avoiding that simply because I have not gone through the trouble of figuring out what exactly the firmware updater touches.

I would be interested in feedback for these steps.

-dave
Posts: 1
Joined: Tue Jun 05, 2012 9:41 pm
by lloydns » Sun May 05, 2013 4:27 am
rogerdean wrote:Ok, I've done it. The secret was, as in so many places on these forums, that my power supplies (cellphone chargers) just weren't giving enough power for the portable hard drive. I had 3, one powering the Pi, one powering the USB hub, and one powering the hard drive through a split cable. Not good enough.

Then I tried using my laptop USB port as an additional power supply for the hard disk, and all was well. So, the steps are -

1) find a way to get enough power to the USB hard drive

2) write the squeeze image to both hard drive and to your SD card

3) on the small partition of the SD card, modify cmdline.txt as described above

4) on the small partition of the SD card, replace kernel.img with the one from github as above

5) plug it all in and off you go!

It's hugely faster, feels more like a real (very old) computer. Good luck

This was immensely helpful for me (although I found I did not have to replace the kernel, I'm assuming that's because of the time difference between the post and my reply...)
Is there any way to have the pi attempt to boot to the usb hard drive, and if that fails boot from the sd card? Is it as simple as adding an If/Else statement to the cmdline.txt?
Also, with a usb hub, how are the hub ports listed? (Ideally I'd have my pi check both usb ports, then the ones on the usb hub for the hard drive, and then resort to booting from the sd card if necessary)
My programming experience is rather noobish...
Any reply at all would be most welcome.
User avatar
Posts: 2
Joined: Sat May 04, 2013 1:04 am
Location: CA, USA