Hello world, time for me to gift some raspberry pi to the people. So here's my story, I recently graduated high school and I've been working with the school's IT guy for my senior year. When I graduated, he decided to get me the latest Raspberry Pi as a graduation present (at the time of writing this, the Raspberry Pi 2 Model B). I thought it was really generous of him and I wanted to use it. Here's the problem, I've only got 2 GB SD cards and the latest Raspbian image (2015-05-05) was like 3.5 GB in size. No problem, I'm a technology guy, surely I could figure this out, and I did. So now I'm here showing a step-by-step picture guide as to how I did it.

This instructable assumes that the reader has at least some basic experience with Ubuntu, the Raspberry Pi and the GParted partition editor. If not, then this probably isn't for you. This article is also centered around doing the whole process using Ubuntu ( sorry WinDoze people :p ).

-----!!! UPDATE !!!-----

Since a few people were wondering about my RCA setup and the alligator clips on the Pi, I have taken the liberty to make an instructable all about it. Raspberry Pi 2: Quick n' Easy RCA should answer all your questions and tell you how to do it.

Step 1: Prepare the Flash Drive

Navigate to your flash drive in GParted, in my case it is drive /dev/sdb.

Unmount the flash drive so you can make changes.

Delete any partitions so you can make a new one.

Add a new partition.

Format it to fat32 and give it any name.

Apply all operations to format the flash drive.

Step 2: Burn the Image to the Flash Drive

Type "sudo -s" to get into a root shell, so you don't have to type sudo again.

The easiest way to burn the image is to type in "dd if=path/to/image of=path/to/flashdrive". In my case I found the path to the flash drive from GParted, it was /dev/sdb but it might be different for you.

If you want to know the status of the burn, you can install pv by typing in "apt-get install pv" and then using the altered command of "dd if=path/to/image | pv | dd of=path/to/flashdrive".

When the image is finished burning, the contents of the drive should look more or less like they do in the picture of the GParted screen. It should have one fat16 partition and one ext4 partition and maybe some unallocated space if your drive is big enough.

Step 3: Prepare the SD Card

Insert your SD card and navigate to it in GParted, /dev/sdc in my case.

Unmount it and delete the partition.

Add a new partition and make sure it is 56 MB in size while being labeled "boot" and being a fat16 file system. The point is to clone the boot partition on the flash drive over to the SD card because the Raspberry Pi can't completely boot from a flash drive.

Then click "manage flags" and add the "lba" flag and you're done prepping the SD card.

Step 4: Transfer the Boot Partition

Get back into your root shell to prepare the boot partition transfer.

Again, use "dd" to transfer the partitions, my boot partition is /dev/sdb1 for the flash drive and /dev/sdc1 for the SD card. Notice the 1 at the end of each, that signifies the first logical partition which I can see from the GParted screen.

The command for me is "dd if=/dev/sdb1 of=/dev/sdc1" but I used the "pv" version because I like to see how everything works out. It's the same as in the last step, only change the "if" and "of" parts.

Step 5: Set to Boot From the Flash Drive

Get into the SD card file system with your favorite file explorer and open up the file called "cmdline.txt".

We will edit the word in the line that starts with "root=" so we can tell the SD card where it's supposed to boot, in this case the flash drive.

Change the line from "root=/dev/mmcblk0p2" to "root=/dev/sda2". It is "/dev/sda2" because in GParted, it shows my flash drive root partition as being /dev/sdb2, but when the Raspberry Pi mounts it, it will be /dev/sda and I want the second partition to get booted from.

Step 6: Finish Up With the Flash Drive

Get back to GParted and navigate to the flash drive.

Delete the fat16 "boot" partition, "/dev/sdb1" in my case.

Then resize the ext4 partition by clicking "resize/move" and dragging each end of the partitions to the corresponding ends.

Apply all operations and wait quite a bit of time for the partition to grow. When it's finished, there should be only one partition, and ext4, that has the same partition path (/dev/sdb2) as the original ext4 partition.

