Using GUI tools

Download and install Raspberry Pi Imager (for Ubuntu, MacOS, and Windows)

You might be able to install Raspberry Pi Imager from your local repo as well with this command.

Using Raspberry Pi Imager should be pretty easy to use. You select the image, select the micro SD card and then write the image.

If you are unsure which Raspberry Pi OS image to choose, I typically choose the Raspberry Pi OS Full image. That one is under Raspberry Pi OS (other) option. If you only want to experiment with docker, then the Raspberry Pi OS Lite image could be used.

Once you installed your image, unmount and disconnect your micro SD card.

Here is a video tutorial: https://youtu.be/B-XnoWCxU0M?t=103

Using CLI tools

This guide will be handy if you have never installed a image into a micro SD card. If you have before in the past, I still recommend reading this as it might include useful tips.

As with any new project, it’s recommended to create a new folder so you can keep all related files in a single location.

Feel free to substitute the folder location with any other preferred location. Once the folder for this project is created, enter that same folder.

mkdir ~/Downloads/RPi_Images
cd ~/Downloads/RPi_Images

Download the latest Raspberry OS image. If you are unsure if 2020-08-20-raspios-buster-armhf-full.zip is the latest version at the time of writing, you could always check this link.

wget http://downloads.raspberrypi.org/raspios_full_armhf/images/raspios_full_armhf-2020-08-24/2020-08-20-raspios-buster-armhf-full.zip

While the latest Raspberry OS image is downloading, you will now want to mount your micro SD card to your computer. Go a head and mount your micro SD card to your SD card reader. Here is an example of a SD card reader that will also work with micro SD cards.

Once your micro SD card is attached to your machine, you will then need to figure where the path is to your micro SD card. The easiest way to do this is by running the lsblk command. You can then compare sizes of disks until you are comfortable you have the correct device.

lsblk

Since my personal micro SD card is 32GB in size, I can easily tell that my SD card lives at /dev/sdh

If you see a number at the end, that’s a partition. Not a disk. In the example below, /dev/sda2 is the root partition on a hard drive. Where as /dev/sdh is the whole micro SD card, not just a partition on the disk.

sda      8:0    0  55.9G  0 disk 
├─sda1   8:1    0   512M  0 part /boot/efi
└─sda2   8:2    0  51.4G  0 part /
sdb      8:16   0 596.2G  0 disk 
└─sdb1   8:17   0 596.2G  0 part /media/hdd1
...
sdh      8:112  1  29.8G  0 disk 
...

It’s better to manage disks through /dev/disk/by-id/ instead of /dev/sd*

The reason behind this is because disk mounted at /dev/sd* can change often. So if you aren’t checking where your drive is mounted, then you could wipe a different drive by mistake.

Going forward, try to use /dev/disk/by-id/ -or, an even safer way is to use – /dev/disk/by-uuid/ (but we will not cover that here)

ls -l /dev/disk/by-id/

From the output we can see that my micro SD card is mounted at /dev/disk/by-id/usb-Generic_STORAGE_DEVICE_000000000946-0:4

If your SD card reader doesn’t have an easy to understand id, then you can look to see where the symlink goes to. Since we know that our micro SD card is mounted to /dev/sdh, we can simply look for that symlink instead.

lrwxrwxrwx 1 root root  9 Sep 14 07:57 usb-Generic_STORAGE_DEVICE_000000000946-0:4 -> ../../sdh

Now that you know where your micro SD card is, let’s make sure no partitions are mounted. There is an added asterisk * at the end, so that the umount command moves through and unmounts all of the available partitions on that disk.

sudo umount --quiet /dev/disk/by-id/usb-Generic_STORAGE_DEVICE_000000000946-0:4*

Now that you unmounted the micro SD card, you can then wipe it.

sudo wipefs --all /dev/disk/by-id/usb-Generic_STORAGE_DEVICE_000000000946-0:4

Hopefully, by now, you have downloaded the Raspberry Pi OS image.

From here, we will use that downloaded image to “flash” the image onto the SD Card using a dd command.

I found that it takes less disk space to unzip the Raspberry Pi OS image directly to the SD card rather than unzipping the image to a file, then flashing the uncompressed image.

unzip -p 2020-08-20-raspios-buster-armhf-full.zip | sudo dd status=progress bs=1M conv=fsync iflag=fullblock of=/dev/disk/by-id/usb-Generic_STORAGE_DEVICE_000000000946-0:4

Depending on the SD card and the speed of the SD card reader, it might take from 5-15 minutes to complete the dd command, typically.

If you have a computer with a lower powered CPU, you might want to extract the .img file from the 2020-08-20-raspios-buster-armhf-full.zip file first. That might also increase the speed of the dd command. But this is not needed if you already “flashed” the image from the previous command.

unzip 2020-08-20-raspios-buster-armhf-full.zip
sudo dd status=progress bs=1M conv=fsync iflag=fullblock if=2020-08-20-raspios-buster-armhf-full.img of=/dev/disk/by-id/usb-Generic_STORAGE_DEVICE_000000000946-0:4

At this point you can unmount the SD card and insert it into the Raspberry Pi.

When you type the umount command, remember to include the * at the end so that both partitions are unmounted.

sudo umount --quiet /dev/disk/by-id/usb-Generic_STORAGE_DEVICE_000000000946-0:4*

You might want to use the lsblk command one last time to make sure that the micro SD card is not mounted.

Complete!

At this point you can plug in the micro SD card into your Raspberry Pi. Usually you will have to leave the Raspberry Pi on long enough for the partitions to fully extend. I would leave your Raspberry Pi on for at least 5 minutes, or until your screen shows output that allows you to proceed.

Summary of commands:

mkdir ~/Downloads/RPi_Images
cd ~/Downloads/RPi_Images
wget http://downloads.raspberrypi.org/raspios_full_armhf/images/raspios_full_armhf-2020-08-24/2020-08-20-raspios-buster-armhf-full.zip
lsblk
ls -l /dev/disk/by-id/
sudo umount --quiet /dev/disk/by-id/usb-Generic_STORAGE_DEVICE_000000000946-0:4*
sudo wipefs --all /dev/disk/by-id/usb-Generic_STORAGE_DEVICE_000000000946-0:4
unzip -p 2020-08-20-raspios-buster-armhf-full.zip | sudo dd status=progress bs=1M conv=fsync iflag=fullblock of=/dev/disk/by-id/usb-Generic_STORAGE_DEVICE_000000000946-0:4
sudo umount --quiet /dev/disk/by-id/usb-Generic_STORAGE_DEVICE_000000000946-0:4*

If you have any questions, please leave a comment below!

How to install Raspberry Pi images onto a micro SD card
Tagged on:                         

Leave a Reply

Your email address will not be published. Required fields are marked *