1、查看硬盘分区
[root@localhost ~]# df -hl
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 32G 9.6G 21G 32% /
tmpfs 16G 0 16G 0% /dev/shm
/dev/sda1 97M 34M 59M 37% /boot
/dev/sda6 241G 2.3G 226G 1% /dbup
/dev/sda8 32G 262M 30G 1% /dbbuf
/dev/sda5 504G 441M 478G 1% /dbc
/dev/sda7 95G 188M 90G 1% /dblog
[root@localhost ~]#
2、查看硬盘分区详细信息
[root@localhost ~]# fdisk -l
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x000863be
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 102400 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 13 2053 16384000 82 Linux swap / Solaris
/dev/sda3 2053 6290 34030592 83 Linux
/dev/sda4 6290 121602 926244568 5 Extended
/dev/sda5 6290 73022 536027136 83 Linux
/dev/sda6 73022 104893 256000000 83 Linux
/dev/sda7 104893 117425 100663296 83 Linux
/dev/sda8 117425 121602 33549312 83 Linux
[root@localhost ~]#
上图sda disk information中对 255 heads,63 sectors/track,121601 cylinders的解析:
sda磁盘总共有121601个cylinder(柱面),每个cylinder(柱面)有63个sectors(扇区),每个sectors(扇区)有255个heads(磁头)
那么这块sda的总的磁头数量为:255*63*121601=1953520065
因为一块磁盘的空间大小计算方式为:这块磁盘的总的磁头数量(Heads)*512bytes(因为每个磁头数量为512字节)
所以这块磁盘的空间为1953520065*512=1000202273280bytes=1000.2G
badblocks -v /dev/sda1 > /home/result.txt
badblocks命令解析
来自: http://man.linuxde.net/badblocks
来自: http://man.linuxde.net/badblocks
来自: http://man.linuxde.net/badblocks
-o<输出文件>:将检查的结果写入指定的输出文件;
-s:在检查时显示进度;
-v:执行时显示详细的信息;
-w:在检查时,执行写入测试。
示例:
--badblocks以4096的一个block,每一个block检查16次,将结果输出到“hda-badblocks-list”文件里。
badblocks -b 4096 -c 16 /dev/hda1 -o hda-badblocks-list
--可以针对可疑的区块多做几次操作。下面,badblocks以4096字节为一个“block”,每一个“block”检查1次, 将结果输出到“hda-badblocks-list.1”文件中,由第51000 block开始,到63000 block结束。
badblocks -b 4096 -c 1 /dev/hda1 -o hda-badblocks-list.1 63000 51000