Installing OS Img

Choosing an OS

Raspberry Pi OS

Debian ARM

EndeavourOS ARM

Writing OS Image to a MicroSD Card

Once you’ve downloaded an OS image, the next step is to write it to your MicroSD card. The image file is often compressed (e.g., .img.xz) to save space, so you’ll need to decompress it first.

There are two main ways to get the image onto your card: using a simple graphical tool or using the powerful dd command in the terminal.

Method 1: Using Raspberry Pi Imager

For the vast majority of users, the safest and easiest method is to use the official Raspberry Pi Imager application.

This tool handles everything for you automatically:

  1. It lets you choose an OS from a list or use a custom .img file you’ve already downloaded.
  2. It automatically decompresses the file if needed.
  3. It safely identifies and writes to your MicroSD card.
  4. It verifies the write to ensure there were no errors.

You can download it for free from the official Raspberry Pi website. This is the highly recommended path for beginners and experts alike to avoid costly mistakes.

Method 2: Using the dd Command

[!WARNING] This method gives you direct control but is extremely dangerous if you are not careful. A single typo could wipe the data from your main hard drive. Proceed with caution!

  1. Decompress the Image

If your downloaded file ends in .xz, you first need to decompress it. Open your terminal and run:

unxz your-image-name.img.xz

This will extract the .img file from the compressed archive.

  1. Identify Your MicroSD Card

Insert the MicroSD card into your computer. Before you do anything else, you must correctly identify its device name. Use the lsblk command to list all block devices.

lsblk

Look for a device whose size matches your MicroSD card (e.g., 16G, 32G, 64G). It will likely be named /dev/sda, /dev/sdb, or /dev/mmcblk0.

[!IMPORTANT] Triple-check that you have identified the correct device.

  1. Write the Image to the Card

Now, use the dd command to write the image. This command copies data bit-by-bit, which is why it’s sometimes called a “disk destroyer” if used carelessly.

sudo dd if=your-image-name.img of=/dev/sdX bs=4M status=progress && sync

Done!

Now you can safely eject the card. Your new operating system is now installed and ready to be booted in your Raspberry Pi!