
我試圖將 Windows 安裝程式的 iso 複製到硬碟上以避免燒毀磁碟。我首先嘗試了磁碟工具的復原功能,但由於某些原因它不喜歡 ISO。然後我嘗試使用 dd:
dd if=/path/to/image.iso of=/dev/disk3
我意識到它正在以蝸牛般的速度複製文件,大約 160 KB/秒。我重新啟動到我的 Linux 安裝並再次運行命令,幾乎逐字逐句:
dd if=/path/to/image.iso of=/dev/sdc
這次命令執行時間不到一分鐘,平均速度為 57 MB/秒。在這兩種情況下,來源和目標都是相同的實體硬碟。這是怎麼回事?
我正在運行 OSX 10.7.3 和 Linux 2.6.38-13。
答案1
對於 OS X,請使用/dev/rdisk3
.
由於某種原因rdisk
比 更快disk
。我相信這與緩衝區有關。
一般來說,使用bs
標誌有助於dd
提高速度。
dd if=/path/to/image.iso of=/dev/sdc bs=1M
位元組大小為 1M,傳輸速度更快。在 OS X 上,您必須使用1m
(小寫)而不是1M
.
答案2
BSD 原始磁碟
BSD 通常有 2 種磁碟裝置類型:緩衝和非緩衝(原始)。從hdutil(1)
手冊頁:
DEVICE SPECIAL FILES
Since any /dev entry can be treated as a raw disk image, it is worth
noting which devices can be accessed when and how. /dev/rdisk nodes
are character-special devices, but are "raw" in the BSD sense and
force block-aligned I/O. They are closer to the physical disk than
the buffer cache. /dev/disk nodes, on the other hand, are buffered
block-special devices and are used primarily by the kernel's
filesystem code.
It is not possible to read from a /dev/disk node while a filesystem
is mounted from it, ...
由於第2段,磁碟必須未安裝的能夠dd
在“原始模式”下使用它。
dd 區塊大小
從dd(1)
手冊頁:
Where sizes are specified, a decimal, octal, or hexadecimal number of bytes
is expected. If the number ends with a ``b'', ``k'', ``m'', ``g'', or ``w'',
the number is multiplied by 512, 1024 (1K), 1048576 (1M), 1073741824 (1G) or
the number of bytes in an integer, respectively. Two or more numbers may be
separated by an ``x'' to indicate a product.
預設區塊大小是 512 位元組...