Adafruit Raspberry Pi Lesson 1 Preparing and SD Card For Your Raspberry Pi
Adafruit Raspberry Pi Lesson 1 Preparing and SD Card For Your Raspberry Pi
Guide Contents Guide Contents Overview You Will Need Downloading an Image Choose your Operating System Choose your Distribution Making an SD Card Using a Windows Vista / 7 Making an SD Card Using a Mac Test & Configure BONUS! Make a Backup Image!
Back it up! What You'll Need Get the Script File Run the Script Problems?
2 3 4 6 6 6 8 10 13 15
15 15 15 16 18
Adafruit Industries
http://learn.adafruit.com/adafruit-raspberry-pi-lesson-1-preparing-andsd-card-for-your-raspberry-pi
Page 2 of 19
Overview
When you buy a Raspberry Pi, it may or may not be sold with an SD card. The SD card is important because this is where the Raspberry Pi keeps its operating system and is also where you will store your documents and programs.
Even if your Pi came with an SD card with the operating system on, it is a good idea to update it to the latest version, as improvements and bug fixes are going in all the time. Since putting the operating system onto an SD card wipes everything else off the card, it is worth considering using a USB flash drive for your documents, so that when you install a new version of the operating system, you don't have the complication of copying them off somewhere safe before reformatting the SD card. If your Pi did not come with an SD card then the minimum size you should get is 4GB, but buy a bigger SD card if you think you will need the space. This lesson shows you how to create an SD card for your Raspberry Pi.
Adafruit Industries
http://learn.adafruit.com/adafruit-raspberry-pi-lesson-1-preparing-andsd-card-for-your-raspberry-pi
Page 3 of 19
An SD card at least 4GB in capacity. You can pick one up that is tested guaranteed to work with the Raspberry Pi at the Adafruit shop (http://adafru.it/102)
Adafruit Industries
http://learn.adafruit.com/adafruit-raspberry-pi-lesson-1-preparing-andsd-card-for-your-raspberry-pi
Page 4 of 19
Adafruit Industries
http://learn.adafruit.com/adafruit-raspberry-pi-lesson-1-preparing-andsd-card-for-your-raspberry-pi
Page 5 of 19
Downloading an Image
The operating system that will be installed onto the SD card must be downloaded from the Internet. This will usually be a zip file that then extracts to a file of type .img an image file. Whatever image file you download, the actual installation process is the same.
Adafruit Industries
http://learn.adafruit.com/adafruit-raspberry-pi-lesson-1-preparing-andsd-card-for-your-raspberry-pi
Page 6 of 19
Incidentally, the name Occidentalis come from the Latin name for the raspberry (Rubus Occidentalis). So, having made your choice, download the zip or img file and if it is in a zip file unzip it onto the Desktop.
Adafruit Industries
http://learn.adafruit.com/adafruit-raspberry-pi-lesson-1-preparing-andsd-card-for-your-raspberry-pi
Page 7 of 19
Step 5. Select the image file and device. To do this, click the Browse button and navigate to the .img file for the distribution that you want to install and the select the device from the drop-down.
Adafruit Industries
http://learn.adafruit.com/adafruit-raspberry-pi-lesson-1-preparing-andsd-card-for-your-raspberry-pi
Page 8 of 19
Check that you have the right device, as it will be reformatted, and then click Install. It will take a few minutes to install, but once the SD card is ready, you will see the following.
That's all there is to it. Your SD card is ready for use in your Raspberry Pi.
Adafruit Industries
http://learn.adafruit.com/adafruit-raspberry-pi-lesson-1-preparing-andsd-card-for-your-raspberry-pi
Page 9 of 19
Step 1. Download Raspberry-PI-SD-Installer-OS-X from https://github.com/RayViljoen/Raspberry-PI-SDInstaller-OS-X (http://adafru.it/aTe) Look for the 'zip' button at the top and download it as a single zip file.
Step 2. Extract the zip file. It will expand into a folder called 'Raspberry-PI-SD-Installer-OS-X-master'.
Step 3. Use Finder to move the img file that you downloaded earlier into the Raspberry-PI-SD-InstallerOS-X-master folder. You can see here that I have both the Occidentalis and Raspbian images in the folder. That is fine, you can have as many images as you like in the folder.
Step4. Open the Terminal app you will find this in the Utilities folder of your Applications folder on your Mac. Then type the command 'cd' followed by the path of your Raspberry-PI-SD-Installer-OS-Xmaster folder.
Adafruit Industries
http://learn.adafruit.com/adafruit-raspberry-pi-lesson-1-preparing-andsd-card-for-your-raspberry-pi
Page 10 of 19
Step 5. Eject any external drives that you have connected to your computer. This just makes it easier to identify the correct drive that corresponds to your SD card. Insert the SD card that you want to use. Note that all data on this card will be erazed.
Step 6. Run the Pi Installer by typing the following command into the Terminal: > sudo ./install Occidentalis_v02.img 'Occidentalis_v02.img' is the name of the img file for the distribution that you want to install. You will be prompted for your Mac password and then should see this:
Step 7.
http://learn.adafruit.com/adafruit-raspberry-pi-lesson-1-preparing-andsd-card-for-your-raspberry-pi
Adafruit Industries
Page 11 of 19
Enter the number next to the SD card drive. Make sure you get this right, because whichever drive you select will be erased. It is then just a matter of waiting until all the image file is installed. This will take a few minutes. You can check on the progress by pressing ctrl-T When everything is complete, you should see this:
Thats all there is to it, the SD card is now ready to use with your Raspberry Pi.
Adafruit Industries
http://learn.adafruit.com/adafruit-raspberry-pi-lesson-1-preparing-andsd-card-for-your-raspberry-pi
Page 12 of 19
If you plan to use multiple SD cards, it is not a bad idea to label them. Put the label on the side that shows when the SD card is inserted into the Pi. Testing the card is easy - insert it into your Pi, then connect a keyboard to the USB port and a NTSC/PAL TV to the composite port or an HDMI monitor to the HDMI Port. Then power it by connecting a Micro USB cable to the Pi and powering it via a computer or a USB wall charger You should see something like the following, an Adafruit/Raspberry logo in the top left, and a ton of text filling up the screen
In the next tutorial, you will find out how to configure your Raspberry Pi the first time you boot it up.
Adafruit Industries
http://learn.adafruit.com/adafruit-raspberry-pi-lesson-1-preparing-andsd-card-for-your-raspberry-pi
Page 14 of 19
Back it up!
Forum user, Mac user, and Adafruit Customer phil.drummond took it upon himself to find the best way to back up his system image. And he found a fast and easy way - a script which quickly creates a clone of your running Raspberry Pi system, ON THE PI ITSELF!
Adafruit Industries
http://learn.adafruit.com/adafruit-raspberry-pi-lesson-1-preparing-andsd-card-for-your-raspberry-pi
Page 15 of 19
...Or... Use the Pi's Web Browser to navigate to this page and download the script file directly
When you run the script, you will have to specify the name of your SD card. Raspbian and occidentalis assign the names 'sda', sdb', etc. to SD cards found on USB. If you only have one USB card reader attached, the name of your new SD card will be 'sda'. If you're not sure that sda is the right card, you can run this command to list the cards connected to your Pi.
sudo fdisk -l
The SD card slot with your running Pi system will show up as /dev/mmcblk0. Your blank card will be listed as /dev/sda1 (or possibly /dev/sdb1, if you have more than one USB card readers attached to the Pi). Note that you don't enter the '1' - if your card is listed as '/dev/sda1', then you would still enter 'sda' when you run the script ('sda' is the name of the card, 'sda1' is the name of the first partition on the card). Ok, so now you should be ready to run the commands
chmod +x rpi-clone.sh sudo ./rpi_clone sda -f
Adafruit Industries
http://learn.adafruit.com/adafruit-raspberry-pi-lesson-1-preparing-andsd-card-for-your-raspberry-pi
Page 16 of 19
As noted earlier, the first parameter passed to the script is is the name of the target SD card, in this case 'sda'. The -f tells the script to entirely re-format the card. The script will ask you if you're sure you want to initialize the destination card. Type 'y', and hit the return key.
If you see an error message instead, check below for solutions! Next, the script will ask you if you want to give your new backup a label. It's not necessary to do this - just hit the return key.
Finally, the script will ask you if you're sure you really want to do this, before it begins creating the backup. Type 'y', and hit the return key.
Adafruit Industries
http://learn.adafruit.com/adafruit-raspberry-pi-lesson-1-preparing-andsd-card-for-your-raspberry-pi
Page 17 of 19
Now it's time to wait - the process will take a little while.
When the process is complete, the script will ask if it should unmount the card with your new system clone/ Reply with 'y', and you're done!
Now you can shutdown the Pi, swap the clone into the Pi's SD Card Slot, and restart - Bingo! a fully-operational clone of your Raspberry Pi system!
Problems?
If you see an error message like this:
Adafruit Industries
http://learn.adafruit.com/adafruit-raspberry-pi-lesson-1-preparing-andsd-card-for-your-raspberry-pi
Page 18 of 19
...it means that your SD card is mounted in the file system. You have to unmount it before you can proceed. In the picture, I'm writing over an earlier clone of my system, which has two partitions: /dev/sda2 and /dev/sda1. You might only have one partition. In any case, issue the umount command for each mounted partition on your destination SD card:
sudo umount /dev/sda1
Adafruit Industries
Page 19 of 19