Q:在CentOS上设置RAID1,遇到错误

Q:在CentOS上设置RAID1,遇到错误

我对 Linux/设置 RAID 很陌生,我的任务是在 CentOS 系统上设置 RAID1。我发现自己陷入困境,谷歌没有太多运气。

我尝试通过以下命令创建 RAID1 设备并收到此错误:

[root@itc160 itc]# mdadm --create --verbose /dev/md0 --level=mirror--raid-devices=2 /dev/sda2 /dev/sdb1
mdadm: super1.x cannot open /dev/sda2: Device or resource busy
mdadm: ddf: Cannot use /dev/sda2: Device or resource busy  
mdadm: Cannot use /dev/sda2: It is busy
mdadm: cannot open /dev/sda2: Device or resource busy

我的 fdisk-l 日志如下所示:

[root@itc160 itc]# fdisk -l

Disk /dev/sda: 250.1 GB, 250059350016 bytes, 488397168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x0000e7e0

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200   123344895    60622848   8e  Linux LVM
/dev/sda3       123344896   488397167   182526136   fd  Linux raid autodetect

Disk /dev/sdb: 250.1 GB, 250059350016 bytes, 488397168 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: 0x7ce03322

Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048   488397167   244197560   fd  Linux raid autodetect

Disk /dev/mapper/centos-root: 53.7 GB, 53687091200 bytes, 104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/mapper/centos-swap: 8384 MB, 8384413696 bytes, 16375808 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

是我分区出错了,还是有什么东西让我的设备繁忙?

编辑*

尝试按照建议卸载,但无济于事。

[root@itc160 itc]# umount /dev/sda2
umount: /dev/sda2: not mounted

答案1

/dev/sda2 被标识为“8e Linux LVM”。它最有可能是某个卷组 (VG) 的一部分。尝试列出服务器上 LVM 使用的物理卷 (PV):

pvs

如果它确实在某些 VG 中使用,则必须删除该 VG 或从该 VG 中删除 PV /dev/sda2。小心点!

如果它不是真正用作物理卷,请将分区类型更改为“fd Linux raid autoDetect”。

相关内容