Linux badblocks命令詳解 Linux badblocks命令怎麼用

來源:互聯網
上載者:User

執行指令時須指定所要檢查的磁碟裝置,及此裝置的磁碟區塊數。

文法

badblocks [-svw][-b <區塊大小>][-o <輸出檔案>][磁碟裝置][磁碟區塊數][啟始區塊]

參數說明:

  • -b<區塊大小> 指定磁碟的區塊大小,單位為位元組。
  • -o<輸出檔案> 將檢查的結果寫入指定的輸出檔案。
  • -s 在檢查時顯示進度。
  • -v 執行時顯示詳細的資訊。
  • -w 在檢查時,執行寫入測試。
  • [磁碟裝置] 指定要檢查的磁碟裝置。
  • [磁碟區塊數] 指定磁碟裝置的區塊總數。
  • [啟始區塊] 指定要從哪個區塊開始檢查。

執行個體

查看系統當前硬碟資訊。

# fdisk -l

例如,顯示資訊如下:

Disk /dev/sda: 298.9 GB, 298999349248 bytes

255 heads, 63 sectors/track, 36351 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot             Start                End                 Blocks             Id            System

/dev/sda1                       1                262                 2104483+      82           Linux swap / Solaris

/dev/sda2 *                263            32898            262148670        83           Linux

/dev/sda3              32899            36351              27736222+      83           Linux

Disk /dev/sdb: 42.9 GB, 42949672960 bytes

64 heads, 32 sectors/track, 40960 cylinders

Units = cylinders of 2048 * 512 = 1048576 bytes

通過命令掃描硬碟。

# badblocks -s -v /dev/sdnx

其中n表示硬碟裝置名稱,x表示硬碟對應的分區號。例如需要檢查"/dev/sda2",執行命令如下:

# badblocks -s -v /dev/sda2

Checking blocks 0 to 30681000

Checking for bad blocks (read-only test): 306809600674112/ 306810000000

30680964

30680965

30680966

30680967

30680968

30680969

30680970

30680971

30680972

30680973

...

done

Pass completed, 37 bad blocks found.其中,“37 bad blocks found”表示硬碟存在37個壞塊。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.