OS X 上的 dd 与 UNIX 版本相同吗?

OS X 上的 dd 与 UNIX 版本相同吗?

尽管我考虑过在 apple.stackexchange 中提出这个问题,但我的直觉告诉我,“NIX 群体”更有可能产生更好的回应。

dd(OS X 版本)命令与 UNIX(我使用 Ubuntu)有何不同。我想复制一张SD卡按照ddOS X 链接中的规定。

OS X 手册页摘录dd

DESCRIPTION
     The dd utility copies the standard input to the standard output.  Input
     data is read and written in 512-byte blocks.  If input reads are short,
     input from multiple reads are aggregated to form the output block.  When
     finished, dd displays the number of complete and partial input and output
     blocks and truncated input records to the standard error output.

答案1

有一些小的差异,例如 BSD 中缺少状态选项dd,但我不会对此太担心。 AFAIK 核心选项是相同的。

以 root 身份运行以下命令,将diskX/替换diskY为您的磁盘标识符(例如disk1disk2):

# list all disks to find your disk identifier
diskutil list

# unmount your sd card if it is mounted (see `df` or `mount`)
diskutil unmountDisk /dev/diskX

# copy of your sd card to an image file 
dd if=/dev/rdiskX of=sdcard.img bs=1m

# or copy your image file back to an sd card
dd if=sdcard.img of=/dev/rdiskX bs=1m

# or copy your sd card to a different device
dd if=/dev/rdiskX of=/dev/rdiskY bs=1m

请注意,我使用的/dev/rdisk(原始磁盘)通常比缓冲的更快/dev/disk

dd要在运行时查看进度,您可以按Ctrl- T(请参阅这里)。

相关内容