dd
Updated: August 10, 2024
Disk Duplicater can convert, copy and format. This works on block and character devices.
A block device is something like sda1. A character device is a stream like /dev/zero. dd uses the old IBM Job Control Language (JCL). Rather than using - for signifying an option, you set its value with =
Options
if=file # The input file (default is std in)
of=file # The output file (defualt is std out)
bs=size # The block size in b or k (bs=1k is same as bs=1024)
ibs=size # The input block size (use ibs,obs when you can't use the same block size)
obs=size # The output block size
# When working with a huge file—or with a device that supplies an endless stream of data, such as /dev/zero—you want
# dd to stop at a fixed point; otherwise, you could waste a lot of disk space, CPU time, or both.
count=num # Total number of blocks to copy
skip=num # Skip past first num of blocks
Erase a disk
sudo dd if=/dev/zero of=/dev/sdb2 #of=/dev/whatever drive you want zero’d could be sda1, sda, dm-0.
status=progress # visualize with progress bar
# if dd is already running and you want to see progress:
sudo kill -USR1 $(pgrep ^dd) # OSX us INFO instead of USR1
Duplicate Pi4
sudo fdisk -l # or diskutil list (if on mac)
sudo dd if=/dev/disk2 (disk to copy) of=~/location/filename.clone (ext .dmg)
# this will take several hours | on newly formatted disk just do reverse of previous
sudo dd if=~/Desktop/pi3bk.dmg of=/dev/disk2