硬盘检测工具
一般检测磁盘坏道或健康情况可以使用 smartctl
进行处理,如下:
安装
1
| apt-get install smartmontools
|
开始检测
1
| smartctl -s on -t [long/short] /dev/sdb
|
查看结果
1
| smartctl -l selftest /dev/sdb
|
健康情况
所有情况
擦除硬盘超块
1
| dd if=/dev/zero of=/dev/vda5 bs=1024 count=1
|
软阵列命令
如果需要用整块硬盘做阵列则不需要进行分区,如果需要对硬盘某一个分区做阵列则需要分区并把 id
改为 fd
分区,type
命名为 Linux raid autodetect
。
查看所有阵列信息
检测阵列元信息
1
| mdadm --examine /dev/sdb
|
扫描阵列并启动
1
| mdadm -As /dev/md3 /dev/sdb
|
利用阵列 UUID
启动
1
| mdadm --assemble /dev/md1 --uuid=70f7a39e:85aa5dab:3978c95b:eeb73a29
|
停用阵列
1
| mdadm --manage --stop /dev/md1
|
增加设备到阵列
如何阵列的 raid devices
只有 1
个的话,此磁盘应该会被添加为 spare
。
1
| mdadm --manage /dev/md1 --add /dev/sdb
|
从阵列删除设备
1
| mdadm --manage /dev/md1 --remove /dev/sdb
|
配置文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
| # mdadm.conf
#
# Please refer to mdadm.conf(5) for information about this file.
#
# by default (built-in), scan all partitions (/proc/partitions) and all
# containers for MD superblocks. alternatively, specify devices to scan, using
# wildcards if desired.
#DEVICE partitions containers
# auto-create devices with Debian standard permissions
CREATE owner=root group=disk mode=0660 auto=yes
# automatically tag new arrays as belonging to the local system
HOMEHOST <system>
# instruct the monitoring daemon where to send mail alerts
MAILADDR root
# definitions of existing MD arrays
ARRAY /dev/md/2 metadata=1.2 UUID=3b9e0841:d8630d15:f018f738:f904a782 name=DiskStation:2
ARRAY metadata=imsm UUID=ee247948:9196c6b1:ce55b4a0:bcaf4e7f
ARRAY /dev/md/Volume0 container=ee247948:9196c6b1:ce55b4a0:bcaf4e7f member=0 UUID=70f7a39e:85aa5dab:3978c95b:eeb73a29
ARRAY /dev/md/3 metadata=1.2 UUID=3f07875d:0bc45558:7a04246c:685352d7 name=DiskStation:3
# This file was auto-generated on Tue, 16 Jan 2018 13:16:55 +0000
# by mkconf $Id$
|