[~] BACK



~~ FLASH SD CARDS ~~

** BASICS **

[HOW] | [20200511] | [0] | [0x17]




If you play around a lot with small computers, you also need operating systems that usually have to be flashed onto SD cards or micro SD cards. This process is quite simple and can be done under Linux or macOS with the same tools.

First we have to find out what name or address our SD card has. We do this as usual via the terminal:

shell
diskutil list


This command shows all mounted devices in your system:

output
/dev/disk0 (internal, physical): #: TYPE NAME SIZE ID 0: GUID_partition_scheme *251.0 GB disk0 1: EFI EFI 314.6 MB disk0s1 2: Apple_APFS Container disk1 250.0 GB disk0s2 /dev/disk2 (synthesized): #: TYPE NAME SIZE ID 0: SD CARD - +250.0 GB disk2s2


This gives us the ID of our SD card. In this case "disk2". In order to flash the OS onto it, we need to unmount the SD card. This is done with:

shell
diskutil unmountdisk disk2


As soon as you have received the message that the SD card is unmounted, you can start flashing. To do this, we use the dd tool, which is pre-installed on macOS and Linux. ATTENTION: If you accidentally use the wrong ID, your entire internal hard drive could be overwritten and your data will be lost. So make sure you are flashing the right device beforehand!

shell
sudo dd if="/path/to/image" of="/dev/disk2" bs=8m


What is "dd" doing here? The parameter "if=" specifies the path to the OS image, the parameter "of=" points to the path to the SD card, and "bs=8m" is the block size with which the image is written to the SD card.

Don't be surprised if nothing happens in the terminal for a long time - "dd" does not show the status of the writing process by default. Since version 8.24 of "dd" there is apparently the option to display the status - I haven't tried it myself yet. With status the command would then look like this:

shell
sudo dd if="/path/to/image" of="/dev/disk2" bs=8m status=progress


When "dd" has finished, you will get a message that looks similar to this:

output
12780+0 records in 12780+0 records out 6543360 bytes (6.4 MB) copied, 5.9723 seconds, 1 MB/s


Once flashing is complete, you can insert the SD card into your Raspberry Pi or similar computer and you're ready to go.
[~] BACK