Step 7: Set Up the Raspberry Pi

Now just insert your SD card into the Raspberry Pi along with the root flash drive that we were working on.

Plug everything you need in like power, video, keyboard/mouse and wifi and turn it on.

Step 8: Moment of Truth

If all worked well for you, then you should see the Raspberry Pi boot up normally and the setup screen come up for the first time. CONGRATULATIONS!!!

If not, then something probably went wrong and you should try to see if you can fix it by going backwards to see what went wrong or just redoing the whole process again.

I typed in "startx" and the desktop interface came up, all is well and now I can use the Pi normally.

<p>After dd to install Debian, my drive is completed unallocated and thus broken</p>
<p>Try it without -s 1400M in the pv section, also sync, disconnect and reconnect your drive and see if anything changes.</p>
<p>-s 1400M changes nothing. Disconnecting and reconnecting does nothing.</p><p>A note; my drive is 460GB, would that effect anything?</p><p>Most tutorials do not seem to work either. </p>
<p>If you followed this tutorial to a T and it still doesn't work, then I have no idea.</p><p>Your drive is most likely an external hard drive with Debian, and this tutorial was for a flash drive with Raspbian. I don't know why that would make a difference, especially at the dd stage.</p><p>If you are able to make it work, I would be interested to know.</p>
<p>Progress Report! It worked. After formatting the NTFS 500GB HDD as Fat32 (I knew it - I couldn't do it in windows and didn't know that it could be done in GParted) and using the command dd if=raspbian.img bs=4M | pv -s 4400M | dd of=/dev/sdb, It worked (so far). All the correct partitions are there. I will send you a notification when it is complete!</p>
<p>Sounds good, maybe I'll try it out with an external hard drive to see if I can replicate the results.</p><p>Then I might add steps for that in this (or another) instructable.</p>
<p>This instructable it's very old but very helpful too! I'm trying to do these steps but in Windows. I can't find an option to set the flags of the partition. The partition created in the SD it's labeled as BOOT (yes, in uppercase) so I don't know if it will work. Thanks for sharing!</p>
<p>I can't help you if you're using Windows, that's why the beginning has that little section about this being an Ubuntu thing.</p><p>That's also why I apologized to the Windows people ahead of time :p</p>
<p>This worked perfect for me, but I have run into one problem. My Bluetooth dongle works on the pi but when I try to connect to a peripheral I get an error.</p><p>File &quot;/usr/bin/bluez-test-input&quot;, line 22, in &lt;module&gt;</p><p> adapter_path = manager.DefaultAdapter()</p><p> File &quot;/usr/lib/python2.7/dist-packages/dbus/proxies.py&quot;, line 70, in __call__</p><p> return self._proxy_method(*args, **keywords)</p><p> File &quot;/usr/lib/python2.7/dist-packages/dbus/proxies.py&quot;, line 145, in __call__</p><p> **keywords)</p><p> File &quot;/usr/lib/python2.7/dist-packages/dbus/connection.py&quot;, line 651, in call_blocking</p><p>Do you know why this might be happening?</p>
<p>Have you tried reinstalling the bluetooth drivers?</p><p>Are you sure it is compatible with Linux?</p>
<p>You are a freaking genius , worked first time , now running Linux Mate from 16 GB stick on Pi 3.:-)</p>
<p>Hi Prak97,</p><p>I'm new to Raspberry Pi, so new, my Pi 3 is still in the box!</p><p>But I would really like to know how to boot from USB. So I'm wondering if you can make a step by step how to guide?</p><p>Cheers in Advance!</p>
<p>This is what the tutorial is about?</p>
<p>Thanks for the post. I did have issues using the dd command in Linux. Had to use imagewriter in Windows. All working on a 2TB USB drive. Very happy.</p>
<p>To be clear this doesn't boot the Pi from the drive correct? it instead is just migrating the rootfs to the flashdrive. From my understanding you CANNOT &quot;boot&quot; from a flashdrive. (thus why you need to keep the SD card with the boot partition in the pi)... As for moving the rootfs this instructable follows exactly the process that I've used multiple times and will increase the life of the Pi :)</p>
<p>Sigh. I keep seeing articles/&quot;how-to&quot;-'s/youtube videos with this title... and none that have accomplished it as you describe. T_T</p>
<p>nice, works perfect here!</p>
<p>Hmm, I had forgotten about pv, but dd also prints I/O stats if you give it a SIGUSR1 (kill -USR1 $(pidof dd)</p>
<p>Whats that black connector on the HDMI port for?</p>
<p>earth wire for the sound output by looks of it as he couldnt get 2 clips in the audio out socket!</p>
<p>most likely a ground to protect from static with no enclosure </p>
<p>It's for ground on the composite video, I'm posting an instructable soon.</p>
Could you just flash Raspbian to an SD card, then edit the commandline file? Or do you have to go through all the partitioning steps?
<p>I have no cmdline.txt... Any ideas?<br><br>I try to make handylinux bootable and I'm under LinuxMint Debian Edition</p>
<p>hp-probook-6470b PERSO # dd if=/dev/sdc1 | pv | dd of=/dev/mmcblk0p1 <br>dd: &eacute;criture vers &laquo; /dev/mmcblk0p1 &raquo;: Aucun espace disponible sur le p&eacute;riph&eacute;rique ] <br>56,1MiO 0:00:09 [5,68MiB/s] [ &lt;=&gt; ] <br>114689+0 enregistrements lus <br>114688+0 enregistrements &eacute;crits <br>58720256 octets (59 MB) copi&eacute;s, 18,8307 s, 3,1 MB/s</p>
<p>Good work! The best part about this is that USB 2.0 is 5 times faster than the SD card reader in Pi. Thanks</p>
Could you post a tutorial on how you connected the monitor with the rca cables
<p>I'm working on a tutorial at your request.</p>
<p>just search for for raspberry pi to rca conector you can buy one online</p>
Is Raspberry Pi a Linux distribution?
<p>no raspberry pi is a computer</p><p>raspbian is a Debian distro.</p>
Yes, the Raspberry Pi runs a flavor of debian linux called Raspbian
But the raspberry pi itsself is not a Linux distribution. It is developed and made by the Raspberry Pi Foundation
<p>hye there.. i would like to install kali linux on my external hdd.. can i boot it from pi using this concept?</p>
<p>it should work just install the image to the hdd so you have more space to use instead of a littel 8gb card</p>
<p>could this work with a kali linux arm image (its Debian based like raspbian)</p>
<p>Brilliant! I had wondered how to do this, but it never occurred to me to use dd. &gt;.&lt; <br><br>Thanks. :)</p>
<p>FWIW, this is a great way to handle hiccups if you're recording video from a USB webcam. I was putting together a baby monitor using an old RPi model B, and spent a lot of time pulling my hair out over the video. It would run fine for about a minute, then start stuttering all over the place. It turned out the SD card write speed wasn't fast enough to handle that much data streaming to disk.</p><p>Booting from a USB drive solve the issue for me.</p>
<p>1) Adafruit sells the 4 conductor 3.5mm stereo /composite plug for the composite video and L/R</p><p>2) It looks like the same thing can be done for boot to usb hd.</p>
Why are you hooked up to the HDMI via a jumper. Does your USB have ground issues?
<p>It's actually hooked up to the metal casing around the HDMI connector. The case is connected to ground and the white jumper is touching the composite output pin inside of the analog connector. I just chose the HDMI case because it is close to the analog output jack and is facing the same direction... just for aesthetic purposes :p</p>
Nice tutorial! I don't need to do this, but it was interesting looking through the process to familiarize myself with Linux =D

About This Instructable




Bio: I am a total nerd who works as a software developer, and knows a bit about computer/software technology. Plus I like space and vintage ...
More by techno guy:Using Multisystem on the Second Partition Raspberry Pi 2: Quick n' Easy RCA Boot the Raspberry Pi from USB 
Add instructable to: