How to Flash Raspberry Pi OS to an SD Card? (Step-by-Step Guide)
Hedy

Hedy @carolineee

About: Publish some interesting electronic articles

Joined:
Dec 18, 2023

How to Flash Raspberry Pi OS to an SD Card? (Step-by-Step Guide)

Publish Date: Aug 8
0 0

Flashing Raspberry Pi OS (formerly Raspbian) to an SD card is simple. Here’s how to do it on Windows, macOS, and Linux:

1. What You Need

  • A microSD card (8GB+ recommended, Class 10/UHS-I for best performance).
  • A microSD card reader (if your laptop doesn’t have one).
  • Raspberry Pi Imager (official tool) or BalenaEtcher (alternative).
  • Raspberry Pi OS image (download from raspberrypi.com/software).

2. Step-by-Step Instructions
Method 1: Using Raspberry Pi Imager (Easiest)

  1. Download Raspberry Pi Imager
  • Windows/macOS/Linux
  • Install and open it.
  1. Choose the OS

Click "Choose OS" → Select "Raspberry Pi OS" (or another version like Lite for headless).

  1. Select the SD Card
  • Insert the SD card into your computer.
  • Click "Choose Storage" → Pick your SD card.
  1. Flash the OS
  • Click "Write" → Confirm (this will erase the SD card!).
  • Wait (~5-15 mins, depending on speed).
  1. Eject Safely & Boot

Remove the SD card, insert it into your Pi, and power it on.

Method 2: Manual Flashing (Advanced)
On Windows (Using BalenaEtcher)

  1. Download Raspberry Pi OS (.img.xz file) from raspberrypi.com.
  2. Install BalenaEtcher.
  3. Open Etcher → Select Image → Choose SD Card → Flash!

On macOS/Linux (Using dd Command)

  1. Find your SD card (check with diskutil list on macOS or lsblk on Linux).

Example: /dev/disk2 (macOS) or /dev/sdb (Linux).

  1. Unmount the SD card (but don’t eject it):
bash
diskutil unmountDisk /dev/disk2  # macOS
sudo umount /dev/sdb*           # Linux
Enter fullscreen mode Exit fullscreen mode
  1. Flash using dd (replace /dev/disk2 with your SD card):
bash
sudo dd bs=4M if=~/Downloads/raspios.img of=/dev/disk2 conv=fsync status=progress
Enter fullscreen mode Exit fullscreen mode
  1. Eject safely and boot the Pi.

3. Post-Flash Setup (Optional)
Enable SSH (Headless Setup):

Before booting, create an empty file named ssh in the SD card’s boot partition.

Configure Wi-Fi (Headless):

Create a wpa_supplicant.conf file in boot with your Wi-Fi details:

plaintext
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
country=US
network={
    ssid="YourWiFi"
    psk="YourPassword"
}
Enter fullscreen mode Exit fullscreen mode

4. Troubleshooting
SD Card Not Detected?

Try a different USB reader or port.

Pi Won’t Boot?

  • Reflash the SD card (may be corrupted).
  • Try a different SD card (some cheap ones fail).

Slow Performance?

Use a UHS-I/U3 card for better speed.

Done!
Your SD card is ready. Plug it into your Pi, power it on, and follow the setup wizard.

Comments 0 total

    Add comment