dd
dd
copy an image to an sd card
I’m using gdd here, this requires the homebrew package coreutils on a mac. dd might also just work on your system.
copy a raspberry pi os image to an sd card:
dd if=2021-05-07-raspios-buster-armhf.img of=/dev/rdisk4 bs=32M conv=fsync status=progressbackup and restore image
get blocksize:
stat -f /dev/sdcbackup disk / sd-card to an image:
dd if=/dev/sdc of=rpi_backup.img bs=4096 conv=noerror,sync status=progressrestore image to disk/sd-card:
just reverse the above:
dd if=rpi_backup.img of=/dev/sdb bs=4096 conv=noerror,sync status=progresswrite directly to disk from stdin (wget, curl etc.)
it’s 2022, curl|bash is fine (👮♂️), so wget | dd is as well. Common use case: You got a rescue system with a live cd but not enough/configurable storage and want to write a linux iso directly to another disk. Also, Ubuntu doesn’t provide an easy to find netboot image anymore so you need at least a 1.3gb download.
wget -O - https://cdimage.ubuntu.com/ubuntu-server/focal/daily-live/current/focal-live-server-amd64.iso | dd of=/dev/sdaflash iso to usb stick on macos
diskutil list # find the thumb drive you just inserted
diskutil unmountDisk disk7 # unmount all partitions
dd if=ubuntu-22.04-desktop-amd64.iso of=/dev/rdisk7 bs=4M ## use rdisk instead of disk to make it fast