This tutorial explains the step by step about how to burn Raspbian GNU/Linux image into a microsd card from Ubuntu. The bootable microsd later will be a Raspbian installer media for Raspberry Pi device. Please be carefl while performing this tutorial.
Requirements
To perform this tutorial you will need to prepare
- A Raspbian GNU/Linux image. Download it from https://www.raspberrypi.org/downloads/raspbian/.
- A new (cleanly formatted as FAT32) microsd card with at least 8 GB capacity.
- A GNU/Linux system to burn the image e.g. Ubuntu.
- A USB microsd adapter for PC (optional).
List of Commands
- df -h
- umount
- dd
- pkill
- sync
Warning!
Please never perform any part of this tutorial when you are not in a ready state. Don't perform anything when you are sleepy. Please pay high attention and concentration to every device name in your own computer and understand every command line carefully. Don't make any mistake otherwise you may destroy all of your data.
1. See The Default Devices
Before doing anything, do perform the command sudo df -h to see all the devices available in your computer.
2. Insert The microSD
Insert your empty microsd to your computer. If your computer has no slot for microsd, then insert it into an adapter and insert the adapter to your computer.
3. See The MicroSD Device Name
Ubuntu will detect your microsd device, then mount it automatically by default. You will notice this while you see the file manager (Nautilus) shows the microsd storage content. Now do perform the command sudo df -h once again and you must notice a new name from the output. Usually, the device name for a microsd is /dev/sdc1 or /dev/mmcblk0p1. The last number such as 1 or p1 is the partition number. The device name for it is /dev/sdc or /dev/mmcblk0. Please pay attention and note the name you find carefully.
4. Unmount the Mounted MicroSD Device
The easiest one is by clicking Unmount button on your microsd entry in the file manager. If you can't do it, open a terminal (Ctrl+Alt+C) and do perform unmount command:
sudo umount /dev/sdc1 sudo umount /dev/mmcblk0p1
depending on the device name of your microsd. Please adapt those device names according to your own system's device name.
5. Extract Raspbian Archive File
Now, in your file manager, do extract the Raspbian ZIP file to get the .img file. This .img file is the real file you would burn into microsd not the .zip file. In our system, Raspbian ZIP file is at size 1 GB and the .img file extracted is about 4 GB. Please pay attention about the path address of the .img file. In our system, the .img path address is /media/master/gudang/2016-03-18-raspbian-jessie.img.
6. Burn
After having /dev/sdc1 as the partition of microsd device, forget the number so you will get the device path of microsd device: /dev/sdc. The one we will use is the device path (/dev/sdc), the whole device, and not the partition (/dev/sdc1). If you have your microsd partition name is /dev/sdd1, then the device name is /dev/sdd and so on. Notice the number. Please don't make any mistake here otherwise you will destroy the whole system.
Burn the .img file into the already unmounted microsd device with this command example:
sudo dd bs=4M if=/path/to/raspbian/image.img of=/dev/sdc
Explanation:
- sudo: this command should performed as root.
- dd: copy and convert command to burn your image file into a device.
- bs=4M: block size, how much bytes dd command will read/write at a time
- if: input path.
- of: output path.
- /path/to/raspbian/image.img: the path address into your image file.
- /dev/sdc: the path address to your microsd device, not to the microsd partition. So the right name is /dev/sdc not /dev/sdc1. Please pay attention if your own device is located at different letter such as /dev/sdd or /dev/sde.
7. See The Real Time Progress
The dd command has no real time output while doing burning. So your console will be blank and probably you will be confused whether it is doing the right job or not. To overcome this, open a new terminal window, perform the command sudo pkill -USR1 -x -n dd, and see the dd terminal window you will see a progress output from dd command. Do perform the command sudo pkill -USR1 -x -n dd once again and you see a progress output in another terminal.
8. The Last Command
In our system, this takes about 10 minutes to finish. It is vary depends on your system specification. Once finished, you will see that the dd terminal goes back to the bash prompt. Then perform the last command: sync. According to the Raspberry installation documentation, this command will flush the write cache so you are safe to remove the microsd card. If you have performed the last command, then the burning progress has completely finished. You may use the microsd card for Raspberry Pi now.