Raspberry Pi is a cheap and tiny single-board computer powered by ARM processor. While it was mainly developed for children to learn computer programming, it has also become a versatile device for DIY electronic enthusiasts or computer professionals who build many useful tools based on the tiny hardware.
Raspberry Pi comes in two different models with the following specifications.
- A model: 256 MB RAM, 1 USB port, no Ethernet port
- B model: 512 MB RAM, 2 USB ports, 1 Ethernet port (shown in the picture)
Raspberry PI uses an SD card as backing storage for an operating system and other tools. In this tutorial, I will describe how to write a Raspberry PI image to an SD card.
Raspberry Pi Images
There are several flavors of raw Raspberry PI images (e.g., Raspbian, Pidora, Risc OS, RaspBMC, Arch, and OpenElec) which you can download from Raspberry PI's official site. All these images are compatible with both model A and B.
The RaspBMC and OpenElec images are mainly used for multimedia purposes. With either image installed, Raspberry Pi can be turned into a tiny multimedia center. You can play movie files, audio files, watch online TV, etc.
The Raspbian, Pidora and Risc OS images are like regular operating systems for ARM processors. You can install any application or service on these operating systems, such as web server, file server, access point, etc.
The NOOBS image provides the easiest and most convenient way for you to write Raspberry Pi operating systems without worrying about manually flashing an image into an SD Card. It contains more than one Raspberry Pi operating systems. Upon first boot, NOOBS automatically formats an SD card, and asks you to choose an OS to install from a list.
In this article, I am going to use Raspbian image which based on Debian.
Prepare for Burning Raspbian Image to an SD Card
To burn a Raspbian image, it is recommended to use a class 10 SD card with minimum 4 GB storage.
Before starting the process, first download the Raspbian image from the official download page. The image comes as a zip file. Unzip the file to extract the Raspbian image file.
Burn Raspbian Image to an SD Card on Linux
Insert your SD card into the card reader.
First, you need to identify the device name for the SD card. For that, you can use lsblk command which shows information about available block devices.
From listed block devices, identify your SD card by checking their sizes. In this example, my SD card is 16GB, which is mapped to sdb device name. Thus the full device name of your SD card is "/dev/sdb". Make a note of this device name as you need it later.
You do not need to create or format any partition on the SD card. If there is already a partition or filesystem created on the SD card, it will be overwritten by dd command subsequently anyway.
If the SD card is mounted, make sure to unmount it now.
Now empty the mounted SD card by "zero-ing out" the SD card device:
Finally, write Raspberry Pi image to the SD card with dd command:
The "bs" argument sets the block size to 4 MB. Normally the "bs" argument will work with 4M, but you can change to 1M, which will take longer time to write. The "if" argument sets the full path to Raspbian image, and the "of" argument specifies the device name of the SD card. Here "/dev/sdb" is the device name you identified with lsblk command earlier. Note that the dd command will not give you any feedback during its operation, and it will look like freezing. So be patient until writing is finished.
After the writing process is finished, eject the SD card. Plug in to the Raspberry Pi, and make sure that all the connections are ready (HDMI/TV out, keyboard, mouse, Ethernet cable). Finally, turn on the power.
Besides using dd command, you can also try other image writer applications such as usb-imagerwriter for deb based distributions, and imagewriter for rpm based distributions. These tools will make the image writing process more user-friendly than dd command.
NOTE: the Raspbian image written to an SD card only occupies less than 4GB of space. Thus, the installed Raspbian will not recognize the rest of an SD card beyond Raspbian image size. To utilize all available SD card space, you will need to "expand" the Raspbian file system. In fact, the file system expansion is one of the first things you need to do after powering up Raspberry Pi.
Burn Raspbian Image to an SD Card on Windows
First, download and install SD Card Formatter from SD Associations.
Insert your SD card into the card reader, and then format the SD card with SD Card Formatter. Formatting options do not matter, as the formatted filesystem will be overwritten during the subsequent image writing step. The reason why we format the SD card is to make the card recognized by the operating system.
Next, download and install win32diskimager application which can flash an SD Card.
Launch win32diskimager. After locating the extracted Raspbian raw image via a built-in file dialog box, write the image to an SD card. It will take some times to finish writing the image into the SD card.
After the writing process is finished, eject the SD card and plug in to the Raspberry Pi.
Subscribe to Xmodulo
Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.