由于机房在外地,公司在托管商买了台新服务器。让机房帮安装系统,但机房安装了有10多次了还是存在问题。不是分区方式有问题,就是系统文件损坏。 

出于习惯新安装系统我都会查看下:install.log,messages,以及分区,内存,硬盘等信息。

系统环境:

# cat /etc/issue
CentOS release 5.6 (Final)
# uname -a
Linux svn-1 2.6.18-238.el5xen #1 SMP Thu Jan 13 16:41:45 EST 2011 x86_64 x86_64 x86_64 GNU/Linux

下面是其中一处错误:

问题:系统安装日志有报错
Linux 磁盘存在旧RAID信息,清除raid信息_raid信息
分析:使用dmesg命令查看得到
Linux 磁盘存在旧RAID信息,清除raid信息_raid信息_02

Google得知,此问题是硬盘上遗留有RAID信息,系统会根据残留的信息自动发现raid,由于系统的自动识别,硬盘被虚拟地组建成了raid(即便没有真实raid存在),这就提示磁盘正在被使用,硬盘无法格式化。

确认了一下:

[root@web1 ~]# dmraid -s
ERROR: ddf1: wrong # of devices in RAID set"ddf1_4035305a8680b02520202020202020209a33c30a3a354a45" [1/2] on/dev/sda
*** Group superset .ddf1_disks
--> *Inconsistent*Active Subset
name  : ddf1_4035305a8680b02520202020202020209a33c30a3a354a45
size  : 145051648
stride : 128
type  : mirror
status : inconsistent
subsets: 0
devs  : 1
spares : 0
[root@web1 mapper]# dmsetup status
ddf1_4035305a8680b02520202020202020209a33c30a3a354a45:0 145051651 linear
释放对磁盘的使用可以使用如下方法:
1) dmsetup remove_all
[root@web1 mapper]# dmsetup remove_all
# dmsetup remove /dev/mapper/[device]
[root@web1 mapper]#  dmsetup status
No devices found
2) 用dmraid来disableactive状态:dmraid -a no
[root@web1 conf]# dmraid -a no
ERROR: ddf1: wrong # of devices in RAID set"ddf1_4035305a8680b02520202020202020209a33c30a3a354a45" [1/2] on/dev/sda
ERROR: device"ddf1_4035305a8680b02520202020202020209a33c30a3a354a45" could not befound
RAID set"ddf1_4035305a8680b02520202020202020209a33c30a3a354a45" is not active
--验证:
[root@web1 ~]# dmraid -s
ERROR: ddf1: wrong # of devices in RAID set"ddf1_4035305a8680b02520202020202020209a33c30a3a354a45" [1/2] on/dev/sda
*** Group superset .ddf1_disks
--> *Inconsistent*Subset
name  : ddf1_4035305a8680b02520202020202020209a33c30a3a354a45
size  : 145051648
stride : 128
type  : mirror
status : inconsistent
subsets: 0
devs  : 1
spares : 0

释放以后我们就可以对磁盘格式化,在进行挂载了。

但这样在系统重启之后,还是会识别到磁盘的RAID信息,依旧不能正常mount。尝试清除磁盘上RAID的信息。

--使用dmraid –x:
[root@web1 ~]# dmraid -x
ERROR: ddf1: wrong # of devices in RAID set"ddf1_4035305a8680b02520202020202020209a33c30a3a354a45" [1/2] on/dev/sda
About to delete RAID setddf1_4035305a8680b02520202020202020209a33c30a3a354a45
WARNING: The metadata stored on theraidset(s) will not be accessible after deletion
Do you want to continue ? [y/n] :y
ERROR: Raid set deletion is notsupported in "ddf1" format
--使用:dmraid -rE
[root@web1 mapper]# dmraid -rE
Do you really want to erase"ddf1" ondisk metadata on /dev/sda ? [y/n] :y
ERROR: ddf1: seeking device"/dev/sda" to 38070153641984
ERROR: writing metadata to /dev/sda, offset74355768832 sectors, size 0 bytes returned 0
ERROR: erasing ondisk metadata on /dev/sda

在使用了如上方法之后还是会有报错。因为是新系统,所以果断清空硬盘(重新分区,格式化是没用的)

dd if=/dev/zero of=/dev/sda   #全部硬盘清零

这个命令很慢,如果硬盘很大,需要好几个小时。

清完之后重新分区,挂载,重启之后再也没出现错误ok。

 

如果这篇文章帮助到了你,请点个赞!