JUST DO IT ~

          我只想當個程序員

          dd 測試磁盤讀寫 linux mac

          time dd if=/dev/zero bs=1024 count=1000000 of=./1Gb.file
          dd if=./1Gb.file bs=64k |dd of=/dev/null
          dd if=./1Gb.file bs=1MB |dd of=/dev/null
          time有計時作用,dd用于復制,從if讀出,寫到of。if=/dev/zero不產生輸出,因此可以用來測試純寫速度。同理of=/dev/null不產生輸入,可以用來測試純讀速度。bs是每次讀或寫的大小,即一個塊的大小,count是讀寫塊的數量。
          寫問文件測試
          ~/tmp>  time dd if=/dev/zero bs=1024 count=1000000 of=./1Gb.file
          1000000+0 records in
          1000000+0 records out
          1024000000 bytes (1.0 GB) copied, 2.28148 s, 449 MB/s
          real 0m2.287s
          user 0m0.240s
          sys 0m1.933s
          ~/tmp> dd if=./1Gb.file bs=64k |dd of=/dev/null
          15625+0 records in
          15625+0 records out
          1024000000 bytes (1.0 GB) copied, 2.67729 s, 382 MB/s
          2000000+0 records in
          2000000+0 records out
          1024000000 bytes (1.0 GB) copied, 2.67744 s, 382 MB/s
          ~/tmp> rm -rf 1Gb.file 
          ~/tmp> dd if=./1Gb.file bs=1MB |dd of=/dev/null
          1024+0 records in
          1024+0 records out
          1024000000 bytes (1.0 GB) copied, 2.40457 s, 426 MB/s
          1999872+1023 records in
          2000000+0 records out
          1024000000 bytes (1.0 GB) copied, 2.40462 s, 426 MB/s







          參考:
          http://www.tsingpost.com/articles/201401/344.html


          語法:dd [選項]

          if =輸入文件(或設備名稱)。

          of =輸出文件(或設備名稱)。

          ibs = bytes 一次讀取bytes字節,即讀入緩沖區的字節數。

          skip = blocks 跳過讀入緩沖區開頭的ibs*blocks塊。

          obs = bytes 一次寫入bytes字節,即寫入緩沖區的字節數。

          bs = bytes 同時設置讀/寫緩沖區的字節數(等于設置ibs和obs)。

          cbs = byte 一次轉換bytes字節。

          count=blocks 只拷貝輸入的blocks塊。

          conv = ASCII 把EBCDIC碼轉換為ASCIl碼。

          conv = ebcdic 把ASCIl碼轉換為EBCDIC碼。

          conv = ibm 把ASCIl碼轉換為alternate EBCDIC碼。

          conv = block 把變動位轉換成固定字符。

          conv = ublock 把固定位轉換成變動位。

          conv = ucase 把字母由小寫轉換為大寫。

          conv = lcase 把字母由大寫轉換為小寫。

          conv = notrunc 不截短輸出文件。

          conv = swab 交換每一對輸入字節。

          conv = noerror 出錯時不停止處理。

          conv = sync 把每個輸入記錄的大小都調到ibs的大小(用NUL填充)。

          posted on 2015-07-19 12:12 小高 閱讀(519) 評論(0)  編輯  收藏 所屬分類: 工作環境搭建GUN命令

          導航

          <2015年7月>
          2829301234
          567891011
          12131415161718
          19202122232425
          2627282930311
          2345678

          統計

          常用鏈接

          留言簿(3)

          隨筆分類(352)

          收藏夾(19)

          關注的blog

          手冊

          搜索

          積分與排名

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 石河子市| 江山市| 乐东| 嘉定区| 东光县| 禹城市| 延庆县| 马鞍山市| 开平市| 泽库县| 内丘县| 永安市| 瑞昌市| 衢州市| 濮阳市| 高州市| 义乌市| 孝义市| 呼伦贝尔市| 屯留县| 南和县| 攀枝花市| 华容县| 余干县| 阳泉市| 宁强县| 河源市| 七台河市| 闵行区| 凤山县| 任丘市| 长垣县| 裕民县| 扎赉特旗| 昌都县| 天津市| 平定县| 巴林右旗| 长宁县| 镇巴县| 留坝县|