Writing a Raspberry Pi image on SD card

Identifying the SD Card mounting point to write the Raspberry Pi system image. Start by opening a command line as Root, and type the command lsblk to get existing list of available drive(s).

The usage of this information can damage your current system. Please use care and make sure to follow recommendations, advice and also your own analysis before proceeding. I will not take responsibility for any damage you may cause to your system following these instructions.

arnaud@VBM-Testing: ~$ sudo su
[sudo] password for arnaud:
root@VBM-Testing:/home/arnaud# lsblk
NAME   MAJ:MIN  RM    SIZE   RO   TYPE   MOUNTPOINT
sda      8:0     0     60G    0   disk   
-sda1    8:1     0     60G    0   part   /
sr0     11:0     1   1024M    0   rom

Then connect the SD Card by plugging it into the SD Card reader and type the same command again, lsblk. We will now get the SD Card information by comparison.

root@VBM-Testing:/home/arnaud# lsblk
NAME   MAJ:MIN  RM    SIZE   RO   TYPE   MOUNTPOINT
sda      8:0     0     60G    0   disk   
-sda1    8:1     0     60G    0   part   /
sdb      8:16    1   15.1G    0   disk
-sdb1    8:17    1   15.1G    0   part   /media/arnaud/SD16GB
sr0     11:0     1   1024M    0   rom

Here we can see a new device in the list, name sdb, with 1 partition on it: sdb1. That is a SD Card as it is the only device we connected in between. We can also see the partition is mounted. We need to un-mount them with umount command.

root@VBM-Testing:/home/arnaud# umount /media/arnaud/SD16GB

Note 1: The SD card was already imaged with a Raspbian image, that I wasn’t using anymore, you may see only 1 partition on the SD Card that have the size of the entire SD Card.

Note 2: Raspbian project has been renamed “Raspberry Pi OS” but it is none the less the same thing. As running the command on a “Raspberry Pi OS” cat /etc/os-release provide the following results and Raspbian naming is still all around. Don’t get confused by that in the near future. It is also very possible that changes later as well.

cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

We need to extract it from the zip file we downloaded before we can write it to the SD card, for that we will use unzip command. The file will be extracted in the current folder with command below (eg. /home/arnaud/ in this example).

root@VBM-Testing:/home/arnaud# unzip Downloads/2019-04-08-raspbian-stretch-lite.zip

We can now write the Raspberry Pi image to the SD Card using the command dd. This command will copy 4MB bs=4M at the time, from the source image if=2019-04-08-raspbian-stretch-lite.img to the SD Card of=/dev/sd. It will done synchronously with conv=fsync (meaning it will finish to write on the SD Card before reading the next 4MB of the image source) and status=progress will also display progression of the entire process.

root@VBM-Testing:/home/arnaud# dd bs=4M if=2019-04-08-raspbian-stretch-lite.img of=/dev/sdb conv=fsync status=progress

Progression will look like this:

448790528 bytes (449 MB, 428 MiB) copied, 14 s, 31.1MB/s

Note 3: Soon I will add a new article with my preferred 1st steps after getting the SD Card ready, those are definitely options but as mentioned my preferred steps before booting the OS for the 1st time. That article will be linked about here at the end of this article (just be patient for that one if you land here before I write it).

Once copy is completed it will return to regular prompt. The SD Card may mount automatically again, dismount it in this case, and remove it from the computer. We are now ready to boot from it using the Raspberry Pi.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.