How to write Rasbian OS raspios.img file using dd to sd card on Linux

I need to install 2021-01-11-raspios-buster-armhf-lite.img file on my 4 GB sd card. I am on Ubuntu Linux desktop. I think we can use dd command. How do I write Rasbian OS raspios.img file using dd to sd card on Linux command line?

:point_right: Double-check sd card names. Writing an image to the wrong device will result in disaster and data loss. :point_left: :

  1. Insert SD card into the reader and attach it to the computer
  2. Run the dmsg or lsblk to find actual actual device name.
    dmsg
    OR
    lsblk
    I see /dev/sdb as SD card device.
  3. Unmount /dev/sdb if mounted automatically
    df
    mount
    sudo umount /media/somename/
    sudo umount /dev/sdb1
  4. Use the dd command:
    sudo dd if=2021-01-11-raspios-buster-armhf-lite.img of=/dev/sdb bs=4M conv=fsync
  5. To see progress add:
    sudo dd if=2021-01-11-raspios-buster-armhf-lite.img of=/dev/sdb bs=4M conv=fsync status=progress
  6. Remove the card and insert into your Raspberry PI.
1 Like

lsblk said my card is at /dev/sdc.

lsblk 

Then I ran df and I saw /dev/sdc1 was mounted and i got rid of it

sudo umount /dev/sdc1

Then i type:

sudo dd if=2021-01-11-raspios-buster-armhf-lite.img of=/dev/sdc bs=4M conv=fsync status=progress

just finished it. it took some time but it said:

444+0 records in
444+0 records out
1862270976 bytes (1.9 GB, 1.7 GiB) copied, 426.158 s, 4.4 MB/s

No progress bar displayed. is that normal on Ubuntu desktop?

Not sure, but most SD cards slow, and the USB interface doesn’t help either. Not related to Ubuntu or dd. Let us know if you have any other problems.


Linux sysadmin blog - Linux/Unix Howtos and Tutorials - Linux bash shell scripting wiki