dd
Copy a file, converting and formatting according to the operands.[1]
- GNU Coreutils [EN] @ Fedora Package
- GNU Coreutils [EN] @ Homebrew Formula
Documentation
- dd [EN] @ GNU Coreutils Manual
- man 1 'dd' [EN]
Parameters
- bs=BYTES
- Set both input and output block sizes to BYTES. This makes dd read and write bytes per block, overriding any ibs and obs settings. In addition, if no data-transforming conv option is specified, input is copied to the output as soon as it's read, even if it is smaller than the block size.
- conv=ARGUMENT,[...]
- Convert the file as specified by the conversion argument(s).
- count=NUMBER
- Copy NUMBER ibs-byte blocks from the input file, instead of everything until the end of the file. If iflag="count_bytes" is specified, NUMBER is interpreted as a byte count rather than a block count.
- if=FILE
- Read from FILE instead of standard input.
- of=FILE
- Write to FILE instead of standard output. Unless conv="notrunc" is given, dd truncates file to zero bytes (or the size specified with seek=).
- status=LEVEL
- Specify the amount of information printed. If this operand is given multiple times, the last one takes precedence. The LEVEL value can be one of the following:
- none
- Do not print any informational or warning messages to stderr. Error messages are output as normal.
- noxfer
- Do not print the final transfer rate and volume statistics that normally make up the last status line.
- progress
- Print the transfer rate and volume statistics on stderr, when processing each input block. Statistics are output on a single line at most once every second, but updates can be delayed when waiting on I/O.
Examples
Show all external physical devices to find the correct device
diskutil list 'external' 'physical'
diskutil unmountDisk '/dev/disk3'
Create the ISO image
dd if='/dev/disk3s0' of="${HOME}/tmp/cd-image.iso"
Show all external physical devices to find the correct device
diskutil list 'external' 'physical'
Format the USB flash drive with FAT32
sudo diskutil eraseDisk 'FAT32' 'DRIVE_NAME' 'MBR' '/dev/disk3'
Umount the USB flash drive
sudo diskutil unmountDisk '/dev/disk3'
Copy the ISO image to the USB flash drive
sudo dd if='image.iso' of='/dev/disk3' bs='4M' status='progress'
Eject the USB flash drive
sudo diskutil eject '/dev/disk3'
References
- ↑ man 1 'dd'