{"id":6068,"date":"2016-09-28T21:32:58","date_gmt":"2016-09-28T13:32:58","guid":{"rendered":"https:\/\/kyle.ai\/blog\/?p=6068"},"modified":"2016-09-28T22:03:51","modified_gmt":"2016-09-28T14:03:51","slug":"%e5%9c%a8mac%e4%b8%ad%e5%8a%a0%e5%bf%abdd%e5%91%bd%e4%bb%a4%e7%9a%84%e8%bf%90%e8%a1%8c%e9%80%9f%e5%ba%a6","status":"publish","type":"post","link":"https:\/\/kyle.ai\/blog\/6068.html","title":{"rendered":"\u5728mac\u4e2d\u52a0\u5febdd\u547d\u4ee4\u7684\u8fd0\u884c\u901f\u5ea6"},"content":{"rendered":"<p>\u5728\u7528dd\u547d\u4ee4\uff0c\u5c06\u4e00\u4e2aSD\u5361\u590d\u5236\u5230\u53e6\u4e00\u4e2aSD\u8fc7\u7a0b\u4e2d\uff0c\u53d1\u73b0\u901f\u5ea6\u975e\u5e38\u6162\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo diskutil unmount \/dev\/disk2s1\r\nsudo diskutil unmount \/dev\/disk3s1\r\nsudo dd bs=1m if=\/dev\/disk2  of=\/dev\/disk3\r\n<\/pre>\n<p>\u7136\u540e\u5728\u53e6\u4e00\u4e2ashell\u4e2d\u8fd0\u884c\u547d\u4ee4\u53ef\u4ee5\u67e5\u770b\u8fdb\u5ea6\u60c5\u51b5\uff1a<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo pkill -INFO dd   # mac\u7cfb\u7edf\r\nsudo killall -USR1 dd # linux\u7cfb\u7edf\r\n\r\n3+0 records in\r\n2+0 records out\r\n20971520 bytes transferred in 39.393646 secs (532358 bytes\/sec)\r\n<\/pre>\n<p>\u8fd8\u6709\u53e6\u5916\u51e0\u79cd\u67e5\u770b\u8fdb\u5ea6\u7684\u65b9\u6cd5\uff1a<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nCTRL + T\r\n<\/pre>\n<p>Sends SIGINFO to the process. This is a BSD feature OS X inherited. You must have the terminal window executing dd selected when entering CTRL + T for this to work.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\npv -tpreb \/dev\/sda | dd of=\/dev\/sdb bs=1M\r\n<\/pre>\n<p>Your platform may not have pv by default. If you are using Homebew on OSX, simply &#8216;brew install pv&#8217;.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nwhile pgrep ^dd; do pkill -INFO dd; sleep 10; done\r\n<\/pre>\n<p>While a dd is running in one terminal, open another and enter the while loop. The sample output will be displayed in the window running the dd and the while loop will exit when the dd is complete. It&#8217;s possible that a &#8220;sudo&#8221; will need to be inserted before &#8220;pkill&#8221;, depending on your setup, for example: <\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nwhile killall -USR1 dd; do sleep 5; done\r\n<\/pre>\n<p>Stops when the (last) dd process exits.<\/p>\n<p>\u6211\u8fd9\u6837\u7528dd\u4e00\u4e2a\u591a\u5c0f\u65f6\u540e\uff0c8G\u5927\u5c0f\u7684SD\u5361\u624d\u590d\u52362G\u591a\u4e00\u70b9\u3002\u89c9\u5f97\u592a\u6162\u4e86\uff0c\u7136\u540e\u4e0a\u7f51\u67e5\u4e86\u600e\u4e48speed up\uff0c\u6709\u4eba\u8bf4\u52a0\u5927bs=1m\u8fd9\u4e2a\u53c2\u6570\u4f1a\u6709\u4f5c\u7528\uff1a<\/p>\n<p>Adjusting the bs parameter can increase the speed, for example, I have 2 HDD that I know have a read\/write speed greater than 100 MB\/s so I do this:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ndd if=\/dev\/sda of=\/dev\/sdb bs=100M\r\n<\/pre>\n<p>There is also pv (Needs to be installed first) that checks for the fastest speed on both drives and then proceeds on cloning. This has to be done of course from root:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\npv &lt; \/dev\/sda &gt; \/dev\/sdb\r\n<\/pre>\n<p>\u53c2\u8003 \uff1ahttp:\/\/askubuntu.com\/questions\/523037\/how-would-i-speed-up-a-full-disk-dd<\/p>\n<p>\u5f53\u6211\u8c03\u6574bs=1m\uff0c\u5230bs=10m\u65f6\uff0c\u518d\u6b21\u8bd5\u9a8c \uff0c\u53d1\u73b0\u901f\u5ea6\u6839\u672c\u6ca1\u6709\u592a\u5927\u53d8\u5316\u3002<\/p>\n<p>\u540e\u6765\u518d\u627e\u8d44\u6599\uff0c\u53d1\u73b0\u8ddfmac\u7cfb\u7edf\u672c\u8eab\u6709\u5173\u7cfb\u3002\u628a \/dev\/disk2  \u4fee\u6539\u6210 \/dev\/rdisk2 \u5c31\u4f1a\u5feb\u4e86\u3002<\/p>\n<p>\u53c2\u8003 \uff1ahttp:\/\/apple.stackexchange.com\/questions\/56159\/how-can-i-speed-up-sd-card-writing-speed-using-dev-disk-on-a-macbook-pro<br \/>\n\u53c2\u8003 \uff1ahttp:\/\/daoyuan.li\/solution-dd-too-slow-on-mac-os-x\/<\/p>\n<p>\u4e0b\u9762\u8fd9\u6837\u4f1a\u5feb\u4e0a\u51e0\u5341\u500d\uff1a<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo dd bs=10m if=\/dev\/rdisk2  of=\/dev\/rdisk3                                                                                               21:22:25\r\n2+0 records in\r\n1+0 records out\r\n10485760 bytes transferred in 4.558941 secs (2300043 bytes\/sec)\r\n6+0 records in\r\n5+0 records out\r\n52428800 bytes transferred in 14.382413 secs (3645341 bytes\/sec)\r\n212+0 records in\r\n211+0 records out\r\n2212495360 bytes transferred in 523.833141 secs (4223664 bytes\/sec)\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u7528dd\u547d\u4ee4\uff0c\u5c06\u4e00\u4e2aSD\u5361\u590d\u5236\u5230\u53e6\u4e00\u4e2aSD\u8fc7\u7a0b\u4e2d\uff0c\u53d1\u73b0\u901f\u5ea6\u975e\u5e38\u6162\u3002 sudo diskutil unmount [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-6068","post","type-post","status-publish","format-standard","hentry","category-skill"],"_links":{"self":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/6068","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/comments?post=6068"}],"version-history":[{"count":2,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/6068\/revisions"}],"predecessor-version":[{"id":6070,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/6068\/revisions\/6070"}],"wp:attachment":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/media?parent=6068"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/categories?post=6068"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/tags?post=6068"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}