linux磁碟檢測和修復
阿新 • • 發佈:2019-01-05
顯示磁碟和快閃記憶體的資訊,以及分割槽資訊
[root@bogon shell]# fdisk -l
Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x00043062
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 616447 307200 83 Linux
/dev/sda2 616448 4810751 2097152 82 Linux swap / Solaris
/dev/sda3 4810752 41943039 18566144 83 Linux
#壞道/壞塊檢查
[root@bogon shell]# badblocks /dev/sda1
[root@bogon shell]# badblocks -v /dev/sda1 #-v顯示檢查過程
Checking blocks 0 to 307199
Checking for bad blocks (read-only test): done
Pass completed, 0 bad blocks found. (0/0/0 errors)
[root@bogon shell]#
#使用smartmontools工具掃描壞道
yum install smartmontools -y #安裝工具
[root@bogon shell]# smartctl -H /dev/sda1 #檢查/dev/sda1健康狀況
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.10 .0-514.el7.x86_64] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF READ SMART DATA SECTION ===
SMART Health Status: OK
[root@bogon shell]#
e2fsck用於檢查和修復ext3和ext2檔案系統的硬碟分割槽,不過這個命令還有專有形式:fsck.ext3, fsck.ext2分別用於檢測ext3和ext2。