[~] NERDBUDE

[?] CODE / KEYBOARDS / TERMINAL / NIXOS


[M] [POSTS] [HOWTO] [WHOAMI] [PODCASTS] [KEYBOARDS]


~~ SD CARDS ~~

** FLASHING SD-CARDS **

[HOW] | [20200511] | [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:

1diskutil list

This command shows all mounted devices in your system:

1/dev/disk0 (internal, physical):
2   #:                       TYPE NAME                    SIZE       ID
3   0:      GUID_partition_scheme                        *251.0 GB   disk0
4   1:                        EFI EFI                     314.6 MB   disk0s1
5   2:                 Apple_APFS Container disk1         250.0 GB   disk0s2
6
7/dev/disk2 (synthesized):
8   #:                       TYPE NAME                    SIZE       ID
9   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:

1diskutil 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!

1sudo 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:

1sudo 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:

112780+0 records in 12780+0 records  out  6543360  bytes
2  (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