I had a few issues setting up the SD card for my Raspberry Pi. The main problem I had was that the operating system didn’t make full use of the capacity of the SD card. I thought I’d share the steps I used to get it to work.
Before I go any further, I’d like to note that it was a Kingston SDHC 16GB Class 4 SD card that I used- plenty of storage there and it seems to work perfectly with the Pi. My main computer is a Mac so that’s what I used for transferring the operating system onto the SD card.
Steps for getting the operating system onto the SD card (Mac users)-
- Download the Raspbian “wheezy” image from the downloads section of the Raspberry Pi site. Personally, I went with the .zip file which I downloaded to the Desktop and extracted.
- Insert your SD card into your computer/laptop. Click on the Apple logo in the top left-hand corner of the screen. Then click “about this Mac” > “more info” > “system report” > “card reader” and find the entry listed as “BSD name”. This will have disk and a number next to it (in my case it was disk2s1- I’ll stick with this example).
- Open up the Terminal. This can be found under “applications” > “utilities”
sudo diskutil unmount /dev/disk2s1
- If this doesn’t work, try:
sudo diskutil unmountDisk /dev/disk2s1
- One the card has unmounted, enter:
sudo dd bs=1m if=path/to/where/you/downloaded/the/image/2012-12-16-wheezy-raspbian.img of=/dev/rdisk2
Remember, in the “of” section of the command, remember to put the disk number of your own SD card. Also, you need to prefix “disk” with “r” so it becomes “rdisk”. Just be careful during this step- you don’t want to get the disk number wrong and accidentally overwrite the operating system on your Mac- double-check you’ve done it right!
- While it’s copying the image to the SD card, the Terminal won’t provide you with any progress information. Instead it’ll just show a blinking cursor. Be patient! In fact, now would be a good time to grab a cup of tea.
- When it’s done, the Terminal will just show the usual comand prompt along the lines of:
- You’re not quite done yet- you need to eject the SD card:
sudo diskutil eject /dev/rdisk2
- Previously at this stage I inserted the card and started using the Pi which quickly ran out of space. I was puzzled, as I couldn’t possibly have filled a 16GB SD card by installing some Bluetooth tools and gedit. It turns out I’d missed an important step allowing the Pi to utilise the full size of the card. Read on…
- Insert the SD card into the Raspberry Pi. This next bit is definitely easier with a monitor so I recommend you connect the Pi into one temporarily (along with a keyboard) and switch it on.
- You will be asked to log in once it’s booted. Your username is “pi” and the password is “raspberry”.
This presents you with a menu. Choose “expand_rootfs” and confirm the changes. Exit the menu.
- The machine needs to be rebooted. Enter:
- The Pi will reboot and will start sorting out the size of the root partition, enabling you to use the full size of the SD card. This can take a bit of time so grab another cup of tea. Now for the reason I mentioned plugging it into a monitor while it’s resizing the partition- I tried to do this via ssh from the Mac. I couldn’t log in while it was resizing so I assumed something had gone wrong. In fact, it was doing exactly as I had asked it to do- I just couldn’t see it. If you have a monitor plugged in, it constantly tells you that it’s resizing the partition until it’s finished.
- When the Pi has finished resizing the root partition, you’re free to use it! That’s it (well unless you want to play around with the rest of the config options, but I’m not going to cover that)!