Boot from a 16MB SD card
Call for guest posts! I’m going to be away for ten days, and Ben and Helen will be babysitting this blog. They’re looking for guest posts from you – do you have a Pi project you think we might be interested in? Email email@example.com with your submission, and if the team likes it, they might feature it here.
A little activity for you to try at home – if, that is, you’re able to find an SD card from the past. This one is 1000 times smaller than the one that’s in my Raspberry Pi today. I’ve no idea where I’d start looking for an SD card this small in 2014; get rummaging through your drawers and let us know if you have any luck. You’ll need a USB memory stick too, large enough to fit your operating system on, because 16MB isn’t going to cut it.
Mike Redrobe had nothing to do one afternoon, so he decided to make his Pi boot from something he’d found down the back of some prehistoric sofa. With a very minimal amount of work, he was able to put all the pre-boot files (9MB) for Raspbian on the SD card, put the boot image for Raspbian on the USB keystick, edit cmdline.txt and boot up. Read all about it on his website.
I’m not quite sure why all of us here at Pi Towers think that this is so much fun, and suspect it speaks to the fact that most of us don’t have souls or a sense of humour.
Next stop NFS boot instead of USB!
Well actually… That exists too, designed for classrooms. We actually now use NBD, but NFS is still an option, just a bit slower.
And project code – https://github.com/gbaman/RaspberryPi-LTSP
For all my dev work for Raspi-LTSP I use an 128mb SD card, but really only 32mb is needed.
Yeah, I’ve been booting one of mine over NFS and / or iSCSI (depending on what I’ve wanted it to do that day) for about 18 months or so. Works well, and solved the SD card corruption issues I was seeing.
I’ve wrote a post on my blog recently how to boot from nfs: http://www.supagusti.tk/computer/raspberrypi/169-how-to-boot-xbian-on-a-raspberry-pi-from-a-nfs-share
almost read 16GB!!
booting from 16mb, its awesome and antique!!
That 9MB includes the kernel. I am sure you could fit a shell (maybe busybox) and a few programs in the remaining 5MB. Probably the 9MB can be slimmed down a bit.
instructions for boot to console?
ie 16Mb would be great, but 32,64,128
would be a start…
no usb pen_Gb
NOOBS lite (on the downloads page) fits on a 32MB card, and that’s capable of running a full graphical web browser… :-D
(press the Help button)
The smallest SD card I have is 64MB ;)
maybe I misunderstood?
iirc when I used it it installed the full 1.6Gb system?
did I miss an option
There’s two versions of NOOBS – full/offline NOOBS (1.4GB download, fits on a 2GB SD card) and online-only NOOBS lite (21MB download, fits on a 32MB SD card).
They’re obviously both designed to be used on much bigger cards (so that you can actually install an OS), but both versions include an “online help” button that’s available before you install any OSes – clicking this will launch a full graphical web browser (Arora, if anyone’s interested).
And yes, I verified that this works on my 64MB SD card last night, if you ignore the warnings about the card being too small.
Note that there are distros that fit nicely on a floppy, which is restricted to 1.44MB. So 16MB is about 11 floppies, so is luxuriously large.
“edit the cmdline.txt on the SD card to read /dev/sda2:”
Plugging in another flash drive or storage device when it boots up may prevent it from booting (if it is loaded in the incorrect order)
Unfortunately, the guide is in windows so you can’t easily check uuid.
Check the uuid of the flash drive in Raspbian with blkid (might need sudo) and then take the from /dev/sda2 and modify cmdline from
root=/dev/sda2 –> root=/dev/disk/by-uuid/
That way, it’ll always boot from *that* flash drive, regardless of the mounting order.
Apparently brackets go invisible when posting.
root=/dev/sda2 –> root=/dev/disk/by-uuid/UUIDFORSDA2
Now I just need another Pi to use the 32MB card I found the other day!
I read 16mB and thought, wow nice typo, when was the last time we’ve even used that size SD card? Will have to try and find one now.
well, another really exciting development….
This is actually how I’ve been booting my Pi for a while now. It’s much more reliable because flash drives can live through much more read/writes than a typical SD Card.
I’ve seen this mentioned a few times and always wondered about it…
Presumably the NAND chips are the same, so the only difference is that the controller-chip is being accessed via a SD-interface instead of a USB-interface?
(although I guess the USB form-factor *does* allow physically-larger NAND chips, if that makes a difference? But if it did, would that make SD cards more reliable than MicroSD cards?)
You know, I’ve never actually thought about why exactly flash drives are more reliable. It’s probably just because SD Cards are typically made specifically for storing semi-large files that will only experience a small handful of read-writes, while flash drives are designed to handle more intensive work like documents, so SD Cards are made to have less reliable storage systems. SD Cards are definitely able to be more reliable and read-write friendly, just look at the NOOBS card. What exactly in the chip changes this sort of stuff, I don’t know. I’ll look into it.
Nice, i’m using a 128MB sd card to boot 4GB usb stick.
Notes: Some images don’t have USB built in support on the kernel, so isn’t so easy to make it changing “root=” only.
This is a nice option to reuse defective sd cards.
Why limit yourself to a USB stick? Try a USB Hard Drive for Terabyte storage! …and if you’re doing that, and don’t have a tiny SD card, the smallest you’ve got will turn the trick.
(Untried but logically possible… anyone? :) )
That’s exactly how I have my openelec box. A 2TB HDD for all the media and it seemed to make sense to store the actual OS on there too since it’s always connected.
I haven’t timed it or anything but it definetly boots faster, maybe even as much as 3 or 4 times faster. Media browsing is noticably faster too because it can grab the thumbs faster from the HDD than the SD.
One thing to note is that things are much more responsive when the drive is formatted with a native partition table like EXT4 rather than NTFS. NTFS has a pretty big cpu overhead on Linux distros due to the requirement of a 3rd party driver required to read it. It makes quite a noticeable difference, my write speeds to the drive is basically double on the ext4 partition compaired to the NTFS one.
I had a 3TB USB 3.0 Seagate drive connected to my RPi at one point. The SD Card booted to the drive using the tutorial here: http://wiki.openelec.tv/index.php?title=Installing_OpenELEC_on_Raspberry_Pi#tab=Windows__28USB_29. I already had a bunch of media on an NTFS partition though so instead of trying to move all that to another drive, reformat as Ext4 and move back I created a second Ext4 partition that the RPi used for storage and had OpenELEC scan the media in the NTFS partition. It worked beautifully.
If you’re not going to be using the camera, then you don’t need the start_x.elf or fixup_x.dat files, which will actually allow you to boot from an 8MB SD card ;-)
And if you set gpu_mem in config.txt to 16MB, then it’d use start_cd.elf, in which case you might be able to delete start.elf, which would allow you to boot from a 4MB card!!!
I wanted to keep it as standard as possible, and I do use the camera.
I just opened up my old Nokia Communicator 9110 (still usable for faxes!) and it has an 8MB MMC.
I’ll have to try that in a Pi ;)
Heh, just spotted a new 8MB MMC card listed on eBay for £14.
That works out as almost 1800 quid per gigabyte, whereas the new 8GB SD cards available from the Swag Store work out as 50 pence per gigabyte ;-)
Think back to the days you could buy an 8Mb on SD; the were other cards like MMC or Sony’s MemStick vying for world domination and they were horrendously expensive, so you usually defaulted with whatever the digital camera or audio recorder etc they came with.
By the time you figured out you needed more storage a new offering presented itself, or you bought the whole new hardware for a better feature set. Early obsolescence was big and we all spent a lot.
Haha yeah – I used to have a PDA that used CompactFlash cards, a digital camera that used SmartMedia cards, another digitial camera that used MemorySticks, and a portable Linux computer that used MMC cards.
So much easier now that everything/everyone has standardised on SD cards :)
yeah, USB has become the great leveller of them all, as different variations of cards still exist, but USB adapters so cheap, their proprietary-ness isnt an issue any more, the ones i still have all find occasional turnkey use around my place. Cor Blimey I’m still mindful of how much they cost me, i wamt to extract the llast drops of blood from those stones
Got a 1 gig from an old Samsung phone in my draw.
I am not disturbing my children though as they use the PI for roms :P
So .. how is this so special ?
I always used an sd card partition for booting and run the os from external usb harddrive. The used part on the sd card is just 19 megabytes, where half is used for an emergency kernel image which i could do without i guess.
Kernel image could be moved to the hdd i think, along with most of the other files. Bare essentials for booting i think is less than 1 Mb.
Performance is significantly better on hdd probably ( i’ve never done without so i can’t really compare ). Swap is on a real hdd partition too… if you want performance a setup like this is what you want.
Itś no secret. raspbian has full instructions on how to do this ( maybe not about the swap partition, but thatś just standard linux functionality )
Kernel has to stay on SD boot partition because it gets loaded into RAM by start.elf, which doesn’t know anything about USB.
I haven’t experimented with this, but AFAIK the minimal files needed on the SD are bootcode.bin, start.elf and kernel.img
That’s probably correct. So I was wrong. Minimum SD card size would be 8 Mb in that case.
Thanks for the correction.
SosSolutions.nl had this almost for a year now i think, i ordered there a mediacenter and it also boots from an usb stick. still love the pi! looking everyday at this website!
I have an 8mb MC Card… shame it is in the wrong form for RPi. :(
Nothing out of the ordinary. If you have been using linux for a long time you know what i mean =) Try booting it on an old quadra 950 instead. That took som tinkering =P
Got a 1Gb CF microdrive, which could, in theory at least, be connected to an IDE/USB interface, being a ‘proper’ hard drive should avoid any of the read/write issues associated with SD cards ‘wearing out’ with multiple read/write operations – certainly seriously considering it along with a 16Mb C/F
I have a 32mb here. Hmmm… I wonder.
Does anyone know how the speed of a USB drive in a Pi compares to the speed of an SD card in a Pi?
I know the speeds for the devices are usually quoted, but the Pi interfacing will be a factor in the speed too.
Given that the actual *cost* of an SD card is negligible nowadays, perhaps the most important thing to consider is *reliability* (followed then by *speed*).
If it can be assumed that an SD card used for ‘boot only’ then faces far fewer read/write cycles than a ‘normal’ SD NOOBS-imaged SD card, then it seems logical that the ‘boot only’ SD option gains us ‘reliability’. And, it doesn’t then matter what size of SD card you actually use, the aim is to get the ‘read/write’ operations hived off to the USB interface as soon as possible.
Next then is the *speed* of operation – and this is a two-fold scenario. For some users, there may actually be a huge advantage in being able to get an ultra-fast boot-to-prompt cycle time (remember the good ol’ days of the Beeb Micro? Switch on, “Beee-eeep”, and you were booted, ready to run in less than half a second!!). This is where the likes of a Raspberry-Pi type of solution will always playing catchup.
The second scenario when thinking about speed advantages, is when it comes to basic storage I/O – if the USB bus provides a higher raw throughput, then there will be an advantage in using USB for storage. But, you can do this anyway, even if you just use a standard NOOBS-imaged SD card (obviously, there will still be *some* I/O to the SD card, but perhaps not enough to be ‘noticeable’).
So, yes, this does interest me, because I have an ongoing project that really wants the Pi to ‘boot-like-a-Beeb’ – or like a PIC chip – nore or less instantly !! (Scenario: Raspberry Pi reads the parallel lines feeding a ‘standard’ 128 x 64 pixel legace LCD display, and recreates same display on 32″ HDMI screen – JDB, you know what I have in mind, replicating a small LCD panel on a big screen, for training purposes).
I don’t really care what the *actual* size of the SD card is (nice challenge though!!), I just want to get to a command prompt, and into a Python program as rapidly as bossible – all I need is access to GPIO and HDMI. WiFi and a web serverwould be the only possible extra option, just to be able to replicate the HDMI screen on a remote HTML browser (Smart Phone / Tablet, etc.). In fact, GPIO to Web Server might even work!
Thanks for the work done to bring this to the Blog.
For the ultimate in rapid-booting, you’ll want to look at an assembly-coded OS / application e.g:
If you still want a “standard” Linux behind the scenes (you mentioned using Python) then you ought to have a look at a buildroot-based solution (this is what NOOBS itself uses).
You may also find that in order to reliably read all the parallel display lines quick enough, you’ll need to look at real-time OS patches. Or you could use a microcontroller (like Arduino) to read the parallel lines, and then pipe the data to the Pi over a serial (TTL or USB) connection.
(Scenario: Raspberry Pi reads the parallel lines feeding a ‘standard’ 128 x 64 pixel legace LCD display, and recreates same display on 32″ HDMI screen – JDB, you know what I have in mind, replicating a small LCD panel on a big screen, for training purposes)””
Fascinating. Bus snooping an LCD would be quite the hack. As Andrew says, having a microcontroller addon to reliably capture the bus state on every clock edge or data strobe would be the way to go.
Something like the FT245R – a USB->”serial” generic FIFO controller.
well if you loaded just boot loader on SD card you could probably use an even smaller card i guess. Since “You’ll need a USB memory stick too, large enough to fit your operating system on,” you’ll excuse me if i do not find this feat too impressive.
PC linux desktop needs close to 1GB to install i believe. however one can put the boot loader on 1,4MB floppy and then claim to have boot the entire system from a floppy.
correction: i meant fully fledged distro needs so much Slitaz or Tiny core need much less disk space. much, much less. I think tiny core can do with arround 15 MB disk space or soem versions with even less. it does need a bit more ram to run (28 MB or 46 MB depending on the OS)
tiny /micro core
Why not make a firmware that has the possibility to boot iPXE http://ipxe.org that would remove the need of SD card completely.
Please ask the author of Kolibri OS to try this :)
There is a RISC OS distro (the Pico) that is 7Mbytes in size (only 4.5 Mbytes of which is required, the rest is documentation and examples) and boots into a command-line environment with BASIC, just like a BBC computer all those years ago, except with 498Mbytes free rather than 32kbytes.