Preparing an SD card manually
An alternative to using NOOBS is to manually write the operating system image to the SD card. While this was originally the only way to install the operating system, some users still prefer it. It allows the SD cards to be prepared before they are used in Raspberry Pi. It can also provide easier access to startup and configuration files, and it leaves more space available for the user (unlike NOOBS, a RECOVERY partition isn't included).
The default Raspbian image actually consists of two partitions, BOOT and SYSTEM, which will fit into a 2 GB SD card (4 GB or more is recommended).
You need a computer running Windows/Mac OS X/Linux (although it is possible to use another Raspberry Pi to write your card; be prepared for a very long wait).
Download the latest version of the operating system you wish to use. For the purpose of this book, it is assumed you are using the latest version of Raspbian available at http://www.raspberrypi.org/downloads.
Perform the following steps depending on the type of computer you plan to use to write to the SD card (the .img file you need is sometimes compressed, so before you start, you will need to extract the file).
The following steps are for Windows:
- Ensure that you have downloaded the Raspbian image, as previously detailed, and extracted it to a convenient folder to obtain an .img file.
- Obtain the Win32DiskImager.exe file available at http://www.sourceforge.net/projects/win32diskimager.
- Run Win32DiskImager.exe from your downloaded location.
- Click on the folder icon and navigate to the location of the .img file and click on Save.
- If you haven't already done so, insert your SD card into your card reader and plug it into your computer.
- Select the Device drive letter that corresponds to your SD card from the small drop-down box. Double-check that this is the correct device (as the program will overwrite whatever is on the device when you write the image).
- Finally, click on the Write button and wait for the program to write the image to the SD card, as shown in the following screenshot:
- Once completed, you can exit the program. Your SD card is ready.
The following steps should work for the most common Linux distributions, such as Ubuntu and Debian:
- Using your preferred web browser, download the Raspbian image and save it in a suitable place.
- Extract the file from the file manager or locate the folder in the terminal and unzip the .img file with the following command:
unzip filename.zip
- If you haven't already done so, insert your SD card into your card reader and plug it into your computer.
- Use the df -h command and identify the sdX identifier for the SD card. Each partition will be displayed as sdX1, sdX2, and so on, where X will be a, b, c, d, and so on for the device ID.
- Ensure that all the partitions on the SD card are unmounted using the
umount /dev/sdXn command for each partition, where sdXn is the partition being unmounted. - Write the image file to the SD card, with the following command:
sudo dd if=filename.img of=/dev/sdX bs=4M
- The process will take some time to write to the SD card, returning to the Terminal prompt when complete.
- Unmount the SD card before removing it from the computer, using the following command:
umount /dev/sdX1
The following steps should work for most of the versions of OS X:
- Using your preferred web browser, download the Raspbian image and save it somewhere suitable.
- Extract the file from the file manager or locate the folder in the terminal and unzip the .img file, with the following command:
unzip filename.zip
- If you haven't already done so, insert your SD card into your card reader and plug it into your computer.
- Use the diskutil list command and identify the disk# identifier for the SD card. Each partition will be displayed as disk#s1, disk#s2, and so on, where # will be 1, 2, 3, 4, and so on, for the device ID.
- Ensure that the SD card is unmounted using the unmountdisk /dev/diskX command, where diskX is the device being unmounted.
- Write the image file to the SD card, with the following command:
sudo dd if=filename.img of=/dev/diskX bs=1M
- The process will take some time to write to the SD card, returning to the Terminal prompt when complete.
- Unmount the SD card before removing it from the computer, using the
following command:
unmountdisk /dev/diskX
Refer to the following diagram: